internal JReference Reference(string/*!*/ name) { if (_references == null) { _references = new Dictionary<string, List<JReference>>(StringComparer.Ordinal); } List<JReference> references; if (!_references.TryGetValue(name, out references)) { _references[name] = references = new List<JReference>(); } var reference = new JReference(name); references.Add(reference); return reference; }
internal bool WalkName(NameExpression node, JReference reference) { if (_collector.ReadFromExtractedCode(reference.Variable)) { if ((!_collector._inputCollector._allReads.Contains(reference) && !_collector._inputCollector._allWrites.Contains(reference))) { // the variable is assigned outside the refactored code if (node.StartIndex < _collector._target.Start) { // it's assigned before the extracted code _collector._inputVars.Add(reference.Variable); } else { Debug.Assert(node.EndIndex > _collector._target.End); // it's assigned afterwards, we don't care... } } else if (_collector._readBeforeInitialized.Contains(reference.Variable) && _collector._inputCollector._allWrites.Contains(reference) && _collector._inLoop) { // we read an un-initialized value, so it needs to be passed in. If we // write to it as well then we need to pass it back out for future calls. _collector._outputVars.Add(reference.Variable); } } return false; }