Skip to content

Error for missing module flag is now in createProgram #146

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

Closed
wants to merge 4 commits into from

Conversation

JsonFreeman
Copy link
Contributor

We don't want to try to emit if the --module flag was not specified. So I have moved this logic to createProgram, whose errors prevent emit.

I have also changed the way we track external module-hood of a file. Instead of having a flag NodeFlags.ExternalModule, there is now a property on the SourceFile called externalModuleIndicator. This is the first node in the file that causes the file to be an external module. When we check for the missing module flag, we will error on this node.

I've also added a function getErrorSpanForNode, which is currently empty. But it is supposed to take a node, and return the best error span to give an error on that node.

@@ -4679,12 +4677,6 @@ module ts {
return false;
}

function checkDeclarationModifiers(node: Node) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we have been checking for other modifiers here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It used to be primarily for the 'declare' modifier. I have gradually pulled things out of this function without changing its name, and this was the only thing left.

@DanielRosenwasser
Copy link
Member

After changes, LGTM.

@CyrusNajmabadi
Copy link
Contributor

LGTM

@JsonFreeman JsonFreeman deleted the moduleFlag branch July 21, 2014 16:58
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy