Skip to content

Allow reserved words in type queries. #199

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

Merged
merged 2 commits into from
Jul 23, 2014
Merged

Conversation

ahejlsberg
Copy link
Member

Fixes #181.

@danquirk
Copy link
Member

Ignore the Travis-CI failure, I'm still sorting out issues with it, it should be disabled now.

var entity: EntityName = parseIdentifier();
while (parseOptional(SyntaxKind.DotToken)) {
var node = <QualifiedName>createNode(SyntaxKind.QualifiedName, entity.pos);
node.left = entity;
node.right = parseIdentifier();
node.right = allowReservedWords ? parseIdentifierName() : parseIdentifier();
Copy link
Contributor

Choose a reason for hiding this comment

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

on the right of a dot, shouldn't we always allow reservedWords?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, n/m. i see the subtlety here. Could you doc the reasoning behind this. Specifically, that normally an Entity name could never have keywords in it, since it can only refer to module names on the left, and an identifier on the right (and module names can only be identifiers). however, for typeof, you need to allow identifier names on the right.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, it parses an EntityName by default but when you specify true for the optional parameter it parses a TypeQueryExpression. I can add a comment to that effect.

Making allowReservedWords parameter of parseEntityName non-optional.
ahejlsberg added a commit that referenced this pull request Jul 23, 2014
@ahejlsberg ahejlsberg merged commit e742694 into master Jul 23, 2014
@ahejlsberg ahejlsberg deleted the reservedWordsInTypeQueries branch July 23, 2014 22:52
@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.

Keywords (e.g. 'delete', 'var') should be valid class method names
3 participants