Skip to content
Permalink
Browse files

[js] Adapt to using a p6$ prefix on methods

  • Loading branch information...
pmurias committed Dec 11, 2018
1 parent e0b943d commit a759f9d7293629c21c2aa504b9ce4a7f509e121f
Showing with 17 additions and 17 deletions.
  1. +6 −6 src/vm/js/Perl6/Ops.nqp
  2. +11 −11 src/vm/js/perl6-runtime/runtime.js
@@ -59,29 +59,29 @@ $ops.add_op('p6bindsig', :!inlinable, sub ($comp, $node, :$want) {
my $ops := nqp::getcomp('QAST').operations;
my $tmp := $*BLOCK.add_tmp;
$ops.new_chunk($ops.VOID, "", [
"$tmp = /*await*/ nqp.p6binder.bind_sig($*CTX, null, nqp.p6binder, nqp.op.savecapture(Array.prototype.slice.call(arguments)));\n",
"$tmp = /*await*/ nqp.p6binder.p6\$bind_sig($*CTX, null, nqp.p6binder, nqp.op.savecapture(Array.prototype.slice.call(arguments)));\n",
"if ($tmp !== nqp.Null) return $tmp;\n"
]);
});

$ops.add_simple_op('p6configposbindfailover', $ops.VOID, [$ops.OBJ, $ops.OBJ], sub ($pos, $pos_bind_failover) {
"/*await*/ nqp.p6binder.set_pos_bind_failover($*CTX, null, nqp.p6binder, $pos, $pos_bind_failover)"
"/*await*/ nqp.p6binder.p6\$set_pos_bind_failover($*CTX, null, nqp.p6binder, $pos, $pos_bind_failover)"
}, :side_effects);

$ops.add_simple_op('p6setautothreader', $ops.VOID, [$ops.OBJ], sub ($autothreader) {
"/*await*/ nqp.p6binder.set_autothreader($*CTX, null, nqp.p6binder, $autothreader)"
"/*await*/ nqp.p6binder.p6\$set_autothreader($*CTX, null, nqp.p6binder, $autothreader)"
}, :side_effects);

$ops.add_simple_op('p6trialbind', $ops.OBJ, [$ops.OBJ, $ops.OBJ, $ops.OBJ], :!inlinable, sub ($sig, $args, $sig_flags) {
"/*await*/ nqp.p6binder.trial_bind($*CTX, null, nqp.p6binder, $sig, $args, $sig_flags)"
"/*await*/ nqp.p6binder.p6\$trial_bind($*CTX, null, nqp.p6binder, $sig, $args, $sig_flags)"
});

$ops.add_simple_op('p6isbindable', $ops.OBJ, [$ops.OBJ, $ops.OBJ], :!inlinable, sub ($sig, $cap) {
"nqp.retval(HLL, /*await*/ nqp.p6binder.is_bindable($*CTX, null, nqp.p6binder, $sig, $cap))"
"nqp.retval(HLL, /*await*/ nqp.p6binder.p6\$is_bindable($*CTX, null, nqp.p6binder, $sig, $cap))"
});

$ops.add_simple_op('p6bindcaptosig', $ops.OBJ, [$ops.OBJ, $ops.OBJ], sub ($sig, $cap) {
"/*await*/ nqp.p6binder.bind_cap_to_sig($*CTX, null, nqp.p6binder, $sig, $cap)"
"/*await*/ nqp.p6binder.p6\$bind_cap_to_sig($*CTX, null, nqp.p6binder, $sig, $cap)"
}, :side_effects);

$ops.add_op('p6bindattrinvres', $ops.bindattr($ops.OBJ, :inverted_result));
@@ -40,12 +40,12 @@ module.exports.load = function(nqp, CodeRef, Capture, containerSpecs) {
if (rtype !== Null && nqp.op.objprimspec(rtype) === 0) {
let targetType;
const how = rtype.$$STable.HOW;
const archetypes = /*await*/ how.archetypes(ctx, null, how);
const isCoercive = nqp.retval_bool(ctx, /*await*/ archetypes.coercive(ctx, null, archetypes));
const archetypes = /*await*/ how.p6$archetypes(ctx, null, how);
const isCoercive = nqp.retval_bool(ctx, /*await*/ archetypes.p6$coercive(ctx, null, archetypes));

if (isCoercive) {
targetType = /*await*/ how.target_type(ctx, null, how, rtype);
rtype = /*await*/ how.constraint_type(ctx, null, how, rtype);
targetType = /*await*/ how.p6$target_type(ctx, null, how, rtype);
rtype = /*await*/ how.p6$constraint_type(ctx, null, how, rtype);
}

const decontValue = /*await*/ rv.$$decont(ctx);
@@ -59,12 +59,12 @@ module.exports.load = function(nqp, CodeRef, Capture, containerSpecs) {
}

if (targetType !== undefined && targetType !== rtype) {
const targetTypeName = /*await*/ targetType.$$STable.HOW.name(
const targetTypeName = /*await*/ targetType.$$STable.HOW.p6$name(
ctx, null, targetType.$$STable.HOW, targetType).$$getStr();
if (/*await*/ rv.$$can(ctx, targetTypeName)) {
return rv[targetTypeName](ctx, null, rv);
return rv['p6$' + targetTypeName](ctx, null, rv);
} else {
const rtypeName = /*await*/ rtype.$$STable.HOW.name(ctx, null, rtype.$$STable.HOW, rtype).$$getStr();
const rtypeName = /*await*/ rtype.$$STable.HOW.p6$name(ctx, null, rtype.$$STable.HOW, rtype).$$getStr();
throw new nqp.NQPException(
`Unable to coerce the return value from ${rtypeName} to ${targetTypeName} ;` +
`no coercion method defined`);
@@ -193,11 +193,11 @@ module.exports.load = function(nqp, CodeRef, Capture, containerSpecs) {
if (cont.$$assign) {
/*await*/ cont.$$assign(ctx, value.$$decont(ctx));
} else {
if (!cont.STORE) {
if (!cont.p6$STORE) {
// TODO throw typed exception X::Assignment::RO
ctx.die("Cannot assign to a non-container");
} else {
/*await*/ cont.STORE(ctx, null, cont, value);
/*await*/ cont.p6$STORE(ctx, null, cont, value);
}
}
return cont;
@@ -233,7 +233,7 @@ module.exports.load = function(nqp, CodeRef, Capture, containerSpecs) {
if (search.hasOwnProperty("$*DISPATCHER") && search["$*DISPATCHER"] !== Null) {
dispatcher = search["$*DISPATCHER"];
if (dispatcher.$$typeObject) {
dispatcher = /*await*/ dispatcher.vivify_for(ctx, null, dispatcher, search.codeRef().codeObj, search, new Capture(search.$$args[1], Array.prototype.slice.call(search.$$args, 2)));
dispatcher = /*await*/ dispatcher.p6$vivify_for(ctx, null, dispatcher, search.codeRef().codeObj, search, new Capture(search.$$args[1], Array.prototype.slice.call(search.$$args, 2)));
search["$*DISPATCHER"] = dispatcher;
}
return dispatcher;
@@ -266,7 +266,7 @@ module.exports.load = function(nqp, CodeRef, Capture, containerSpecs) {
op.p6sink = /*async*/ function(ctx, obj) {
if (obj.$$typeObject || obj === Null) return;
if (obj.$$can(ctx, 'sink')) {
obj.sink(ctx, null, obj);
obj.p6$sink(ctx, null, obj);
}
};

0 comments on commit a759f9d

Please sign in to comment.
You can’t perform that action at this time.