public override DelegateNode VisitDelegateNode(DelegateNode delegateNode) { return this.VisitTypeNode(delegateNode) as DelegateNode; }
public override string GetDelegateSignature(DelegateNode del){ if (del == null) return ""; string delName = del.Name.ToString(); if (del.DeclaringType != null) delName = this.GetTypeName(del.DeclaringType)+"."+delName; return this.GetTypeName(del.ReturnType)+" "+this.GetSignatureString(delName, del.Parameters, "(", ")", ", "); }
public virtual DelegateNode VisitDelegateNode(DelegateNode delegateNode) { if (delegateNode == null) return null; delegateNode = (DelegateNode)this.VisitTypeNode(delegateNode); if (delegateNode == null) return null; delegateNode.Parameters = this.VisitParameterList(delegateNode.Parameters); delegateNode.ReturnType = this.VisitTypeReference(delegateNode.ReturnType); return delegateNode; }
public static void Initialize(bool doNotLockFile, bool getDebugInfo) { if (SystemTypes.Initialized) { SystemTypes.Clear(); CoreSystemTypes.Initialize(doNotLockFile, getDebugInfo); } else if (!CoreSystemTypes.Initialized) { CoreSystemTypes.Initialize(doNotLockFile, getDebugInfo); } if (TargetPlatform.TargetVersion == null) { TargetPlatform.TargetVersion = SystemAssembly.Version; if (TargetPlatform.TargetVersion == null) TargetPlatform.TargetVersion = typeof(object).Module.Assembly.GetName().Version; } //TODO: throw an exception when the result is null AttributeUsageAttribute = (Class)GetTypeNodeFor("System", "AttributeUsageAttribute", ElementType.Class); ConditionalAttribute = (Class)GetTypeNodeFor("System.Diagnostics", "ConditionalAttribute", ElementType.Class); DefaultMemberAttribute = (Class)GetTypeNodeFor("System.Reflection", "DefaultMemberAttribute", ElementType.Class); InternalsVisibleToAttribute = (Class)GetTypeNodeFor("System.Runtime.CompilerServices", "InternalsVisibleToAttribute", ElementType.Class); ObsoleteAttribute = (Class)GetTypeNodeFor("System", "ObsoleteAttribute", ElementType.Class); GenericICollection = (Interface)GetGenericRuntimeTypeNodeFor("System.Collections.Generic", "ICollection", 1, ElementType.Class); GenericIEnumerable = (Interface)GetGenericRuntimeTypeNodeFor("System.Collections.Generic", "IEnumerable", 1, ElementType.Class); GenericIList = (Interface)GetGenericRuntimeTypeNodeFor("System.Collections.Generic", "IList", 1, ElementType.Class); ICloneable = (Interface)GetTypeNodeFor("System", "ICloneable", ElementType.Class); ICollection = (Interface)GetTypeNodeFor("System.Collections", "ICollection", ElementType.Class); IEnumerable = (Interface)GetTypeNodeFor("System.Collections", "IEnumerable", ElementType.Class); IList = (Interface)GetTypeNodeFor("System.Collections", "IList", ElementType.Class); AllowPartiallyTrustedCallersAttribute = (Class)GetTypeNodeFor("System.Security", "AllowPartiallyTrustedCallersAttribute", ElementType.Class); AssemblyCompanyAttribute = (Class)GetTypeNodeFor("System.Reflection", "AssemblyCompanyAttribute", ElementType.Class); AssemblyConfigurationAttribute = (Class)GetTypeNodeFor("System.Reflection", "AssemblyConfigurationAttribute", ElementType.Class); AssemblyCopyrightAttribute = (Class)GetTypeNodeFor("System.Reflection", "AssemblyCopyrightAttribute", ElementType.Class); AssemblyCultureAttribute = (Class)GetTypeNodeFor("System.Reflection", "AssemblyCultureAttribute", ElementType.Class); AssemblyDelaySignAttribute = (Class)GetTypeNodeFor("System.Reflection", "AssemblyDelaySignAttribute", ElementType.Class); AssemblyDescriptionAttribute = (Class)GetTypeNodeFor("System.Reflection", "AssemblyDescriptionAttribute", ElementType.Class); AssemblyFileVersionAttribute = (Class)GetTypeNodeFor("System.Reflection", "AssemblyFileVersionAttribute", ElementType.Class); AssemblyFlagsAttribute = (Class)GetTypeNodeFor("System.Reflection", "AssemblyFlagsAttribute", ElementType.Class); AssemblyInformationalVersionAttribute = (Class)GetTypeNodeFor("System.Reflection", "AssemblyInformationalVersionAttribute", ElementType.Class); AssemblyKeyFileAttribute = (Class)GetTypeNodeFor("System.Reflection", "AssemblyKeyFileAttribute", ElementType.Class); AssemblyKeyNameAttribute = (Class)GetTypeNodeFor("System.Reflection", "AssemblyKeyNameAttribute", ElementType.Class); AssemblyProductAttribute = (Class)GetTypeNodeFor("System.Reflection", "AssemblyProductAttribute", ElementType.Class); AssemblyTitleAttribute = (Class)GetTypeNodeFor("System.Reflection", "AssemblyTitleAttribute", ElementType.Class); AssemblyTrademarkAttribute = (Class)GetTypeNodeFor("System.Reflection", "AssemblyTrademarkAttribute", ElementType.Class); AssemblyVersionAttribute = (Class)GetTypeNodeFor("System.Reflection", "AssemblyVersionAttribute", ElementType.Class); ClassInterfaceAttribute = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "ClassInterfaceAttribute", ElementType.Class); CLSCompliantAttribute = (Class)GetTypeNodeFor("System", "CLSCompliantAttribute", ElementType.Class); ComImportAttribute = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "ComImportAttribute", ElementType.Class); ComRegisterFunctionAttribute = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "ComRegisterFunctionAttribute", ElementType.Class); ComSourceInterfacesAttribute = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "ComSourceInterfacesAttribute", ElementType.Class); ComUnregisterFunctionAttribute = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "ComUnregisterFunctionAttribute", ElementType.Class); ComVisibleAttribute = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "ComVisibleAttribute", ElementType.Class); DebuggableAttribute = (Class)GetTypeNodeFor("System.Diagnostics", "DebuggableAttribute", ElementType.Class); DebuggerHiddenAttribute = (Class)GetTypeNodeFor("System.Diagnostics", "DebuggerHiddenAttribute", ElementType.Class); DebuggerStepThroughAttribute = (Class)GetTypeNodeFor("System.Diagnostics", "DebuggerStepThroughAttribute", ElementType.Class); DebuggingModes = DebuggableAttribute == null ? null : DebuggableAttribute.GetNestedType(Identifier.For("DebuggingModes")) as EnumNode; DllImportAttribute = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "DllImportAttribute", ElementType.Class); FieldOffsetAttribute = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "FieldOffsetAttribute", ElementType.Class); FlagsAttribute = (Class)GetTypeNodeFor("System", "FlagsAttribute", ElementType.Class); Guid = (Struct)GetTypeNodeFor("System", "Guid", ElementType.ValueType); GuidAttribute = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "GuidAttribute", ElementType.Class); ImportedFromTypeLibAttribute = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "ImportedFromTypeLibAttribute", ElementType.Class); InAttribute = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "InAttribute", ElementType.Class); IndexerNameAttribute = (Class)GetTypeNodeFor("System.Runtime.CompilerServices", "IndexerNameAttribute", ElementType.Class); InterfaceTypeAttribute = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "InterfaceTypeAttribute", ElementType.Class); MethodImplAttribute = (Class)GetTypeNodeFor("System.Runtime.CompilerServices", "MethodImplAttribute", ElementType.Class); NonSerializedAttribute = (Class)GetTypeNodeFor("System", "NonSerializedAttribute", ElementType.Class); OptionalAttribute = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "OptionalAttribute", ElementType.Class); OutAttribute = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "OutAttribute", ElementType.Class); ParamArrayAttribute = (Class)GetTypeNodeFor("System", "ParamArrayAttribute", ElementType.Class); RuntimeCompatibilityAttribute = (Class)GetTypeNodeFor("System.Runtime.CompilerServices", "RuntimeCompatibilityAttribute", ElementType.Class); SatelliteContractVersionAttribute = (Class)GetTypeNodeFor("System.Resources", "SatelliteContractVersionAttribute", ElementType.Class); SerializableAttribute = (Class)GetTypeNodeFor("System", "SerializableAttribute", ElementType.Class); SecurityAttribute = (Class)GetTypeNodeFor("System.Security.Permissions", "SecurityAttribute", ElementType.Class); SecurityCriticalAttribute = (Class)GetTypeNodeFor("System.Security", "SecurityCriticalAttribute", ElementType.Class); SecurityTransparentAttribute = (Class)GetTypeNodeFor("System.Security", "SecurityTransparentAttribute", ElementType.Class); SecurityTreatAsSafeAttribute = (Class)GetTypeNodeFor("System.Security", "SecurityTreatAsSafeAttribute", ElementType.Class); STAThreadAttribute = (Class)GetTypeNodeFor("System", "STAThreadAttribute", ElementType.Class); StructLayoutAttribute = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "StructLayoutAttribute", ElementType.Class); SuppressMessageAttribute = (Class)GetTypeNodeFor("System.Diagnostics.CodeAnalysis", "SuppressMessageAttribute", ElementType.Class); SuppressUnmanagedCodeSecurityAttribute = (Class)GetTypeNodeFor("System.Security", "SuppressUnmanagedCodeSecurityAttribute", ElementType.Class); SecurityAction = GetTypeNodeFor("System.Security.Permissions", "SecurityAction", ElementType.ValueType) as EnumNode; DBNull = (Class)GetTypeNodeFor("System", "DBNull", ElementType.Class); DateTime = (Struct)GetTypeNodeFor("System", "DateTime", ElementType.ValueType); TimeSpan = (Struct)GetTypeNodeFor("System", "TimeSpan", ElementType.ValueType); Activator = (Class)GetTypeNodeFor("System", "Activator", ElementType.Class); AppDomain = (Class)GetTypeNodeFor("System", "AppDomain", ElementType.Class); ApplicationException = (Class)GetTypeNodeFor("System", "ApplicationException", ElementType.Class); ArgumentException = (Class)GetTypeNodeFor("System", "ArgumentException", ElementType.Class); ArgumentNullException = (Class)GetTypeNodeFor("System", "ArgumentNullException", ElementType.Class); ArgumentOutOfRangeException = (Class)GetTypeNodeFor("System", "ArgumentOutOfRangeException", ElementType.Class); ArrayList = (Class)GetTypeNodeFor("System.Collections", "ArrayList", ElementType.Class); AsyncCallback = (DelegateNode)GetTypeNodeFor("System", "AsyncCallback", ElementType.Class); Assembly = (Class)GetTypeNodeFor("System.Reflection", "Assembly", ElementType.Class); CodeAccessPermission = (Class)GetTypeNodeFor("System.Security", "CodeAccessPermission", ElementType.Class); CollectionBase = (Class)GetTypeNodeFor("System.Collections", "CollectionBase", ElementType.Class); CultureInfo = (Class)GetTypeNodeFor("System.Globalization", "CultureInfo", ElementType.Class); DictionaryBase = (Class)GetTypeNodeFor("System.Collections", "DictionaryBase", ElementType.Class); // EFW - In the .NET Micro Framework this is a class not a structure. Few if any of these are // actually used, this one included. I'm loathe to remove them as they may be used to ensure // assemblies are loaded. Using the as operator rather than a direct cast prevent it from failing. DictionaryEntry = GetTypeNodeFor("System.Collections", "DictionaryEntry", ElementType.ValueType) as Struct; DuplicateWaitObjectException = (Class)GetTypeNodeFor("System", "DuplicateWaitObjectException", ElementType.Class); Environment = (Class)GetTypeNodeFor("System", "Environment", ElementType.Class); EventArgs = (Class)GetTypeNodeFor("System", "EventArgs", ElementType.Class); ExecutionEngineException = (Class)GetTypeNodeFor("System", "ExecutionEngineException", ElementType.Class); GenericArraySegment = (Struct)GetGenericRuntimeTypeNodeFor("System", "ArraySegment", 1, ElementType.ValueType); GenericDictionary = (Class)GetGenericRuntimeTypeNodeFor("System.Collections.Generic", "Dictionary", 2, ElementType.Class); GenericIComparable = (Interface)GetGenericRuntimeTypeNodeFor("System.Collections.Generic", "IComparable", 1, ElementType.Class); GenericIComparer = (Interface)GetGenericRuntimeTypeNodeFor("System.Collections.Generic", "IComparer", 1, ElementType.Class); GenericIDictionary = (Interface)GetGenericRuntimeTypeNodeFor("System.Collections.Generic", "IDictionary", 2, ElementType.Class); GenericIEnumerator = (Interface)GetGenericRuntimeTypeNodeFor("System.Collections.Generic", "IEnumerator", 1, ElementType.Class); GenericKeyValuePair = (Struct)GetGenericRuntimeTypeNodeFor("System.Collections.Generic", "KeyValuePair", 2, ElementType.ValueType); GenericList = (Class)GetGenericRuntimeTypeNodeFor("System.Collections.Generic", "List", 1, ElementType.Class); GenericNullable = (Struct)GetGenericRuntimeTypeNodeFor("System", "Nullable", 1, ElementType.ValueType); GenericQueue = (Class)GetGenericRuntimeTypeNodeFor("System.Collections.Generic", "Queue", 1, ElementType.Class); GenericSortedDictionary = (Class)GetGenericRuntimeTypeNodeFor("System.Collections.Generic", "SortedDictionary", 2, ElementType.Class); GenericStack = (Class)GetGenericRuntimeTypeNodeFor("System.Collections.Generic", "Stack", 1, ElementType.Class); GC = (Class)GetTypeNodeFor("System", "GC", ElementType.Class); __HandleProtector = (Class)GetTypeNodeFor("System.Threading", "__HandleProtector", ElementType.Class); HandleRef = (Struct)GetTypeNodeFor("System.Runtime.InteropServices", "HandleRef", ElementType.ValueType); Hashtable = (Class)GetTypeNodeFor("System.Collections", "Hashtable", ElementType.Class); IASyncResult = (Interface)GetTypeNodeFor("System", "IAsyncResult", ElementType.Class); IComparable = (Interface)GetTypeNodeFor("System", "IComparable", ElementType.Class); IComparer = (Interface)GetTypeNodeFor("System.Collections", "IComparer", ElementType.Class); IDictionary = (Interface)GetTypeNodeFor("System.Collections", "IDictionary", ElementType.Class); IDisposable = (Interface)GetTypeNodeFor("System", "IDisposable", ElementType.Class); IEnumerator = (Interface)GetTypeNodeFor("System.Collections", "IEnumerator", ElementType.Class); IFormatProvider = (Interface)GetTypeNodeFor("System", "IFormatProvider", ElementType.Class); IHashCodeProvider = (Interface)GetTypeNodeFor("System.Collections", "IHashCodeProvider", ElementType.Class); IMembershipCondition = (Interface)GetTypeNodeFor("System.Security.Policy", "IMembershipCondition", ElementType.Class); IndexOutOfRangeException = (Class)GetTypeNodeFor("System", "IndexOutOfRangeException", ElementType.Class); InvalidCastException = (Class)GetTypeNodeFor("System", "InvalidCastException", ElementType.Class); InvalidOperationException = (Class)GetTypeNodeFor("System", "InvalidOperationException", ElementType.Class); IPermission = (Interface)GetTypeNodeFor("System.Security", "IPermission", ElementType.Class); ISerializable = (Interface)GetTypeNodeFor("System.Runtime.Serialization", "ISerializable", ElementType.Class); IStackWalk = (Interface)GetTypeNodeFor("System.Security", "IStackWalk", ElementType.Class); Marshal = (Class)GetTypeNodeFor("System.Runtime.InteropServices", "Marshal", ElementType.Class); MarshalByRefObject = (Class)GetTypeNodeFor("System", "MarshalByRefObject", ElementType.Class); MemberInfo = (Class)GetTypeNodeFor("System.Reflection", "MemberInfo", ElementType.Class); Monitor = (Class)GetTypeNodeFor("System.Threading", "Monitor", ElementType.Class); NativeOverlapped = (Struct)GetTypeNodeFor("System.Threading", "NativeOverlapped", ElementType.ValueType); NotSupportedException = (Class)GetTypeNodeFor("System", "NotSupportedException", ElementType.Class); NullReferenceException = (Class)GetTypeNodeFor("System", "NullReferenceException", ElementType.Class); OutOfMemoryException = (Class)GetTypeNodeFor("System", "OutOfMemoryException", ElementType.Class); ParameterInfo = (Class)GetTypeNodeFor("System.Reflection", "ParameterInfo", ElementType.Class); Queue = (Class)GetTypeNodeFor("System.Collections", "Queue", ElementType.Class); ReadOnlyCollectionBase = (Class)GetTypeNodeFor("System.Collections", "ReadOnlyCollectionBase", ElementType.Class); ResourceManager = (Class)GetTypeNodeFor("System.Resources", "ResourceManager", ElementType.Class); ResourceSet = (Class)GetTypeNodeFor("System.Resources", "ResourceSet", ElementType.Class); SerializationInfo = (Class)GetTypeNodeFor("System.Runtime.Serialization", "SerializationInfo", ElementType.Class); Stack = (Class)GetTypeNodeFor("System.Collections", "Stack", ElementType.Class); StackOverflowException = (Class)GetTypeNodeFor("System", "StackOverflowException", ElementType.Class); Stream = (Class)GetTypeNodeFor("System.IO", "Stream", ElementType.Class); StreamingContext = (Struct)GetTypeNodeFor("System.Runtime.Serialization", "StreamingContext", ElementType.ValueType); StringBuilder = (Class)GetTypeNodeFor("System.Text", "StringBuilder", ElementType.Class); StringComparer = (Class)GetTypeNodeFor("System", "StringComparer", ElementType.Class); StringComparison = GetTypeNodeFor("System", "StringComparison", ElementType.ValueType) as EnumNode; SystemException = (Class)GetTypeNodeFor("System", "SystemException", ElementType.Class); Thread = (Class)GetTypeNodeFor("System.Threading", "Thread", ElementType.Class); WindowsImpersonationContext = (Class)GetTypeNodeFor("System.Security.Principal", "WindowsImpersonationContext", ElementType.Class); SystemTypes.Initialized = true; object dummy = TargetPlatform.AssemblyReferenceFor; //Force selection of target platform if (dummy == null) return; }
private static void ClearStatics() { AttributeUsageAttribute = null; ConditionalAttribute = null; DefaultMemberAttribute = null; InternalsVisibleToAttribute = null; ObsoleteAttribute = null; GenericICollection = null; GenericIEnumerable = null; GenericIList = null; ICloneable = null; ICollection = null; IEnumerable = null; IList = null; //Special attributes AllowPartiallyTrustedCallersAttribute = null; AssemblyCompanyAttribute = null; AssemblyConfigurationAttribute = null; AssemblyCopyrightAttribute = null; AssemblyCultureAttribute = null; AssemblyDelaySignAttribute = null; AssemblyDescriptionAttribute = null; AssemblyFileVersionAttribute = null; AssemblyFlagsAttribute = null; AssemblyInformationalVersionAttribute = null; AssemblyKeyFileAttribute = null; AssemblyKeyNameAttribute = null; AssemblyProductAttribute = null; AssemblyTitleAttribute = null; AssemblyTrademarkAttribute = null; AssemblyVersionAttribute = null; ClassInterfaceAttribute = null; CLSCompliantAttribute = null; ComImportAttribute = null; ComRegisterFunctionAttribute = null; ComSourceInterfacesAttribute = null; ComUnregisterFunctionAttribute = null; ComVisibleAttribute = null; DebuggableAttribute = null; DebuggerHiddenAttribute = null; DebuggerStepThroughAttribute = null; DebuggingModes = null; DllImportAttribute = null; FieldOffsetAttribute = null; FlagsAttribute = null; GuidAttribute = null; ImportedFromTypeLibAttribute = null; InAttribute = null; IndexerNameAttribute = null; InterfaceTypeAttribute = null; MethodImplAttribute = null; NonSerializedAttribute = null; OptionalAttribute = null; OutAttribute = null; ParamArrayAttribute = null; RuntimeCompatibilityAttribute = null; SatelliteContractVersionAttribute = null; SerializableAttribute = null; SecurityAttribute = null; SecurityCriticalAttribute = null; SecurityTransparentAttribute = null; SecurityTreatAsSafeAttribute = null; STAThreadAttribute = null; StructLayoutAttribute = null; SuppressMessageAttribute = null; SuppressUnmanagedCodeSecurityAttribute = null; SecurityAction = null; //Classes need for System.TypeCode DBNull = null; DateTime = null; TimeSpan = null; //Classes and interfaces used by the Framework Activator = null; AppDomain = null; ApplicationException = null; ArgumentException = null; ArgumentNullException = null; ArgumentOutOfRangeException = null; ArrayList = null; AsyncCallback = null; Assembly = null; CodeAccessPermission = null; CollectionBase = null; CultureInfo = null; DictionaryBase = null; DictionaryEntry = null; DuplicateWaitObjectException = null; Environment = null; EventArgs = null; ExecutionEngineException = null; GenericArraySegment = null; GenericArrayToIEnumerableAdapter = null; GenericDictionary = null; GenericIComparable = null; GenericIComparer = null; GenericIDictionary = null; GenericIEnumerator = null; GenericKeyValuePair = null; GenericList = null; GenericNullable = null; GenericQueue = null; GenericSortedDictionary = null; GenericStack = null; GC = null; Guid = null; __HandleProtector = null; HandleRef = null; Hashtable = null; IASyncResult = null; IComparable = null; IDictionary = null; IComparer = null; IDisposable = null; IEnumerator = null; IFormatProvider = null; IHashCodeProvider = null; IMembershipCondition = null; IndexOutOfRangeException = null; InvalidCastException = null; InvalidOperationException = null; IPermission = null; ISerializable = null; IStackWalk = null; Marshal = null; MarshalByRefObject = null; MemberInfo = null; NativeOverlapped = null; Monitor = null; NotSupportedException = null; NullReferenceException = null; OutOfMemoryException = null; ParameterInfo = null; Queue = null; ReadOnlyCollectionBase = null; ResourceManager = null; ResourceSet = null; SerializationInfo = null; Stack = null; StackOverflowException = null; Stream = null; StreamingContext = null; StringBuilder = null; StringComparer = null; StringComparison = null; SystemException = null; Thread = null; WindowsImpersonationContext = null; }
internal static TypeNode/*!*/ GetDummyTypeNode(AssemblyNode declaringAssembly, string/*!*/ nspace, string/*!*/ name, ElementType typeCode) { TypeNode result = null; switch (typeCode) { case ElementType.Object: case ElementType.String: case ElementType.Class: if (name.Length > 1 && name[0] == 'I' && char.IsUpper(name[1])) result = new Interface(); else if (name == "MulticastDelegate" || name == "Delegate") result = new Class(); else if (name.EndsWith("Callback") || name.EndsWith("Delegate") || name == "ThreadStart" || name == "FrameGuardGetter" || name == "GuardThreadStart") result = new DelegateNode(); else result = new Class(); break; default: if (name == "CciMemberKind") result = new EnumNode(); else result = new Struct(); break; } result.Name = Identifier.For(name); result.Namespace = Identifier.For(nspace); result.DeclaringModule = declaringAssembly; return result; }
private TypeNode ParseDelegateDeclaration(Namespace ns, TypeNode parentType, AttributeList attributes, TokenList modifierTokens, SourceContextList modifierContexts, TypeFlags flags, SourceContext sctx, TokenSet followers){ DelegateNode d = new DelegateNode(); d.Attributes = attributes; if (parentType == null) d.DeclaringNamespace = ns; else{ d.DeclaringType = parentType; d.IsGeneric = parentType.IsGeneric; } d.DeclaringModule = this.module; d.SourceContext = sctx; d.Documentation = this.LastDocComment; Debug.Assert(this.currentToken == Token.Delegate); this.GetNextToken(); if (this.currentToken == Token.Void){ d.ReturnType = this.TypeExpressionFor(Token.Void); this.GetNextToken(); }else d.ReturnType = d.ReturnTypeExpression = this.ParseTypeOrFunctionTypeExpression(followers|Parser.IdentifierOrNonReservedKeyword|Token.Semicolon, false, false); if ((this.currentToken == Token.LeftParenthesis && parentType != null) || (ns == null && parentType == null && attributes == null && modifierTokens == null && flags == TypeFlags.None)) d.Name = Identifier.Empty; else{ d.Name = this.scanner.GetIdentifier(); this.SkipIdentifierOrNonReservedKeyword(); if (modifierTokens != null) d.Flags |= this.NestedTypeFlags(modifierTokens, modifierContexts, d)|TypeFlags.Sealed; else{ if ((flags & (TypeFlags.Abstract|TypeFlags.Sealed|TypeFlags.SpecialName)) != 0){ this.HandleError(d.Name.SourceContext, Error.InvalidModifier, "static"); flags &= ~(TypeFlags.Abstract|TypeFlags.Sealed|TypeFlags.SpecialName); } d.IsUnsafe = this.inUnsafeCode; d.Flags |= flags|TypeFlags.Sealed; } if (this.currentToken == Token.LessThan){ this.ParseTypeParameters(d, followers|Token.LeftParenthesis|Token.RightParenthesis|Token.Semicolon|Token.Where); if (Cci.TargetPlatform.GenericTypeNamesMangleChar != 0) { int numPars = d.TemplateParameters == null ? 0 : d.TemplateParameters.Count; if (numPars > 0) d.Name = new Identifier(d.Name.ToString()+Cci.TargetPlatform.GenericTypeNamesMangleChar+numPars.ToString(), d.Name.SourceContext); } } if (parentType != null){ d.Namespace = Identifier.Empty; parentType.Members.Add(d); }else{ d.Namespace = ns.FullNameId; ns.Types.Add(d); this.AddTypeToModule(d); } } d.Parameters = this.ParseParameters(Token.RightParenthesis, followers|Token.Semicolon|Token.Where, true, false); while (this.currentToken == Token.Where) this.ParseTypeParameterConstraint(d, followers|Token.Semicolon|Token.Where); d.SourceContext.EndPos = this.scanner.endPos; if (d.Name != Identifier.Empty){ this.SkipSemiColon(followers|Parser.TypeMemberStart); if (!followers[this.currentToken]) this.SkipTo(followers, Error.NamespaceUnexpected); return d; }else{ this.SkipTo(followers|Parser.IdentifierOrNonReservedKeyword); return new FunctionTypeExpression(d.ReturnType, d.Parameters); } }
public override DelegateNode VisitDelegateNode(DelegateNode delegateNode) { throw new NotImplementedException("Node type not yet supported"); }
public override DelegateNode VisitDelegateNode(DelegateNode delegateNode) { if (delegateNode == null || delegateNode.SourceContext.SourceText == null) return null; this.writer.WriteStartElement("Delegate"); this.writer.WriteAttributeString("name", delegateNode.Name.Name); this.WriteSourceContext(delegateNode); this.writer.WriteEndElement(); // Delegate return delegateNode; }
public EventingVisitor(Action<DelegateNode> visitDelegateNode) { VisitedDelegateNode += visitDelegateNode; } public event Action<DelegateNode> VisitedDelegateNode; public override DelegateNode VisitDelegateNode(DelegateNode delegateNode) { if (VisitedDelegateNode != null) VisitedDelegateNode(delegateNode); return base.VisitDelegateNode(delegateNode); }