Skip to content

Commit 3dffa81

Browse files
committed
[js] Use the :ctx named parameter for ops that take a ctx.
1 parent dd4f0de commit 3dffa81

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

src/vm/js/QAST/Compiler.nqp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ class QAST::OperationsJS {
397397
add_simple_op('setcontspec', $T_OBJ, [$T_OBJ, $T_STR, $T_OBJ], :sideffects);
398398
add_simple_op('assign', $T_OBJ, [$T_OBJ, $T_OBJ], sub ($cont, $value) {"$cont.\$\$assign({$*CTX},$value)"}, :sideffects);
399399
add_simple_op('assignunchecked', $T_OBJ, [$T_OBJ, $T_OBJ], sub ($cont, $value) {"$cont.\$\$assignunchecked({$*CTX},$value)"}, :sideffects);
400-
add_simple_op('decont', $T_OBJ, [$T_OBJ], sub ($cont) {"nqp.op.decont({$*CTX}, $cont)"});
400+
add_simple_op('decont', $T_OBJ, [$T_OBJ], :ctx);
401401
add_simple_op('iscont', $T_INT, [$T_OBJ]);
402402

403403
add_infix_op('add_n', $T_NUM, '+', $T_NUM, $T_NUM);
@@ -580,8 +580,7 @@ class QAST::OperationsJS {
580580
add_simple_op('open', $T_OBJ, [$T_STR, $T_STR], :sideffects);
581581

582582
add_simple_op('tellfh', $T_INT, [$T_OBJ], :sideffects);
583-
add_simple_op('seekfh', $T_INT, [$T_OBJ, $T_INT, $T_INT],
584-
sub ($fh, $offset, $whence) { "nqp.op.seekfh($fh, $offset, $whence, $*CTX)" }, :sideffects);
583+
add_simple_op('seekfh', $T_INT, [$T_OBJ, $T_INT, $T_INT], :ctx, :sideffects);
585584
add_simple_op('eoffh', $T_INT, [$T_OBJ], :sideffects);
586585
add_simple_op('readlinefh', $T_STR, [$T_OBJ], :sideffects);
587586
add_simple_op('readlinechompfh', $T_STR, [$T_OBJ], :sideffects);
@@ -775,9 +774,7 @@ class QAST::OperationsJS {
775774

776775
# Ops for NFA
777776

778-
add_simple_op('nfafromstatelist', $T_OBJ, [$T_OBJ, $T_OBJ], sub ($states, $type) {
779-
"nqp.op.nfafromstatelist($states, $type, $*CTX)";
780-
}, :sideffects);
777+
add_simple_op('nfafromstatelist', $T_OBJ, [$T_OBJ, $T_OBJ], :ctx, :sideffects);
781778
add_simple_op('nfarunproto', $T_OBJ, [$T_OBJ, $T_STR, $T_INT], :sideffects);
782779
add_simple_op('nfarunalt', $T_OBJ, [$T_OBJ, $T_STR, $T_INT, $T_OBJ, $T_OBJ, $T_OBJ]);
783780

@@ -903,8 +900,7 @@ class QAST::OperationsJS {
903900

904901
add_simple_op('ctxouter', $T_OBJ, [$T_OBJ]);
905902

906-
add_simple_op('loadbytecode', $T_STR, [$T_STR],
907-
sub ($path) { "nqp.op.loadbytecode($*CTX, $path)" }, :sideffects);
903+
add_simple_op('loadbytecode', $T_STR, [$T_STR], :ctx, :sideffects);
908904

909905
add_simple_op('elems', $T_INT, [$T_OBJ]);
910906

src/vm/js/nqp-runtime/io.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ op.readallfh = function(fh) {
221221
return iconv.decode(all, fh.encoding);
222222
};
223223

224-
op.seekfh = function(fh, offset, whence, ctx) {
224+
op.seekfh = function(ctx, fh, offset, whence) {
225225
if (whence == 0 && offset < 0) {
226226
ctx.die("Can't seek to position: " + offset);
227227
}

src/vm/js/nqp-runtime/nfa.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var EDGE_FATE = 0,
2222
EDGE_CODEPOINT_I_LL = 15;
2323

2424
// TODO think about type conversions of the stuff inside the array
25-
op.nfafromstatelist = function(states, type, ctx) {
25+
op.nfafromstatelist = function(ctx, states, type) {
2626

2727
var nfa = type._STable.REPR.allocate(type._STable);
2828
nfa.fates = states[0];

0 commit comments

Comments
 (0)