Skip to content

Commit 03c396b

Browse files
committed
[js] Implement nqp::getcodecuid.
1 parent f8146e0 commit 03c396b

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

src/vm/js/QAST/Compiler.nqp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ class QAST::OperationsJS {
695695
add_simple_op('rmdir', $T_VOID, [$T_STR], :sideffects);
696696
add_simple_op('mkdir', $T_VOID, [$T_STR, $T_INT], :sideffects);
697697

698+
add_simple_op('chmod', $T_VOID, [$T_STR, $T_INT], :sideffects);
699+
698700
add_simple_op('getenvhash', $T_OBJ, [], :sideffects);
699701
add_simple_op('cwd', $T_STR, [], :sideffects);
700702

@@ -1512,6 +1514,8 @@ class QAST::OperationsJS {
15121514
add_simple_op('getcodeobj', $T_OBJ, [$T_OBJ]);
15131515
add_simple_op('setcodeobj', $T_OBJ, [$T_OBJ, $T_OBJ], :sideffects);
15141516

1517+
add_simple_op('getcodecuid', $T_STR, [$T_OBJ]);
1518+
15151519
add_simple_op('box_i', $T_OBJ, [$T_INT, $T_OBJ]);
15161520
add_simple_op('unbox_i', $T_INT, [$T_OBJ]);
15171521

src/vm/js/nqp-runtime/code-ref.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ CodeRef.prototype.capture = function(block) {
3838
CodeRef.prototype.closure = function(block) {
3939
var closure = new CodeRef(this.name, undefined);
4040
closure.codeObj = this.codeObj;
41+
closure.cuid = this.cuid;
4142
closure.$call = block;
4243
closure.$call.codeRef = closure;
4344
return closure;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,3 +866,7 @@ op.getcodelocation = function(code) {
866866
hash.content.set('line', new NQPInt(-1));
867867
return hash;
868868
};
869+
870+
op.getcodecuid = function(codeRef) {
871+
return codeRef.cuid;
872+
};

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,7 @@ op.readlink = function(path) {
420420
op.gethostname = function() {
421421
return os.hostname();
422422
};
423+
424+
op.chmod = function(path, mode) {
425+
return fs.chmodSync(path, mode);
426+
};

0 commit comments

Comments
 (0)