Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created July 6, 2011 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tadzik/1067948 to your computer and use it in GitHub Desktop.
Save tadzik/1067948 to your computer and use it in GitHub Desktop.
Double bacon strikes again
745 elsif $primitive eq 'type_new' {
746 $constant := $type_obj.new(|@value, |%named);
747 say("constant: ", $constant);
748 $des := PAST::Op.new(
749 :pasttype('callmethod'), :name('new'),
750 $type_obj_lookup
751 );
752 say("constant1.2: ", $constant);
Called with:
247 my $cheatpast := $*ST.add_constant('Str', 'str', 'bacon');
248 say("creating an array");
249 my $content := $*ST.add_constant(
250 'Array', 'type_new', $cheatpast<compile_time_value>
251 );
252 say("produced: ", $content<compile_time_value>);
Output:
creating an array
cache_key: Array,type_new,bacon
constant: bacon
constant1.2: bacon bacon
Somehow, line 748 of the first snippet duplicates the array element.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment