C# Class Rosetta.ScriptSharp.Definition.AST.Transformers.ScriptNamespaceBasedASTTransformer

Base class for rearrangement of namespaces for classes basing on ScriptSharp's ScriptNamespace attribute.
This transformer acts with some limitations. - File has one level of namespacing and no more.
Inheritance: Rosetta.AST.Transformers.ClassWithAttributeInDifferentNamespaceASTTransformer, IASTTransformer
Mostra file Open project: andry-tino/Rosetta Class Usage Examples

Public Methods

Method Description
ScriptNamespaceBasedASTTransformer ( ) : System

Initializes a new instance of the ClassWithAttributeInDifferentNamespaceASTTransformer class.

Transform ( CSharpSyntaxTree &tree ) : void

Transforms the tree.

Transform ( CSharpSyntaxTree &tree, Microsoft.CodeAnalysis.CSharp.CSharpCompilation &compilation ) : void

Transforms the tree.

Private Methods

Method Description
CleanUp ( ) : void
CleanUpCompilationUnit ( ) : void

Cleans up empty structures from previous step.

GetOriginalNamespaces ( ) : IEnumerable

Looks into transformationInfos and retrieves all TransformationInfo.OriginalNamespace. It filters out duoplicates and returns the collection.

GetTeeSymbols ( Microsoft.CodeAnalysis.SyntaxTree tree, Microsoft.CodeAnalysis.SemanticModel model ) : ISymbol>>.IEnumerable
Initialize ( CSharpSyntaxTree tree, Microsoft.CodeAnalysis.CSharp.CSharpCompilation compilation ) : void
ProcessOverridenNamespaceNames ( ) : void

Causes the structure if the SAT to change. It can cause leftovers (empty structures) to be present.

RemoveEmptyNamespaces ( ) : void
RetrieveAllUsingDirectivesAndCopyAtRootLevel ( ) : void

A rearrangement of the AST and a replacement of classes into new namespaces need to happen, this will mess up the references, thus we need to transplant the using directives in the new tree as well. TODO: This approach generates a lot of duplicated using directives. It is not harmful. Make it better.

RetrieveEmptyNamespaces ( ) : void
RetrieveOverridenNamespaceNames ( ) : void

Does not perform any operations yet on the AST.

RetrieveScriptNamespaceAttribute ( AttributeLists helper ) : ScriptNamespaceAttributeDecoration
UpdateCompilation ( ) : void

Updates the semantic model after all the changes.

Method Details

ScriptNamespaceBasedASTTransformer() public method

Initializes a new instance of the ClassWithAttributeInDifferentNamespaceASTTransformer class.
public ScriptNamespaceBasedASTTransformer ( ) : System
return System

Transform() public method

Transforms the tree.
public Transform ( CSharpSyntaxTree &tree ) : void
tree CSharpSyntaxTree
return void

Transform() public method

Transforms the tree.
public Transform ( CSharpSyntaxTree &tree, Microsoft.CodeAnalysis.CSharp.CSharpCompilation &compilation ) : void
tree CSharpSyntaxTree
compilation Microsoft.CodeAnalysis.CSharp.CSharpCompilation The compilation containing the semantic model associated to the node.
return void