diff --git a/hscript/Interp.hx b/hscript/Interp.hx index b1b6cb34..894ee412 100644 --- a/hscript/Interp.hx +++ b/hscript/Interp.hx @@ -657,6 +657,8 @@ class Interp { isAllObject = isAllObject && Reflect.isObject(key); isAllEnum = isAllEnum && Reflect.isEnumValue(key); } + + #if (haxe_ver >= 4.1) if( isAllInt ) { var m = new Map(); for( i => key in keys ) @@ -681,6 +683,20 @@ class Interp { m.set(key, values[i]); return m; } + #else + var m:Dynamic = { + if ( isAllInt ) new haxe.ds.IntMap(); + else if ( isAllString ) new haxe.ds.StringMap(); + else if ( isAllEnum ) new haxe.ds.EnumValueMap(); + else if ( isAllObject ) new haxe.ds.ObjectMap(); + else null; + } + if( m != null ) { + for ( n in 0...keys.length ) + setMapValue(m, keys[n], values[n]); + return m; + } + #end error(ECustom("Invalid map keys "+keys)); return null; }