Skip to content

Parse namespaces/types aliases/interfaces/ambient declarations only when they cannot be legal JS#3365

Merged
DanielRosenwasser merged 16 commits into
masterfrom
painInTheASI
Jun 8, 2015
Merged

Parse namespaces/types aliases/interfaces/ambient declarations only when they cannot be legal JS#3365
DanielRosenwasser merged 16 commits into
masterfrom
painInTheASI

Conversation

@DanielRosenwasser
Copy link
Copy Markdown
Member

Fixes #2995.

Previously, upon encountering a module, namespace, type, interface, or declare keyword, we would immediately launch into parsing out an "appropriate" declaration.

However, this is inappropriate for reasons listed in issue #2995. These could actually be identifiers. To deal with this, we ensure that what we have is not legal JavaScript by adding a single token lookahead and checking for whether that token is an appropriate token on the same line.

Comment thread src/compiler/parser.ts Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You need some comment explaining why the lookahead is necessary here, but not for the syntaxkind kinds below.

@DanielRosenwasser
Copy link
Copy Markdown
Member Author

Any more feedback @CyrusNajmabadi?

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

Nope. lgtm

@DanielRosenwasser DanielRosenwasser changed the title Parse namespaces, types aliases, and ambient declarations only when they cannot be legal JS Parse namespaces/types aliases/interfaces/ambient declarations only when they cannot be legal JS Jun 4, 2015
Comment thread src/compiler/parser.ts Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you still need these declaration flags checks? Are they redundant of the check you are adding?

@JsonFreeman
Copy link
Copy Markdown
Contributor

👍

DanielRosenwasser added a commit that referenced this pull request Jun 8, 2015
Parse namespaces/types aliases/interfaces/ambient declarations only when they cannot be legal JS
@DanielRosenwasser DanielRosenwasser merged commit 6b77c24 into master Jun 8, 2015
@DanielRosenwasser DanielRosenwasser deleted the painInTheASI branch June 8, 2015 17:27
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 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.

4 participants