public void MarkWrite(IBoundWritable writable, BoundValueType type) { var boundType = ResolveType(writable); if (boundType != null) _marker.MarkWrite(boundType, type); }
private void MarkWrite(IBoundWritable variable) { if (!_branch.IsKilled) { var hasBoundType = variable as BoundVariable; if (hasBoundType != null) _branch.MarkWrite(hasBoundType); } }
private void EmitSetVariable(IBoundWritable variable, BoundExpression value) { switch (variable.Kind) { case BoundVariableKind.Global: _scope.GlobalScopeEmitter.EmitSetMember(new BoundSetMember( new BoundGetVariable(BoundMagicVariable.Global), BoundConstant.Create(((BoundGlobal)variable).Name), value, SourceLocation.Missing )); break; case BoundVariableKind.Local: case BoundVariableKind.Temporary: case BoundVariableKind.ClosureField: _scope.GetEmitter(variable).EmitSetValue(value); break; case BoundVariableKind.Argument: var argument = (BoundArgument)variable; // Check whether the argument is mapped to a local or closure // field. var scope = argument.Closure == null ? _scope : _scope.FindScope(argument.Closure); var mappedArgument = scope.GetMappedArgument(argument); if (mappedArgument != null) { EmitSetVariable(mappedArgument, value); return; } BoundGetVariable getVariable; if (scope.ArgumentsClosureField != null) getVariable = new BoundGetVariable(scope.ArgumentsClosureField); else getVariable = new BoundGetVariable(BoundMagicVariable.Arguments); EmitSetMember(new BoundSetMember( getVariable, BoundConstant.Create((double)argument.Index), value, SourceLocation.Missing )); return; default: throw new InvalidOperationException(); } }