Closed etherealxx closed 11 months ago
objects apparently don't work, the properties aren't assigned and in fact the property value itself is undefined.
Found the issue. The code was assigning the temp object to a value before assigning its value.
Function "lookupOrMutObject()" in environment.ts should be replaced with
` public lookupOrMutObject(expr: MemberExpr, value?: RuntimeVal, property?: Identifier): RuntimeVal { if (expr.object.kind === 'MemberExpr') return this.lookupOrMutObject(expr.object as MemberExpr, value, expr.property as Identifier);
const varname = (expr.object as Identifier).symbol;
const env = this.resolve(varname);
let pastVal = env.variables.get(varname) as ObjectVal;
const prop = property
? property.symbol
: (expr.property as Identifier).symbol;
const currentProp = (expr.property as Identifier).symbol;
if (value) pastVal.properties.set(prop, value);
if (currentProp) pastVal = (pastVal.properties.get(currentProp) as ObjectVal);
return pastVal;
}`
To fix the issue.
Github code formatting sucks balls.
Fixed in v1.2.1
I don't know if this is a 'design choice' (like how loops doesn't have break), because this example from the readme doesn't work.
it will output
no matter if it's
bs
orbsx
. i tried current commit, previous commit, and the earliest commit. The issue seems persistent.