Created
January 2, 2013 18:15
-
-
Save FROGGS/4436609 to your computer and use it in GitHub Desktop.
$_.value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stage start : 0.000 | |
get_bool() not implemented in class 'PROCESS' | |
current instr.: '' pc 4376 (src/gen/perl6-symboltable.pir:1639) (src/Perl6/World.pm:277) | |
called from Sub 'import' pc 4188 (src/gen/perl6-symboltable.pir:1565) (src/Perl6/World.pm:260) | |
called from Sub '' pc 19787 (src/gen/perl6-grammar.pir:7252) (src/Perl6/Grammar.pm:1221) | |
called from Sub '' pc 19315 (src/gen/perl6-grammar.pir:7057) (src/Perl6/Grammar.pm:1217) | |
called from Sub 'do_import' pc 19184 (src/gen/perl6-grammar.pir:7000) (src/Perl6/Grammar.pm:1194) | |
called from Sub '' pc 75983 (src/gen/perl6-grammar.pir:26121) (src/Perl6/Grammar.pm:1184) | |
called from Sub '' pc 75838 (src/gen/perl6-grammar.pir:26064) (src/Perl6/Grammar.pm:1179) | |
called from Sub 'statement_control:sym<use>' pc 74918 (src/gen/perl6-grammar.pir:25730) (src/Perl6/Grammar.pm:1134) | |
called from Sub '!protoregex' pc 11379 (src/stage2/QRegex.pir:4477) (src/stage2/QRegex.nqp:700) | |
called from Sub 'statement_control' pc 66195 (src/gen/perl6-grammar.pir:23244) (src/Perl6/Grammar.pm:1040) | |
called from Sub 'statement' pc 58083 (src/gen/perl6-grammar.pir:20325) (src/Perl6/Grammar.pm:933) | |
called from Sub 'statementlist' pc 56368 (src/gen/perl6-grammar.pir:19773) (src/Perl6/Grammar.pm:907) | |
called from Sub 'comp_unit' pc 51168 (src/gen/perl6-grammar.pir:17880) (src/Perl6/Grammar.pm:706) | |
called from Sub 'TOP' pc 20903 (src/gen/perl6-grammar.pir:7657) (src/Perl6/Grammar.pm:338) | |
called from Sub 'parse' pc 18568 (src/stage2/QRegex.pir:7247) (src/stage2/QRegex.nqp:1132) | |
called from Sub 'parse' pc 26628 (src/stage2/gen/NQPHLL.pir:10118) (src/stage2/gen/NQPHLL.pm:1462) | |
called from Sub '' pc 26210 (src/stage2/gen/NQPHLL.pir:9956) (src/stage2/gen/NQPHLL.pm:1426) | |
called from Sub 'compile' pc 26119 (src/stage2/gen/NQPHLL.pir:9916) (src/stage2/gen/NQPHLL.pm:1424) | |
called from Sub 'eval' pc 23214 (src/stage2/gen/NQPHLL.pir:8722) (src/stage2/gen/NQPHLL.pm:1199) | |
called from Sub 'evalfiles' pc 25586 (src/stage2/gen/NQPHLL.pir:9702) (src/stage2/gen/NQPHLL.pm:1408) | |
called from Sub 'command_eval' pc 24570 (src/stage2/gen/NQPHLL.pir:9301) (src/stage2/gen/NQPHLL.pm:1343) | |
called from Sub 'command_eval' pc 358 (src/gen/perl6-compiler.pir:173) (src/Perl6/Compiler.nqp:18) | |
called from Sub 'command_line' pc 23916 (src/stage2/gen/NQPHLL.pir:9054) (src/stage2/gen/NQPHLL.pm:1293) | |
called from Sub 'MAIN' pc 445 (src/gen/perl6.pir:164) (src/main.nqp src/gen/main-version.nqp:41) | |
called from Sub '' pc 97 (src/gen/perl6.pir:60) (src/main.nqp src/gen/main-version.nqp:1) | |
make: *** [CORE.setting.pbc] Fehler 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Perl6/World.pm b/src/Perl6/World.pm | |
index ef7b9e2..2a06671 100644 | |
--- a/src/Perl6/World.pm | |
+++ b/src/Perl6/World.pm | |
@@ -264,14 +264,66 @@ class Perl6::World is HLL::World { | |
my %to_install; | |
my @clash; | |
for %stash { | |
- if $target.symbol($_.key) { | |
- # XXX TODO: Merge handling. | |
- nqp::push(@clash, $_.key); | |
+ my $foreign_proto; # of the package we import | |
+ my $installed_proto; # of the current lexpad (target) | |
+ | |
+ try { | |
+ #$foreign_proto := self.find_symbol([$_.key]); | |
+ $foreign_proto := $_.value; | |
+ } | |
+ | |
+ # It is a multi, so we need to install a proto in the lexpad and add dispatchees. | |
+ # Note: NQPCursorRole does not support get_bool, therefor skipped. | |
+ if $_.key ne 'NQPCursorRole' && $foreign_proto && $foreign_proto.is_dispatcher { | |
+ $foreign_proto := $_.value; | |
+ | |
+ my @installed_dispatchees; | |
+ | |
+ # Symbol is known, we need to add dispatchees to the proto that is already th | |
+ if $target.symbol($_.key) { | |
+ # reuse the already installed proto | |
+ $installed_proto := $target.symbol($_.key)<value>; | |
+ | |
+ # remember the installed dispatchees so that we dont add duplicates | |
+ for $installed_proto.dispatchees -> $dispatchee { | |
+ @installed_dispatchees.push: $dispatchee; | |
+ } | |
+ } | |
+ # Symbol not yet known, we should install a proto here. | |
+ else { | |
+ # we will add dispatchees to this later | |
+ $installed_proto := self.derive_dispatcher( $foreign_proto ); | |
+ | |
+ # install the foreign symbol (proto?) into our lexpad | |
+ self.install_lexical_symbol($target, $_.key, $_.value, :clone(1)); | |
+ } | |
+ | |
+ if $foreign_proto.dispatchees { | |
+ for $foreign_proto.dispatchees -> $foreign_dispatchee { | |
+ my $found_new := 0; | |
+ for @installed_dispatchees -> $installed_dispatchee { | |
+ if $installed_dispatchee =:= $foreign_dispatchee { | |
+ $found_new := 1; | |
+ last; | |
+ } | |
+ } | |
+ | |
+ unless $found_new { | |
+ self.add_dispatchee_to_proto($installed_proto, $foreign_dispatche | |
+ } | |
+ } | |
+ } | |
} | |
else { | |
- $target.symbol($_.key, :scope('lexical'), :value($_.value)); | |
- $target[0].push(QAST::Var.new( :scope('lexical'), :name($_.key), :decl('var') | |
- %to_install{$_.key} := $_.value; | |
+ if $target.symbol($_.key) { | |
+ # If it is not a multi and the symbol is already there, it is a redeclara | |
+ nqp::push(@clash, $_.key); | |
+ } | |
+ else { | |
+ $target.symbol($_.key, :scope('lexical'), :value($_.value)); | |
+ $target[0].push(QAST::Var.new( :scope('lexical'), :name($_.key), :decl('v | |
+ %to_install{$_.key} := $_.value; | |
+ } | |
} | |
} | |
if +@clash { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment