Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created April 28, 2018 15:07
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 zoffixznet/1dd32f55e3a47da77ef08e7b04bbd014 to your computer and use it in GitHub Desktop.
Save zoffixznet/1dd32f55e3a47da77ef08e7b04bbd014 to your computer and use it in GitHub Desktop.
$ ./perl6 -e 'm: use nqp; say(nqp::numify(nqp::unbox_s("42.42e0")))'
42.42
$ cd ../nqp
$ gd
diff --git a/src/vm/moar/QAST/QASTOperationsMAST.nqp b/src/vm/moar/QAST/QASTOperationsMAST.nqp
index 4c637f1..ffd1a3c 100644
--- a/src/vm/moar/QAST/QASTOperationsMAST.nqp
+++ b/src/vm/moar/QAST/QASTOperationsMAST.nqp
@@ -598,6 +598,9 @@ QAST::MASTOperations.add_core_op('list_b', -> $qastcomp, $op {
}
$arr
});
+QAST::MASTOperations.add_core_op('numify', -> $qastcomp, $op {
+ $qastcomp.as_mast($op[0], :want($MVM_reg_num64))
+});
QAST::MASTOperations.add_core_op('qlist', -> $qastcomp, $op {
$qastcomp.as_mast(QAST::Op.new( :op('list'), |@($op) ))
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment