diff --git a/polymod/hscript/_internal/Interp.hx b/polymod/hscript/_internal/Interp.hx index c46e881a..b77161fa 100644 --- a/polymod/hscript/_internal/Interp.hx +++ b/polymod/hscript/_internal/Interp.hx @@ -489,6 +489,44 @@ class Interp if (hasUsingFallback(o, f)) return tryUsingFallback(o, f, args); #if html5 + if (Std.isOfType(o, Array)) + { + switch (f) + { + case "copy": + return (cast o : Array).copy(); + case "insert": + if (args.length >= 2) + { + (cast o : Array).insert(Std.int(args[0]), args[1]); + return null; + } + case "resize": + if (args.length >= 1) + { + (cast o : Array).resize(Std.int(args[0])); + return null; + } + case "iterator": + return (cast o : Array).iterator(); + case "keyValueIterator": + return (cast o : Array).keyValueIterator(); + default: + } + } + + if (o == Math) + { + switch (f) + { + case "isNaN": + return args.length == 0 ? true : Math.isNaN(cast args[0]); + case "isFinite": + return args.length > 0 && Math.isFinite(cast args[0]); + default: + } + } + // Workaround for an HTML5-specific issue. // https://github.com/HaxeFoundation/haxe/issues/11298 if (f == "contains") @@ -3728,6 +3766,19 @@ class Interp } } + #if html5 + if (o == Math) + { + switch (f) + { + case "NaN": return Math.NaN; + case "POSITIVE_INFINITY": return Math.POSITIVE_INFINITY; + case "NEGATIVE_INFINITY": return Math.NEGATIVE_INFINITY; + default: + } + } + #end + // Otherwise, we assume the field is fine to use. if (Std.isOfType(o, PolymodStaticAbstractReference)) {