Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[js] Implement nqp::getcodecuid.
  • Loading branch information
pmurias committed Jan 13, 2016
1 parent f8146e0 commit 03c396b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/vm/js/QAST/Compiler.nqp
Expand Up @@ -695,6 +695,8 @@ class QAST::OperationsJS {
add_simple_op('rmdir', $T_VOID, [$T_STR], :sideffects);
add_simple_op('mkdir', $T_VOID, [$T_STR, $T_INT], :sideffects);

add_simple_op('chmod', $T_VOID, [$T_STR, $T_INT], :sideffects);

add_simple_op('getenvhash', $T_OBJ, [], :sideffects);
add_simple_op('cwd', $T_STR, [], :sideffects);

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

add_simple_op('getcodecuid', $T_STR, [$T_OBJ]);

add_simple_op('box_i', $T_OBJ, [$T_INT, $T_OBJ]);
add_simple_op('unbox_i', $T_INT, [$T_OBJ]);

Expand Down
1 change: 1 addition & 0 deletions src/vm/js/nqp-runtime/code-ref.js
Expand Up @@ -38,6 +38,7 @@ CodeRef.prototype.capture = function(block) {
CodeRef.prototype.closure = function(block) {
var closure = new CodeRef(this.name, undefined);
closure.codeObj = this.codeObj;
closure.cuid = this.cuid;
closure.$call = block;
closure.$call.codeRef = closure;
return closure;
Expand Down
4 changes: 4 additions & 0 deletions src/vm/js/nqp-runtime/core.js
Expand Up @@ -866,3 +866,7 @@ op.getcodelocation = function(code) {
hash.content.set('line', new NQPInt(-1));
return hash;
};

op.getcodecuid = function(codeRef) {
return codeRef.cuid;
};
4 changes: 4 additions & 0 deletions src/vm/js/nqp-runtime/io.js
Expand Up @@ -420,3 +420,7 @@ op.readlink = function(path) {
op.gethostname = function() {
return os.hostname();
};

op.chmod = function(path, mode) {
return fs.chmodSync(path, mode);
};

0 comments on commit 03c396b

Please sign in to comment.