public T4CSharpCodeStructureDeclaredElement(CodeStructureElement parentElement, IDeclaration declaration, CSharpCodeStructureProcessingState state) : base(parentElement, declaration) { IDeclaredElement declaredElement = declaration.DeclaredElement; InitiallyExpanded = true; if (declaredElement != null && state.Options.BuildInheritanceInformation) { _inheritanceInformation = InheritanceInformation.FromDeclaredElement(declaredElement); if (_inheritanceInformation != null) { var structureDeclaredElement = parentElement as T4CSharpCodeStructureDeclaredElement; if (structureDeclaredElement != null) { structureDeclaredElement.ChildrenWithInheritance = true; } } } _parentRegion = state.Regions.TryPeek(); if (declaredElement != null) { _aspects = new T4CSharpCodeStructureAspects(this, declaration); } }
private static void ProcessT4FeatureBlock( [NotNull] IT4FeatureBlock featureBlock, [NotNull] CodeStructureElement parentElement, [NotNull] ICSharpFile cSharpFile, [NotNull] ISecondaryRangeTranslator secondaryRangeTranslator, [NotNull] CSharpCodeStructureProcessingState state ) { TreeTextRange t4Range = featureBlock.Code.GetTreeTextRange(); TreeTextRange cSharpRange = secondaryRangeTranslator.OriginalToGenerated(t4Range); if (!cSharpRange.IsValid()) { return; } TreeOffset cSharpStart = cSharpRange.StartOffset; TreeOffset cSharpEnd = cSharpRange.EndOffset; ITreeNode containingNode = cSharpFile.FindNodeAt(cSharpRange); if (containingNode == null) { return; } for (ITreeNode node = containingNode.FirstChild; node != null; node = node.NextSibling) { TreeOffset nodeStart = node.GetTreeStartOffset(); if (nodeStart >= cSharpStart && nodeStart < cSharpEnd) { ProcessCSharpNode(node, parentElement, state); } } }
private static void ProcessCSharpNode([NotNull] ITreeNode node, [NotNull] CodeStructureElement parentElement, [NotNull] CSharpCodeStructureProcessingState state) { InterruptableActivityCookie.CheckAndThrow(); var declaration = node as IDeclaration; if (declaration != null) { if (!declaration.IsSynthetic()) { ProcessCSharpDeclaration(declaration, parentElement, state); } return; } var multiDeclaration = node as IMultipleDeclaration; if (multiDeclaration != null) { ProcessCSharpMultipleDeclaration(multiDeclaration, parentElement, state); return; } var preprocessorDirective = node as IPreprocessorDirective; if (preprocessorDirective != null) { ProcessCSharpPreprocessorDirective(preprocessorDirective, parentElement, state); } }
private static void ProcessCSharpChildren([NotNull] ITreeNode node, [NotNull] CodeStructureElement parentElement, [NotNull] CSharpCodeStructureProcessingState state) { foreach (ITreeNode childNode in node.Children()) { ProcessCSharpNode(childNode, parentElement, state); } }
public T4CSharpCodeStructureNamespace( [NotNull] CodeStructureElement parentElement, [NotNull] IDeclaration declaration, [NotNull] CSharpCodeStructureProcessingState state ) : base(parentElement, declaration, state) { }
public T4CodeStructureDirective( [NotNull] CodeStructureElement parent, [NotNull] IT4Directive directive, [NotNull] DirectiveInfoManager directiveInfoManager ) : base(parent, directive) { _directiveInfoManager = directiveInfoManager; }
public T4CSharpCodeStructureRegion( [NotNull] CodeStructureElement parentElement, [NotNull] ITreeNode preprocessorDirective, [NotNull] CSharpCodeStructureProcessingState state ) : base(parentElement, preprocessorDirective, state) { _parentRegion = state.Regions.TryPeek(); }
private static void ProcessCSharpMultipleDeclaration( [NotNull] IMultipleDeclaration declaration, [NotNull] CodeStructureElement parentElement, [NotNull] CSharpCodeStructureProcessingState state ) { foreach (IMultipleDeclarationMember declarationMember in declaration.DeclaratorsEnumerable) { if (!declarationMember.IsSynthetic()) { ProcessCSharpDeclaration(declarationMember, parentElement, state); } } }
private static void ProcessCSharpPreprocessorDirective([NotNull] IPreprocessorDirective preprocessorDirective, [NotNull] CodeStructureElement parentElement, [NotNull] CSharpCodeStructureProcessingState state) { switch (preprocessorDirective.Kind) { case PreprocessorDirectiveKind.REGION: state.Regions.Push(new T4CSharpCodeStructureRegion(parentElement, preprocessorDirective, state)); break; case PreprocessorDirectiveKind.ENDREGION: state.Regions.TryPop(); // ReSharper disable ObjectCreationAsStatement new T4CSharpCodeStructureRegionEnd(parentElement, preprocessorDirective, state); // ReSharper restore ObjectCreationAsStatement break; } }
private static void ProcessCSharpDeclaration( [NotNull] IDeclaration declaration, [NotNull] CodeStructureElement parentElement, [NotNull] CSharpCodeStructureProcessingState state ) { switch (declaration) { case IClassLikeDeclaration classLikeDeclaration: { var codeStructureClass = new T4CSharpCodeStructureDeclaredElement(parentElement, declaration, state); if (classLikeDeclaration.Body != null) { ProcessCSharpChildren(classLikeDeclaration.Body, codeStructureClass, state); } return; } case ICSharpNamespaceDeclaration namespaceDeclaration: { var structureNamespace = new T4CSharpCodeStructureNamespace(parentElement, declaration, state); if (namespaceDeclaration.Body != null) { ProcessCSharpChildren(namespaceDeclaration.Body, structureNamespace, state); } return; } case IAccessorDeclaration _: return; case IEnumDeclaration enumDeclaration: { var codeStructureElement = new T4CSharpCodeStructureDeclaredElement(parentElement, declaration, state) { InitiallyExpanded = false }; ProcessCSharpChildren(enumDeclaration.EnumBody, codeStructureElement, state); return; } default: { var codeStructureElement2 = new T4CSharpCodeStructureDeclaredElement(parentElement, declaration, state); ProcessCSharpChildren(declaration, codeStructureElement2, state); break; } } }
public T4CSharpCodeStructureDeclaredElement(CodeStructureElement parentElement, IDeclaration declaration, CSharpCodeStructureProcessingState state) : base(parentElement, declaration) { IDeclaredElement declaredElement = declaration.DeclaredElement; InitiallyExpanded = true; if (declaredElement != null && state.Options.BuildInheritanceInformation) { _inheritanceInformation = InheritanceInformation.FromDeclaredElement(declaredElement); if (_inheritanceInformation != null) { var structureDeclaredElement = parentElement as T4CSharpCodeStructureDeclaredElement; if (structureDeclaredElement != null) structureDeclaredElement.ChildrenWithInheritance = true; } } _parentRegion = state.Regions.TryPeek(); if (declaredElement != null) _aspects = new T4CSharpCodeStructureAspects(this, declaration); }
private void ProcessT4Node( [NotNull] ITreeNode node, [NotNull] CodeStructureElement parentElement, [NotNull] ICSharpFile cSharpFile, [NotNull] ISecondaryRangeTranslator secondaryRangeTranslator, [NotNull] CSharpCodeStructureProcessingState state ) { InterruptableActivityCookie.CheckAndThrow(); switch (node) { case IT4Directive directive: ProcessT4Directive(directive, parentElement); return; case IT4FeatureBlock featureBlock: ProcessT4FeatureBlock(featureBlock, parentElement, cSharpFile, secondaryRangeTranslator, state); break; } }
private void ProcessT4Node([NotNull] ITreeNode node, [NotNull] CodeStructureElement parentElement, [NotNull] ICSharpFile cSharpFile, [NotNull] ISecondaryRangeTranslator secondaryRangeTranslator, [NotNull] CSharpCodeStructureProcessingState state) { InterruptableActivityCookie.CheckAndThrow(); var directive = node as IT4Directive; if (directive != null) { ProcessT4Directive(directive, parentElement); return; } var featureBlock = node as T4FeatureBlock; if (featureBlock != null) { ProcessT4FeatureBlock(featureBlock, parentElement, cSharpFile, secondaryRangeTranslator, state); } }
private static void ProcessCSharpNode([NotNull] ITreeNode node, [NotNull] CodeStructureElement parentElement, [NotNull] CSharpCodeStructureProcessingState state) { InterruptableActivityCookie.CheckAndThrow(); switch (node) { case IDeclaration declaration: if (!declaration.IsSynthetic()) { ProcessCSharpDeclaration(declaration, parentElement, state); } return; case IMultipleDeclaration multiDeclaration: ProcessCSharpMultipleDeclaration(multiDeclaration, parentElement, state); return; case IPreprocessorDirective preprocessorDirective: ProcessCSharpPreprocessorDirective(preprocessorDirective, parentElement, state); break; } }
public T4CodeStructureDirective( [NotNull] CodeStructureElement parent, [NotNull] IT4Directive directive ) : base(parent, directive) { }
private static void ProcessCSharpDeclaration([NotNull] IDeclaration declaration, [NotNull] CodeStructureElement parentElement, [NotNull] CSharpCodeStructureProcessingState state) { var classLikeDeclaration = declaration as IClassLikeDeclaration; if (classLikeDeclaration != null) { var codeStructureClass = new T4CSharpCodeStructureDeclaredElement(parentElement, declaration, state); if (classLikeDeclaration.Body != null) { ProcessCSharpChildren(classLikeDeclaration.Body, codeStructureClass, state); } return; } var namespaceDeclaration = declaration as ICSharpNamespaceDeclaration; if (namespaceDeclaration != null) { var structureNamespace = new T4CSharpCodeStructureNamespace(parentElement, declaration, state); if (namespaceDeclaration.Body != null) { ProcessCSharpChildren(namespaceDeclaration.Body, structureNamespace, state); } return; } if (declaration is IAccessorDeclaration) { return; } var codeStructureElement = new T4CSharpCodeStructureDeclaredElement(parentElement, declaration, state); var enumDeclaration = declaration as IEnumDeclaration; if (enumDeclaration != null) { codeStructureElement.InitiallyExpanded = false; ProcessCSharpChildren(enumDeclaration.EnumBody, codeStructureElement, state); return; } ProcessCSharpChildren(declaration, codeStructureElement, state); }
private void ProcessT4Directive([NotNull] IT4Directive directive, [NotNull] CodeStructureElement parentElement) => new T4CodeStructureDirective(parentElement, directive);
protected T4CodeStructureElement([NotNull] CodeStructureElement parent, [NotNull] T treeNode) : base(parent) { _textRange = treeNode.GetDocumentRange().TextRange; _pointer = treeNode.CreateTreeElementPointer(); }
public T4CSharpCodeStructureRegionEnd(CodeStructureElement parentElement, ITreeNode preprocessorDirective, CSharpCodeStructureProcessingState state) : base(parentElement, preprocessorDirective) { _parentRegion = state.Regions.TryPeek(); }
private void ProcessT4Directive([NotNull] IT4Directive directive, [NotNull] CodeStructureElement parentElement) { // ReSharper disable ObjectCreationAsStatement new T4CodeStructureDirective(parentElement, directive, _directiveInfoManager); // ReSharper restore ObjectCreationAsStatement }