Skip to content

Commit 14b8a63

Browse files
committed
[js] Hack to make nqp::istype([], NQPArray) work.
1 parent c762f2a commit 14b8a63

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,18 @@ op.istype = function(obj, type) {
292292
}
293293

294294
// HACK
295-
if (typeof obj === 'number' || typeof obj === 'string' || obj instanceof Array || obj instanceof Hash || obj instanceof NQPInt) {
295+
if (typeof obj === 'number' || typeof obj === 'string' || obj instanceof Hash || obj instanceof NQPInt) {
296296
return 0;
297297
}
298298

299+
if (obj instanceof Array) {
300+
if (hllConfigs.nqp && type == hllConfigs.nqp.content.list) {
301+
return 1;
302+
} else {
303+
return 0;
304+
}
305+
}
306+
299307
// TODO cases where the type_check_cache isn't authoritative
300308
var cache = obj._STable.type_check_cache;
301309
for (var i = 0; i < cache.length; i++) {
@@ -401,7 +409,9 @@ op.settypehllrole = function(type, role) {
401409
return role;
402410
};
403411

412+
var hllConfigs = {};
404413
op.sethllconfig = function(language, configHash) {
414+
hllConfigs[language] = configHash;
405415
/* STUB */
406416
return configHash;
407417
};

0 commit comments

Comments
 (0)