Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make things more sane by having an $apply method on CodeRefs instead …
…of a Function.apply like apply.
  • Loading branch information
pmurias committed Jan 24, 2015
1 parent 378fdc9 commit c49abdf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/vm/js/QAST/Compiler.nqp
Expand Up @@ -546,7 +546,7 @@ class QAST::OperationsJS {
my $call;
if nqp::islist($compiled_args) {
$compiled_args := merge_arg_groups($compiled_args);
$call := '.apply(undefined,';
$call := '.$apply(';
} else {
$call := '.$call(';
}
Expand Down Expand Up @@ -971,7 +971,7 @@ class QAST::OperationsJS {
add_simple_op('captureposelems', $T_INT, [$T_OBJ]);
add_simple_op('captureposarg', $T_OBJ, [$T_OBJ, $T_INT]);
add_simple_op('invokewithcapture', $T_OBJ, [$T_OBJ, $T_OBJ], sub ($invokee, $capture) {
"$invokee.apply(undefined,[{$*BLOCK.ctx}].concat($capture.named, $capture.pos))"
"$invokee.\$apply([{$*BLOCK.ctx}].concat($capture.named, $capture.pos))"
}, :sideffects);


Expand Down
4 changes: 2 additions & 2 deletions src/vm/js/nqp-runtime/code-ref.js
Expand Up @@ -6,8 +6,8 @@ CodeRef.prototype.block = function(func) {
func.codeRef = this;
};

CodeRef.prototype.apply = function(thisArg, argsArray) {
return this.$call.apply(thisArg, argsArray);
CodeRef.prototype.$apply = function(argsArray) {
return this.$call.apply(this, argsArray);
};

CodeRef.prototype.takeclosure = function() {
Expand Down
4 changes: 2 additions & 2 deletions src/vm/js/nqp-runtime/sixmodel.js
Expand Up @@ -15,8 +15,8 @@ STable.prototype.setinvokespec = function(classHandle, attrName, invocationHandl
this.obj_constructor.prototype.$call = function() {
return this[attrName].$call.apply(this, arguments);
};
this.obj_constructor.prototype.apply = function() {
return this[attrName].apply.apply(this, arguments);
this.obj_constructor.prototype.$apply = function(args) {
return this[attrName].$apply(args);
};
};

Expand Down

0 comments on commit c49abdf

Please sign in to comment.