Skip to content

Instantly share code, notes, and snippets.

@timo
Created March 13, 2015 14:48
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 timo/20f6731d7f67e82f4f55 to your computer and use it in GitHub Desktop.
Save timo/20f6731d7f67e82f4f55 to your computer and use it in GitHub Desktop.
sub make_ref_type($name, $kind) {
my $class := nqp::newtype(NQPMu, 'NativeRef');
my $info := nqp::hash();
$info<nativeref> := nqp::hash();
$info<nativeref><type> := $kind;
$info<nativeref><refkind> := 'lexical';
nqp::composetype($class, $info);
return $class;
}
my $hllconfig := nqp::hash();
$hllconfig<int_lex_ref> := make_ref_type('StubIntLexRef', int);
$hllconfig<num_lex_ref> := make_ref_type('StubNumLexRef', num);
$hllconfig<str_lex_ref> := make_ref_type('StubStrLexRef', str);
nqp::sethllconfig('nqp', $hllconfig);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment