public BoundMappedArgument(BoundArgument argument, BoundVariable mapped) { if (argument == null) throw new ArgumentNullException("argument"); if (mapped == null) throw new ArgumentNullException("mapped"); Argument = argument; Mapped = mapped; }
public void MarkWrite(BoundVariable variable) { if (_assigned == null) _assigned = new List<BoundVariable>(); _assigned.Add(variable); }
public void MarkRead(BoundVariable variable) { // Determine whether the variable we're reading from has been // definitely assigned. We need to look at our own list and // all base branches to figure out whether the variable has // actually been assigned to. var branch = this; while (branch != null) { // If we have an assignment, we're fine. if (branch._assigned != null && branch._assigned.Contains(variable)) return; // Look at the base branch. branch = branch._baseBranch; } // If this is a closed over variable, we may need to go to the // parent branch and handle the read there. if ( variable.Type.Kind == BoundTypeKind.ClosureField && !_manager._typeManager._types.Contains(variable.Type) ) { Debug.Assert(_manager._parentBranch != null); _manager._parentBranch.MarkRead(variable); } else { // If we didn't find an assignment, we have an unassigned // variable. We do two things. First we add it to the list we're // keeping of these variables, and we're marking it as written // to. The reason for this is that we're actually reading an // implicitly assigned 'undefined', so we can create an optimization // here to stop further marking of the variable as being // an unassigned write. _manager._unassignedWrites.Add(variable.Type); MarkWrite(variable); } }