Skip to content

Conversation

DanielRosenwasser
Copy link
Member

Fixes #2722.

@mhegazy
Copy link
Contributor

mhegazy commented Apr 17, 2015

👍

let id = parsePropertyName();
if (id.kind === SyntaxKind.Identifier && token !== SyntaxKind.ColonToken) {
node.name = <Identifier>id;
let tokenIsIdentifier = isIdentifier();
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we decide to not just always parse out a property name, and then error later if the property name turns out to be a keyword?

Copy link
Contributor

Choose a reason for hiding this comment

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

That is another approach we are considering. I do prefer it

@JsonFreeman
Copy link
Contributor

Looks like we get this wrong for import / export specifiers as well! I tried the following:

interface StringTree { }
export { StringTree as while };

I got no error.

@DanielRosenwasser DanielRosenwasser force-pushed the noReservedWordsInBindingPatterns branch from c1d11cf to 4134d79 Compare April 17, 2015 23:52
DanielRosenwasser added a commit that referenced this pull request Apr 18, 2015
Disallow reserved words for object binding pattern names
@DanielRosenwasser DanielRosenwasser merged commit 6203675 into master Apr 18, 2015
@CyrusNajmabadi CyrusNajmabadi deleted the noReservedWordsInBindingPatterns branch June 4, 2015 00:27
@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.

Disallow reserved word in object binding pattern
5 participants