Closed andry-tino closed 7 years ago
This is both an enhancement, in order to deal with overridden names in referenced types (unavailable in AST but available in semantic model, when latter is provided), and a bug (regression) since the transformation is now not taking place anymore.
The semantic misalignment problem should have been solved by placing using
directives in the new AST. But that is not working for some reason. Need to move on with a temporary solution:
SemanticModel
. Keep using original one.ScriptNamespace
and emit an overridden FullName
.SemanticModel
in 2 will fix these nodes which should be emitted fine.Important Regarding point 4: A cache is not needed for defined symbols in local AST. If we add using
s for namespaces of entities that have been placed in different namespace, then we are all right.
Current state is good. Semantic alignment still need a little more tuning but the fundamental structure is in place now.
Change 86060aa has purposely broken the transformer which had to be deactivate in that same change. Issue #19 has been tracking the feature. This issue arises as a continuation of that and aims to fix the transformer in order to fix the
ScriptNamespace
attribute handling which is, currently, broken.Problem
A problem arises concerning syntax transformation.
What Issue is that after transforming, the syntax tree is different and does not correspond anymore to the semantic model.
Solution
A mixture of the mapping approach and the semantic model update.
Available types in AST At transformation time, we transform the AST and then generate an updated model. This will deal with the types available in the local AST (a small part represented in the semantic model). See:
Referenced unavailable types We still have a problem concerning types referenced by the local AST but not available. The semantic model will refer to them using the not overriden namespace, while we should actually use the overridden one.
To accommodate this, helpers (when provided with semantic model), when providing the full name or every namespace-related quantity, will check the presence of the
ScriptNamespace
attribute and override the name accordingly. This will impact ONLY helpers in the ScriptSharp Definition area.Challenge: semantic misalignment
After transforming and updating the semantic model reports a lot of errors relating to missing assemblies.
Solution Collect all
using
directives and copy in the root level of the new node or in the single namespaces created for each moved type. It is also important to include the namespace of the moved entities in order to have proper semantic alignment for them.