diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-06-08 13:02:16 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-07-18 22:38:09 -0400 |
commit | 5e76f72c539cd0e2fc0d38e4475f494868b5e859 (patch) | |
tree | 78046947a2841bd399c60ab283e1e80003ab76b0 /js/src/frontend/FullParseHandler.h | |
parent | bf2610c0cfc96327178a5d3d7121181c2f375f48 (diff) | |
download | UXP-5e76f72c539cd0e2fc0d38e4475f494868b5e859.tar UXP-5e76f72c539cd0e2fc0d38e4475f494868b5e859.tar.gz UXP-5e76f72c539cd0e2fc0d38e4475f494868b5e859.tar.lz UXP-5e76f72c539cd0e2fc0d38e4475f494868b5e859.tar.xz UXP-5e76f72c539cd0e2fc0d38e4475f494868b5e859.zip |
1315815 - Don't treat async or await as a keyword when they contain escapes.
Diffstat (limited to 'js/src/frontend/FullParseHandler.h')
-rw-r--r-- | js/src/frontend/FullParseHandler.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/js/src/frontend/FullParseHandler.h b/js/src/frontend/FullParseHandler.h index b619cf24c..3938d9743 100644 --- a/js/src/frontend/FullParseHandler.h +++ b/js/src/frontend/FullParseHandler.h @@ -10,6 +10,8 @@ #include "mozilla/Attributes.h" #include "mozilla/PodOperations.h" +#include <string.h> + #include "frontend/ParseNode.h" #include "frontend/SharedContext.h" @@ -870,29 +872,25 @@ class FullParseHandler return node->isKind(PNK_NAME); } - bool nameIsEvalAnyParentheses(ParseNode* node, ExclusiveContext* cx) { - MOZ_ASSERT(isNameAnyParentheses(node), - "must only call this function on known names"); - - return node->pn_atom == cx->names().eval; + bool isEvalAnyParentheses(ParseNode* node, ExclusiveContext* cx) { + return node->isKind(PNK_NAME) && node->pn_atom == cx->names().eval; } const char* nameIsArgumentsEvalAnyParentheses(ParseNode* node, ExclusiveContext* cx) { MOZ_ASSERT(isNameAnyParentheses(node), "must only call this function on known names"); - if (nameIsEvalAnyParentheses(node, cx)) + if (isEvalAnyParentheses(node, cx)) return js_eval_str; if (node->pn_atom == cx->names().arguments) return js_arguments_str; return nullptr; } - bool nameIsUnparenthesizedAsync(ParseNode* node, ExclusiveContext* cx) { - MOZ_ASSERT(isNameAnyParentheses(node), - "must only call this function on known names"); - - return node->pn_atom == cx->names().async; + bool isAsyncKeyword(ParseNode* node, ExclusiveContext* cx) { + return node->isKind(PNK_NAME) && + node->pn_pos.begin + strlen("async") == node->pn_pos.end && + node->pn_atom == cx->names().async; } bool isCall(ParseNode* pn) { |