Permalink
Browse files

Move add_categorical responsibilities out of STD.add_my_name

  • Loading branch information...
1 parent d58f791 commit 55018cb1c404da041614ab3030a5432ff8e4ceaa @sorear committed Jun 15, 2011
Showing with 19 additions and 4 deletions.
  1. +4 −0 TODO
  2. +10 −2 src/NieczaActions.pm6
  3. +0 −1 src/NieczaFrontendSTD.pm6
  4. +5 −1 src/niecza
View
4 TODO
@@ -114,3 +114,7 @@ Other stuff to do after:
- cnperl6 prototyping...
- CLR: KISS and then play with async I/O, possibly including soric
- Fix up name handling
+ - fix stubbing of qualified packages
+ - fix { my $x } crash
+ - blast/statement_level
+ - is tighter/looser/equiv
View
@@ -1477,6 +1477,7 @@ method term:value ($/) { make $<value>.ast }
method package_var($/, $slot, $name, $path, :$list, :$hash) {
$/.CURSOR.trymop({
+ $/.CURSOR.check_categorical($slot);
$*CURLEX<!sub>.add_common_name($slot,
$*CURLEX<!sub>.find_pkg($path), $name, |mnode($/));
});
@@ -1778,6 +1779,7 @@ method param_var($/) {
}
$/.CURSOR.trymop({
+ $/.CURSOR.check_categorical($slot);
$*CURLEX<!sub>.add_my_name($slot, :$list, :$hash, |mnode($/),
noinit => ?($*SIGNUM)) if defined($slot);
});
@@ -2249,6 +2251,7 @@ method variable_declarator($/) {
make self.add_attribute($/, $v<name>, $v<sigil>, $t eq '.', $res_tc);
} elsif $scope eq 'state' {
$/.CURSOR.trymop({
+ $/.CURSOR.check_categorical($slot);
$*CURLEX<!sub>.add_state_name($slot, self.gensym, :$list,
:$hash, typeconstraint => $res_tc, |mnode($/));
});
@@ -2257,6 +2260,7 @@ method variable_declarator($/) {
make self.package_var($/, $slot, $slot, ['OUR'], :$list, :$hash);
} else {
$/.CURSOR.trymop({
+ $/.CURSOR.check_categorical($slot);
$*CURLEX<!sub>.add_my_name($slot, :$list, :$hash,
typeconstraint => $res_tc, |mnode($/));
});
@@ -2357,6 +2361,7 @@ method make_constant($/, $scope, $name, $path) {
self.gensym;
$/.CURSOR.trymop({
+ $/.CURSOR.check_categorical($slot);
if $scope eq 'our' {
$*CURLEX<!sub>.add_common_name($slot,
$*CURLEX<!sub>.find_pkg($path // ['OUR']), $name, |mnode($/));
@@ -3160,14 +3165,17 @@ method install_sub($/, $sub, :$multiness is copy, :$scope is copy, :$class,
$symbol ~= ":(!proto)" if $multiness eq 'proto';
} elsif $bindlex {
$symbol = '&' ~ $name;
- $sub.outer.add_dispatcher($symbol, |mnode($/))
- if $multiness ne 'only' && !$sub.outer.lexicals.{$symbol};
+ if $multiness ne 'only' && !$sub.outer.lexicals.{$symbol} {
+ $/.CURSOR.check_categorical($symbol);
+ $sub.outer.add_dispatcher($symbol, |mnode($/))
+ }
given $multiness {
when 'multi' { $symbol ~= ":({ self.gensym })"; }
when 'proto' { $symbol ~= ":(!proto)"; }
}
} else {
+ $/.CURSOR.check_categorical($symbol);
$symbol = self.gensym;
}
@@ -33,7 +33,6 @@ role bracket_categorical[$name,$sym1,$sym2,$O] {
method add_categorical($name) {
# Signature extension, not categorical
if $name ~~ /^\w+\:\(/ {
- self.add_my_name($name);
return self;
}
# CORE names are hardcoded
View
@@ -174,6 +174,10 @@ method is_name($longname, $curlex = $*CURLEX) {
$ret;
}
+method check_categorical ($name) {
+ self.add_categorical(substr($name,1)) if $name ~~ /^\&\w+\:/;
+}
+
method add_my_name ($n, $d?, $p?) {
my $name = $n;
self.deb("add_my_name $name in ", $*CURLEX.id) if $*DEBUG +& DEBUG::symtab;
@@ -194,7 +198,6 @@ method add_my_name ($n, $d?, $p?) {
$name = my $shortname = shift @components;
return self unless defined $name and $name ne '';
return self if $name eq '$' or $name eq '@' or $name eq '%';
- return self.add_categorical(substr($name,1)) if $name ~~ /^\&\w+\:/;
if $shortname ~~ /\:/ {
$shortname ~~ s/\:.*//;
}
@@ -447,6 +450,7 @@ method add_placeholder($name) {
return self.sorry("$varname has already been used as a non-placeholder in the surrounding$decl block,\n so you will confuse the reader if you suddenly declare $name here");
}
self.trymop({
+ self.check_categorical($varname);
$*CURLEX<!sub>.add_my_name($varname, :noinit, |mnode(self),
list => substr($varname,0,1) eq '@',
hash => substr($varname,0,1) eq '%');

0 comments on commit 55018cb

Please sign in to comment.