fix(muscript): don't evaluate name twice in object path of Get

This commit is contained in:
Johannes Frohnmeyer 2024-04-07 15:16:32 +02:00
parent cfc6402788
commit 21a7cfcc39
Signed by: Johannes
GPG Key ID: E76429612C2929F4
1 changed files with 1 additions and 1 deletions

View File

@ -37,7 +37,7 @@ public class Get extends DynamicExpr {
DObject o = left.asObject();
var n = name.asStringExpr().get(dataRoot);
if (!o.has(n)) throw new LocationalException(location, "Object does not contain \"" + n + "\"");
return o.get(name.asStringExpr().get(dataRoot));
return o.get(n);
} else if (left.isList()) {
DList l = left.asList();
int idx = name.asNumberExpr().get(dataRoot).intValue();