From 36ec4e46fc19e3d15fceacc15b2f065e8cc2ce32 Mon Sep 17 00:00:00 2001 From: Florian BOEUF Date: Wed, 30 Jul 2025 22:07:32 +0200 Subject: [PATCH] Restore compatibility with haxe prior to 4.1 --- hscript/Interp.hx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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; }