Skip to content

Instantly share code, notes, and snippets.

@masak

masak/text.diff Secret

Last active December 19, 2015 10:29
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 masak/5a34e6893a80a5420c2d to your computer and use it in GitHub Desktop.
Save masak/5a34e6893a80a5420c2d to your computer and use it in GitHub Desktop.
Compiler.nqp diff
diff --git a/src/vm/jvm/QAST/Compiler.nqp b/src/vm/jvm/QAST/Compiler.nqp
index a98265c..9f713ba 100644
--- a/src/vm/jvm/QAST/Compiler.nqp
+++ b/src/vm/jvm/QAST/Compiler.nqp
@@ -1997,7 +1997,16 @@ QAST::OperationsJAST.map_classlib_core_op('join', $TYPE_OPS, 'join', [$RT_STR, $
QAST::OperationsJAST.map_classlib_core_op('split', $TYPE_OPS, 'split', [$RT_STR, $RT_STR], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('findcclass', $TYPE_OPS, 'findcclass', [$RT_INT, $RT_STR, $RT_INT, $RT_INT], $RT_INT);
QAST::OperationsJAST.map_classlib_core_op('findnotcclass', $TYPE_OPS, 'findnotcclass', [$RT_INT, $RT_STR, $RT_INT, $RT_INT], $RT_INT);
-QAST::OperationsJAST.map_classlib_core_op('sprintf', $TYPE_OPS, 'sprintf', [$RT_STR, $RT_OBJ], $RT_STR, :tc);
+QAST::OperationsJAST.add_core_op('sprintf', -> $qastcomp, $op {
+ my @operands := $op.list;
+ QAST::Op.new(
+ :op('call'),
+ QAST::Op.new(
+ :op('getcurhllsym'),
+ QAST::SVal.new( :value('nqp') ),
+ QAST::SVal.new( :value('sprintf') )
+ ),
+ |@operands );
+});
QAST::OperationsJAST.map_classlib_core_op('escape', $TYPE_OPS, 'escape', [$RT_STR], $RT_STR);
QAST::OperationsJAST.map_classlib_core_op('flip', $TYPE_OPS, 'flip', [$RT_STR], $RT_STR);
QAST::OperationsJAST.map_classlib_core_op('replace', $TYPE_OPS, 'replace', [$RT_STR, $RT_INT, $RT_INT, $RT_STR], $RT_STR);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment