private void assignValues(JSValue source, ArrayDefinition targetMap) { if (targetMap == null) { return; } var values = new JSValue[targetMap.Elements.Length]; for (var i = 0; i < targetMap.Elements.Length; i++) { values[i] = source[Tools.Int32ToString(i)].CloneImpl(false); } Arguments setterArgs = null; for (var i = 0; i < targetMap.Elements.Length; i++) { if (targetMap.Elements[i] is ObjectDefinition) { assignValues(values[i], targetMap.Elements[i] as ObjectDefinition); assignValues(values[i], targetMap.Elements[i] as ArrayDefinition); } else { var target = targetMap.Elements[i].EvaluateForWrite(_context); setterArgs = assign(target, values[i], setterArgs); } } }
public static bool CheckObjectDefinition(ArrayDefinition arrayDefinition, bool @throw) { if (arrayDefinition == null) { return(true); } if (arrayDefinition.Elements.All(ExpressionTree.canBeAssignee)) { return(true); } if (@throw) { ExceptionHelper.ThrowReferenceError(Messages.InvalidLefthandSideInAssignment); } return(false); }
private static void collectTargetVariables(ArrayDefinition arrayDefinition, List <Variable> result) { if (arrayDefinition == null) { return; } for (var i = 0; i < arrayDefinition.Elements.Length; i++) { if (arrayDefinition.Elements[i] is Variable) { result.Add((Variable)arrayDefinition.Elements[i]); } else { collectTargetVariables(arrayDefinition.Elements[i] as ObjectDefinition, result); collectTargetVariables(arrayDefinition.Elements[i] as ArrayDefinition, result); } } }