GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Parse namespaces/types aliases/interfaces/ambient declarations only when they cannot be legal JS by DanielRosenwasser · Pull Request #3365 · microsoft/TypeScript

Conversation

@DanielRosenwasser

@DanielRosenwasser Daniel Rosenwasser (DanielRosenwasser) commented Jun 3, 2015

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Daniel Rosenwasser (DanielRosenwasser) added 6 commits June 2, 2015 15:42
@DanielRosenwasser
Added tests.
e93b7a7
@DanielRosenwasser
Added baselines.
448e8bf
@DanielRosenwasser
Added more tests.
77306a3
@DanielRosenwasser
Accepted more baselines.
70f74ad
@DanielRosenwasser
Fixed case for the 'declare' keyword.
3cac56a
@DanielRosenwasser
Accepted baselines.
3cd480d
@msftclas Microsoft Contribution License Agreements (msftclas) added the cla-not-required label Jun 3, 2015
CyrusNajmabadi
CyrusNajmabadi reviewed Jun 3, 2015
View reviewed changes
Comment thread src/compiler/parser.ts Outdated

@CyrusNajmabadi Cyrus Najmabadi (CyrusNajmabadi) Jun 3, 2015

Copy link
Copy Markdown
Contributor

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.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Daniel Rosenwasser (DanielRosenwasser) added 2 commits June 3, 2015 13:46
@DanielRosenwasser
Added an explanation for the lookahead.
3fe308d
@DanielRosenwasser
Renamed functions, removed the duplicates found from renaming.
64a31e2
@DanielRosenwasser

Daniel Rosenwasser (DanielRosenwasser) commented Jun 4, 2015

Copy link
Copy Markdown
Member Author

Any more feedback Cyrus Najmabadi (@CyrusNajmabadi)?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@CyrusNajmabadi

Cyrus Najmabadi (CyrusNajmabadi) commented Jun 4, 2015

Copy link
Copy Markdown
Contributor

Nope. lgtm

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Daniel Rosenwasser (DanielRosenwasser) added 4 commits June 4, 2015 14:20
@DanielRosenwasser
Added tests for interfaces and tagged templates.
8c422af
@DanielRosenwasser
Accepted baselines.
8af07ee
@DanielRosenwasser
Account for interfaces.
047d3ae
@DanielRosenwasser
Accepted new baselines.
534105c
@DanielRosenwasser Daniel Rosenwasser (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
JsonFreeman
JsonFreeman reviewed Jun 4, 2015
View reviewed changes
Comment thread src/compiler/parser.ts Outdated

@JsonFreeman Jason Freeman (JsonFreeman) Jun 4, 2015

Copy link
Copy Markdown
Contributor

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.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@JsonFreeman

Jason Freeman (JsonFreeman) commented Jun 4, 2015

Copy link
Copy Markdown
Contributor

👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Daniel Rosenwasser (DanielRosenwasser) added 4 commits June 4, 2015 16:29
@DanielRosenwasser
Amended comment.
10861b1
@DanielRosenwasser
Added test regarding 'declare' keyword as beginning of statement expr…
aef9edf
…ession.
@DanielRosenwasser
Accepted baselines.
18bd849
@DanielRosenwasser
Moved lookahead logic into 'getDeclarationFlags'.
3d9293e
Daniel Rosenwasser (DanielRosenwasser) added a commit that referenced this pull request Jun 8, 2015
@DanielRosenwasser
Merge pull request #3365 from Microsoft/painInTheASI
6b77c24
Parse namespaces/types aliases/interfaces/ambient declarations only when they cannot be legal JS
@DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser) merged commit 6b77c24 into master Jun 8, 2015
@DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser) deleted the painInTheASI branch June 8, 2015 17:27
@microsoft 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.

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@DanielRosenwasser @CyrusNajmabadi @JsonFreeman @msftclas
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.