AsyncEmbeddedScript cached run handle fuzzyMaps
This commit is contained in:
@@ -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)):
|
||||
|
||||
@@ -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)}
|
||||
Reference in New Issue
Block a user