Skip to content

Commit

Permalink
[js] settypecheckmode with nqp::const::TYPE_CHECK_NEEDS_ACCEPTS.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Nov 16, 2016
1 parent 798eeb3 commit 6dadbe3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/vm/js/nqp-runtime/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ op.istype = function(ctx, obj, type) {
}
}

// TODO cases where the typeCheckCache isn't authoritative
var cache = obj._STable.typeCheckCache;
if (cache) {
for (var i = 0; i < cache.length; i++) {
Expand All @@ -262,9 +261,15 @@ op.istype = function(ctx, obj, type) {
return 0;
}

if (HOW.type_check(ctx, null, HOW, obj, type).$$toBool(ctx)) {
return 1;
}
}

return HOW.type_check(ctx, null, HOW, obj, type).$$toBool(ctx);
if (type._STable.typeCheckNeedsAccepts) {
return type._STable.HOW.accepts_type(ctx, null, type._STable.HOW, type, obj).$$toBool(ctx);
}

return 0;
};

Expand All @@ -274,7 +279,9 @@ op.settypecache = function(obj, cache) {
};

op.settypecheckmode = function(obj, mode) {
console.log('NYI settypecheckmode');
if (mode & 2) {
obj._STable.typeCheckNeedsAccepts = true;
}
return obj;
};

Expand Down

0 comments on commit 6dadbe3

Please sign in to comment.