Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Browser shows local variables as if they were globals #633

Closed
gpetrowitsch opened this issue Sep 28, 2015 · 0 comments
Closed

Code Browser shows local variables as if they were globals #633

gpetrowitsch opened this issue Sep 28, 2015 · 0 comments
Assignees
Milestone

Comments

@gpetrowitsch
Copy link

I have a Perl module that defines a class with a bunch of methods. These are shown nicely and correctly in the Code Browser sidebar. However, for some reason, sometimes a local variable is interpreted by the Code Browser as if it were global and shown that way.

E.g.: I defined these 3 functions (one after the other as they are included down below). As you can see they only use local variables. However in the Code Browser - for some reason - $me and $cmd are shown on the top level - as if they were globals (see attached image).
wrongglobals

This was the case in Komodo 8.5 and is still there in the latest version version 9.2.1, build 87651.

sub writeWord {  # (addr, data): write a data word to DP2x memory
  my ($self, $addr, $data, %args) = @_;
  my $me = (caller(0))[3];
  $self->_setErr("ERROR: $me(): at least one required parameter is missing."), return undef unless (defined $addr) and (defined $data);
  my $adr = $self->_int2Arg($addr);
  my $dat = $self->_int2Arg($data);
  return undef unless (defined($adr) and defined($dat));
  if (defined $args{-port}) {
    if ($args{-port} eq "dp2x") {
      my $resp = $self->_memWriteWord($adr,$dat);
      $resp = $self->_retry($me, sub { $self->_memWriteWord(@_) }, ($adr, $dat)) unless defined $resp;
      return $resp;
    } else {
      $addr &= 0x000F;
      $addr |= 0x0010; # user only needs to specify addresses from 0..15 -> chip select bit (bit 4) is added here
      return $self->_spiWriteWord($addr, $data, "spi", %args); # branch to "spi" port version
    }
  }
  $me = $self->_getBaseName($me);
  $self->_setErr("ERROR ($self->{whatami}): Port 'native' has no function '$me'.");
  return undef;
}
sub writeWords {  # (addr, buffer): write a buffer to DP2x memory, starting at the specified address
  my ($self, $addr, $bufRef, %args) = @_;
  my $me = (caller(0))[3];
  $self->_setErr("ERROR: $me(): at least one required parameter is missing."), return undef unless (defined $addr) and (defined $bufRef);
  my $adr = $self->_int2Arg($addr);
  return undef unless defined($adr);
  $self->_setErr("ERROR: $me(): expecting an ARRAY reference for the second parameter"), return undef unless (ref $bufRef eq "ARRAY");
  my $cmd = "CMD10".$self->_int2Arg(1); # select firmware buffer
  return undef unless $self->_sendRawCmd($cmd);
  my $crc = $self->_calcDp2xCRC($bufRef);
  $cmd = "CMD1E".$adr.$self->_int2Arg(2*scalar(@{$bufRef})).$self->_int2Arg($crc); # send write buffer command - length is in bytes, data comes in words
  return undef unless $self->_sendRawCmd($cmd);
  return undef unless $self->send_word_buffer($bufRef);  # send the data (function inherited from RpcDevice)
  # write buffer to the chip (retry in case of errors (which is not unlikely for any UART transfers))
  $cmd = "CMD0A"; # write buffer to chip
  my $state = $self->_sendRawCmd($cmd);
  $state = $self->_retry($me, sub { $self->_sendRawCmd(@_); }, $cmd) unless defined $state;
    return $state unless (defined $state) && ($args{-burn}==1);
    # now burn the data to the OTP
  $cmd = "CMD0E";
  return $self->_sendRawCmd($cmd);
}
sub writeDmem {  # (sel, data): write selected DMEM location
  my ($self, $sel, $data, %args) = @_;
  my $me = (caller(0))[3];
    $self->_setErr("ERROR: $me(): command not supported in FW1.x - use writeWord instead!"), return undef if ($self->{realFwVersion}<2); # could be mapped here, but I'm too lazy
  $self->_setErr("ERROR: $me(): at least one required parameter is missing."), return undef unless (defined $sel) and (defined $data);
  my $adr = $self->_int2Arg($sel);
  my $dat = $self->_int2Arg($data);
  return undef unless (defined($adr) and defined($dat));
  my $cmd = "CMD6B".$adr.$dat;
  my $resp = $self->_sendRawCmd($cmd);
  $resp = $self->_retry($me, sub { $self->_sendRawCmd(@_) }, $cmd) unless defined $resp;
  return $resp;
}
@mitchell-as mitchell-as added this to the 9.3 milestone Sep 28, 2015
@mitchell-as mitchell-as self-assigned this Sep 28, 2015
@tonyattwood
Copy link

Yo!

I've heard about a new fish restaurant opening next saturday, are you planning to go there? Here is some info about that http://advantage.seanscarmardo.com/e4ymt

Thx, tony.attwood

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants