internal void IncludeCompilationUnitUsingClauses() { CompilationUnitNode compilationUnit = (CompilationUnitNode)Parent; if (compilationUnit.UsingClauses.Count != 0) { ParseNodeList mergedUsings = new ParseNodeList(); mergedUsings.Append(compilationUnit.UsingClauses); if (UsingClauses.Count != 0) { mergedUsings.Append(UsingClauses); } UsingClauses = GetParentedNodeList(mergedUsings); } }
private void BuildCodeModel() { _compilationUnitList = new ParseNodeList(); CodeModelBuilder codeModelBuilder = new CodeModelBuilder(_options, this); CodeModelValidator codeModelValidator = new CodeModelValidator(this); CodeModelProcessor validationProcessor = new CodeModelProcessor(codeModelValidator, _options); foreach (IStreamSource source in _options.Sources) { CompilationUnitNode compilationUnit = codeModelBuilder.BuildCodeModel(source); if (compilationUnit != null) { validationProcessor.Process(compilationUnit); _compilationUnitList.Append(compilationUnit); } } }
public static ParseNodeList GetAttributeList(ParseNodeList attributeBlocks) { if (attributeBlocks == null || attributeBlocks.Count == 0) { return(attributeBlocks); } ParseNodeList attributes = new ParseNodeList(); foreach (AttributeBlockNode attributeBlock in attributeBlocks.Cast <AttributeBlockNode>()) { ParseNodeList localAttributes = attributeBlock.Attributes; if (localAttributes.Count != 0) { attributes.Append(localAttributes); } } return(attributes); }
private ParseNodeList GetNamespaces(ParseNodeList members) { ParseNodeList namespaceList = new ParseNodeList(); foreach (ParseNode memberNode in members) { if (!(memberNode is NamespaceNode namespaceNode)) { // Top-level type nodes are turned into children of a namespace with // an empty name. Token nsToken = new Token(TokenType.Namespace, memberNode.Token.SourcePath, memberNode.Token.Position); namespaceNode = new NamespaceNode(nsToken, string.Empty, UsingClauses, new ParseNodeList(memberNode)); } namespaceList.Append(namespaceNode); } return(namespaceList); }
internal virtual void MergePartialType(CustomTypeNode partialTypeNode) { Debug.Assert(Name == partialTypeNode.Name); if (partialTypeNode.Attributes.Count > 0) { Attributes.Append(GetParentedNodeList(partialTypeNode.Attributes)); } if ((partialTypeNode.Modifiers & Modifiers.PartialModifiers) != 0) { Modifiers |= partialTypeNode.Modifiers & Modifiers.PartialModifiers; } if (partialTypeNode.TypeParameters.Count > 0) { TypeParameters.Append(GetParentedNodeList(partialTypeNode.TypeParameters)); } if (partialTypeNode.constraintClauses.Count > 0) { constraintClauses.Append(GetParentedNodeList(partialTypeNode.constraintClauses)); } }