AsyncEmbeddedScript cached run handle fuzzyMaps

This commit is contained in:
2023-07-21 11:39:35 -06:00
parent 188b707b25
commit 2434d70eec
2 changed files with 20 additions and 0 deletions

View File

@@ -63,6 +63,18 @@ class ObjectInterp<T> extends Interp {
var e = e.e;
#end
switch( e ) {
// Handle fuzzyMaps correctly:
case EArray(e, index):
var arr:Dynamic = expr(e);
var index:Dynamic = expr(index);
if (isMap(arr)) {
if (kiss.FuzzyMapTools.isFuzzy(arr))
return getMapValue(arr, kiss.FuzzyMapTools.bestMatch(arr, index));
return getMapValue(arr, index);
}
else {
return arr[index];
}
case ECall(e,params):
switch( hscript.Tools.expr(e) ) {
case EIdent(name) if (fields.exists(name)):

View File

@@ -3,4 +3,12 @@
{(Assert.isTrue (FuzzyMapTools.isFuzzy fuzzyMap))(cc)}
{(Assert.isFalse (FuzzyMapTools.isFuzzy nonFuzzyMap))(cc)}
{
(dictSet fuzzyMap "lowercase" true)
(dictSet nonFuzzyMap "lowercase" true)
(Assert.isTrue (dictGet fuzzyMap "LOWERCASE"))
(Assert.isFalse ?(dictGet nonFuzzyMap "LOWERCASE"))
(cc)
}
{(set wholeScriptDone true) (cc)}