public Scope () { m_scopes = new ScopeCollection (this); m_usings = new UsingCollection (this); m_constants = new ConstantCollection (this); m_variables = new VariableCollection (this); }
public ScopeCollectionInstance(ScriptEngine engine, ScopeCollection scopeCollection) : base(engine) { m_scopeCollection = scopeCollection; PopulateFunctions(); }
void CreateScopes(MethodBody body, ScopeCollection scopes, SymbolToken localVarToken) { foreach (Scope s in scopes) { int startOffset = s.Start.Offset; int endOffset = s.End == body.Instructions.Outside ? body.Instructions[body.Instructions.Count - 1].Offset + 1 : s.End.Offset; m_writer.OpenScope(startOffset); m_writer.UsingNamespace(body.Method.DeclaringType.Namespace); m_writer.OpenNamespace(body.Method.DeclaringType.Namespace); int start = body.Instructions.IndexOf(s.Start); int end = s.End == body.Instructions.Outside ? body.Instructions.Count - 1 : body.Instructions.IndexOf(s.End); ArrayList instructions = CollectSequencePoints(body, start, end); DefineSequencePoints(instructions); CreateLocalVariable(s, startOffset, endOffset, localVarToken); CreateScopes(body, s.Scopes, localVarToken); m_writer.CloseNamespace(); m_writer.CloseScope(endOffset); } }
public Scope() { m_scopes = new ScopeCollection(this); m_usings = new UsingCollection(this); m_constants = new ConstantCollection(this); m_variables = new VariableCollection(this); }
public void child_references_to_parent() { var scope = new ScopeCollection<int>(); ScopeBase<int> child = scope.GetChild(); Assert.AreSame(scope, child.Parent); }
public void child_references_to_parent() { var scope = new ScopeCollection <int>(); ScopeBase <int> child = scope.GetChild(); Assert.AreSame(scope, child.Parent); }
public void contains_item_after_added() { const string scope_key = "key"; const int scope_value = 0; var scope = new ScopeCollection<int>(); scope.Add(scope_key, scope_value); Assert.IsTrue(scope.Contains(scope_key)); }
protected ScopeCollectionInstance(ObjectInstance prototype, ScopeCollection scopeCollection) : base(prototype) { if (scopeCollection == null) { throw new ArgumentNullException("scopeCollection"); } m_scopeCollection = scopeCollection; }
public void contains_all_items_of_parent() { const string scope_key = "key"; const int scope_value = 0; var scope = new ScopeCollection<int>(); scope.Add(scope_key, scope_value); var child_scope = (ScopeCollection<int>) scope.GetChild(); Assert.AreEqual(scope_value, child_scope[scope_key]); }
public void contains_all_items_of_parent() { const string scope_key = "key"; const int scope_value = 0; var scope = new ScopeCollection <int>(); scope.Add(scope_key, scope_value); var child_scope = (ScopeCollection <int>)scope.GetChild(); Assert.AreEqual(scope_value, child_scope[scope_key]); }
public void notifies_on_new_item_added_to_same_scope() { const string scope_key = "key"; const int scope_value = 0; var scope = new ScopeCollection<int>(); bool itemAdded = false; scope.ItemAdded += (_, e) => { if (e.Key == scope_key) itemAdded = true; }; scope.Add(scope_key, scope_value); Assert.IsTrue(itemAdded); }
internal void ReadFrom(DiscoveryVersion discoveryVersion, XmlReader reader) { if (discoveryVersion == null) { throw FxTrace.Exception.ArgumentNull("discoveryVersion"); } if (reader == null) { throw FxTrace.Exception.ArgumentNull("reader"); } this.contractTypeNames = null; this.scopes = null; this.scopeMatchBy = DiscoveryDefaults.ScopeMatchBy; this.extensions = null; this.duration = TimeSpan.MaxValue; this.maxResults = int.MaxValue; reader.MoveToContent(); if (reader.IsEmptyElement) { reader.Read(); return; } int startDepth = reader.Depth; reader.ReadStartElement(); if (reader.IsStartElement(ProtocolStrings.SchemaNames.TypesElement, discoveryVersion.Namespace)) { this.contractTypeNames = new ContractTypeNameCollection(); SerializationUtility.ReadContractTypeNames(this.contractTypeNames, reader); } if (reader.IsStartElement(ProtocolStrings.SchemaNames.ScopesElement, discoveryVersion.Namespace)) { this.scopes = new ScopeCollection(); Uri scopeMatchBy = SerializationUtility.ReadScopes(this.scopes, reader); if (scopeMatchBy != null) { this.scopeMatchBy = discoveryVersion.Implementation.ToVersionIndependentScopeMatchBy(scopeMatchBy); } } while (true) { reader.MoveToContent(); if ((reader.NodeType == XmlNodeType.EndElement) && (reader.Depth == startDepth)) { break; } else if (reader.IsStartElement(ProtocolStrings.SchemaNames.MaxResultsElement, ProtocolStrings.VersionInternal.Namespace)) { this.maxResults = SerializationUtility.ReadMaxResults(reader); } else if (reader.IsStartElement(ProtocolStrings.SchemaNames.DurationElement, ProtocolStrings.VersionInternal.Namespace)) { this.duration = SerializationUtility.ReadDuration(reader); } else if (reader.IsStartElement()) { XElement xElement = XElement.ReadFrom(reader) as XElement; Extensions.Add(xElement); } else { reader.Read(); } } reader.ReadEndElement(); }
public virtual void VisitScopeCollection (ScopeCollection scopes) { }
public BlockType() { this.KeywordsList = new PatternListList(this); this.OperatorsList = new PatternListList(this); Style = new TextStyle(); KeywordsList.Parent = this; KeywordsList.IsKeyword = true; OperatorsList.Parent = this; OperatorsList.IsOperator = true; ScopePatterns = new ScopeCollection(this); }
public Method() { m_scopes = new ScopeCollection(this); m_documents = new DocumentCollection(this); m_sequencePoints = new SequencePointCollection(this); }
public void returns_correct_item_after_added() { const string scope_key = "key"; const int scope_value = 0; var scope = new ScopeCollection<int>(); scope.Add(scope_key, scope_value); Assert.AreEqual(scope_value, scope[scope_key]); }
public Method () { m_scopes = new ScopeCollection (this); m_documents = new DocumentCollection (this); m_sequencePoints = new SequencePointCollection (this); }