private void DumpConstructor(ConstructorSymbol ctorSymbol) { if (ctorSymbol.Parameters != null) { _writer.Write("Parameters:"); _writer.Indent++; foreach (ParameterSymbol paramSymbol in ctorSymbol.Parameters) { DumpSymbol(paramSymbol); } _writer.Indent--; } }
private MethodSymbol BuildMethod(MethodDeclarationNode methodNode, TypeSymbol typeSymbol) { MethodSymbol method = null; if (methodNode.NodeType == ParseNodeType.ConstructorDeclaration) { method = new ConstructorSymbol(typeSymbol, (methodNode.Modifiers & Modifiers.Static) != 0); } else { TypeSymbol returnType = typeSymbol.SymbolSet.ResolveType(methodNode.Type, _symbolTable, typeSymbol); Debug.Assert(returnType != null); if (returnType != null) { method = new MethodSymbol(methodNode.Name, typeSymbol, returnType); BuildMemberDetails(method, typeSymbol, methodNode, methodNode.Attributes); ICollection<string> conditions = null; foreach (AttributeNode attrNode in methodNode.Attributes) { if (attrNode.TypeName.Equals("Conditional", StringComparison.Ordinal)) { if (conditions == null) { conditions = new List<string>(); } Debug.Assert(attrNode.Arguments[0] is LiteralNode); Debug.Assert(((LiteralNode)attrNode.Arguments[0]).Value is string); conditions.Add((string)((LiteralNode)attrNode.Arguments[0]).Value); } } if (conditions != null) { method.SetConditions(conditions); } } } if (method != null) { if ((methodNode.Modifiers & Modifiers.Abstract) != 0) { method.SetImplementationState(SymbolImplementationFlags.Abstract); } else if ((methodNode.Modifiers & Modifiers.Override) != 0) { method.SetImplementationState(SymbolImplementationFlags.Override); } if ((methodNode.Parameters != null) && (methodNode.Parameters.Count != 0)) { foreach (ParameterNode parameterNode in methodNode.Parameters) { ParameterSymbol paramSymbol = BuildParameter(parameterNode, method); if (paramSymbol != null) { paramSymbol.SetParseContext(parameterNode); method.AddParameter(paramSymbol); } } } if ((method.Visibility & MemberVisibility.Static) != 0) { string scriptAlias = GetAttributeValue(methodNode.Attributes, "ScriptAlias"); if (scriptAlias != null) { method.SetAlias(scriptAlias); } } } return method; }
public override void AddMember(MemberSymbol memberSymbol) { if (_primaryPartialClass != null) { _primaryPartialClass.AddMember(memberSymbol); return; } Debug.Assert(memberSymbol != null); if (memberSymbol.Type == SymbolType.Constructor) { if ((memberSymbol.Visibility & MemberVisibility.Static) == 0) { Debug.Assert(_constructor == null); _constructor = (ConstructorSymbol)memberSymbol; } else { Debug.Assert(_staticConstructor == null); _staticConstructor = (ConstructorSymbol)memberSymbol; } } else if (memberSymbol.Type == SymbolType.Indexer) { Debug.Assert((IsApplicationType == false) || (_indexer == null)); _indexer = (IndexerSymbol)memberSymbol; } else { base.AddMember(memberSymbol); } }