public void Dispose() { m_Root = null; m_CurrentScope = null; m_Stack = null; m_Trace = null; }
public ITypeNameScope EndScope() { var ret = m_Stack.Pop(); m_CurrentScope = (m_Stack.Count > 0 ? m_Stack.Peek() : null); m_InRoot = (m_CurrentScope == m_Root); return(ret); }
public void AddGenericsArgument(TypeNameScope argument) { if (argument == null || argument.Parent != null || !CanAddGenericsArgument()) { throw TypeNameParserCommon.NewError(TypeNameError.GenericsArgumentsCountExceeded, m_Text, -1, TypeNameToken.Undefined); } GenericsArguments.Add(argument); argument.m_Parent = this; ScopeChanged(this, EventArgs.Empty); }
public object Clone() { var result = new TypeNameScope(Id, m_Text, m_ExpectedGenericsArgsCount); result.m_IsArray = m_IsArray; result.m_InBlock = m_InBlock; if (m_Name != null) { result.m_Name = (TypeNameBlock)m_Name.Clone(); } if (m_AssemblyName != null) { result.m_AssemblyName = (TypeNameBlock)m_AssemblyName.Clone(); } if (m_Culture != null) { result.m_Culture = (TypeNameBlock)m_Culture.Clone(); } if (m_Version != null) { result.m_Version = (TypeNameBlock)m_Version.Clone(); } if (m_PublicKeyToken != null) { result.m_PublicKeyToken = (TypeNameBlock)m_PublicKeyToken.Clone(); } if (GenericsArguments != null) { foreach (var arg in GenericsArguments) { var clone = (TypeNameScope)arg.Clone(); result.GenericsArguments.Add(clone); clone.m_Parent = result; } } result.m_AQName = m_AQName; result.m_FullName = m_FullName; result.m_ShortName = m_ShortName; result.m_NameWithAssembly = m_NameWithAssembly; return(result); }
public ParseContext(string text, bool debug = false) { m_Debug = debug; m_Text = text; m_TextLen = (text != null ? text.Length : 0); m_Root = new TypeNameScope(m_Id++, m_Text); m_Stack.Push(m_Root); m_CurrentScope = m_Root; if (m_Debug) { m_Trace.Push(new TypeNameParseTrace(m_Token, m_PrevToken, m_Pos, null)); } }
public ITypeNameScope StartScope() { var parentScope = m_Stack.Peek(); if (!parentScope.CanAddGenericsArgument()) { throw TypeNameParserCommon.NewError(TypeNameError.InvalidGenericsArgumentStart, m_Text, m_Pos, m_Token); } var scope = new TypeNameScope(m_Id++, m_Text); parentScope.AddGenericsArgument(scope); m_Stack.Push(scope); m_CurrentScope = scope; m_InRoot = false; return(scope); }