Skip to content

Check that token is AsyncKeyword before calling lookAhead#8477

Merged
yuit merged 2 commits into
masterfrom
checkbeforecalllookahead
May 5, 2016
Merged

Check that token is AsyncKeyword before calling lookAhead#8477
yuit merged 2 commits into
masterfrom
checkbeforecalllookahead

Conversation

@yuit

@yuit yuit commented May 5, 2016

Copy link
Copy Markdown
Contributor

Before calling lookAhead function check that the current toke is AsyncKeyword because lookAHead is an expensive operation

@RyanCavanaugh

Copy link
Copy Markdown
Member

Is there a bug tracking this?

@yuit

yuit commented May 5, 2016

Copy link
Copy Markdown
Contributor Author

@RyanCavanaugh nop it is from the PR @mhegazy made a comment after I merged the PR in

Comment thread src/compiler/parser.ts Outdated
return parseSimpleArrowFunctionExpression(<Identifier>expr, asyncModifier);
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
if (token === SyntaxKind.AsyncKeyword) {
const isUnParenthesizedAsyncArrowFunction = lookAhead(isUnParenthesizedAsyncArrowFunctionWorker);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Linter's mad about the trailing WS here

@sandersn

sandersn commented May 5, 2016

Copy link
Copy Markdown
Member

👍

@yuit yuit merged commit 990f1c7 into master May 5, 2016
@yuit yuit deleted the checkbeforecalllookahead branch May 5, 2016 21:18
@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