Skip to content

Commit 36ec4e4

Browse files
Restore compatibility with haxe prior to 4.1
1 parent 04e7d65 commit 36ec4e4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

hscript/Interp.hx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,8 @@ class Interp {
657657
isAllObject = isAllObject && Reflect.isObject(key);
658658
isAllEnum = isAllEnum && Reflect.isEnumValue(key);
659659
}
660+
661+
#if (haxe_ver >= 4.1)
660662
if( isAllInt ) {
661663
var m = new Map<Int,Dynamic>();
662664
for( i => key in keys )
@@ -681,6 +683,20 @@ class Interp {
681683
m.set(key, values[i]);
682684
return m;
683685
}
686+
#else
687+
var m:Dynamic = {
688+
if ( isAllInt ) new haxe.ds.IntMap<Dynamic>();
689+
else if ( isAllString ) new haxe.ds.StringMap<Dynamic>();
690+
else if ( isAllEnum ) new haxe.ds.EnumValueMap<Dynamic, Dynamic>();
691+
else if ( isAllObject ) new haxe.ds.ObjectMap<Dynamic, Dynamic>();
692+
else null;
693+
}
694+
if( m != null ) {
695+
for ( n in 0...keys.length )
696+
setMapValue(m, keys[n], values[n]);
697+
return m;
698+
}
699+
#end
684700
error(ECustom("Invalid map keys "+keys));
685701
return null;
686702
}

0 commit comments

Comments
 (0)