-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make a clone of the parsed document available in compilation #3338
Conversation
@@ -938,8 +938,8 @@ public class ModuleDefinition : INode, IDeclarationOrUsage, INamedRegion, IAttri | |||
public override IEnumerable<INode> Children => (Attributes != null ? new List<INode> { Attributes } : Enumerable.Empty<INode>()).Concat(TopLevelDecls); | |||
} | |||
|
|||
public class DefaultModuleDecl : ModuleDefinition { | |||
public DefaultModuleDecl() | |||
public class DefaultModuleDef : ModuleDefinition { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhhhhh I was wondering why I was always confused by module declarations and module definitions.... you nailed it !
var symbolTable = symbolTableFactory.CreateFrom(program, compilationUnit, cancellationToken); | ||
var textDocument = documentAfterParsing.TextDocumentItem; | ||
var parsedProgram = documentAfterParsing.Program; | ||
var clonedProgram = new Program(parsedProgram.Name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops the cloning removes all the ranges and owned tokens, that means that the parsed document will be useless for formatting... I don't think we can get around solving #3290 now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not just clone those as well? Not cloning them seems like a bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but since they are not part of the constructor, we might forget about them, either in current cloners, in future cloners, or in future language constructs. Anyway, we can add the range manually for now.
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.