diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-06-09 23:03:08 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-07-18 22:38:39 -0400 |
commit | dab8877c10fcc9dd5d86e6fd3d1924e474076726 (patch) | |
tree | 2a238df95fa61948b4e4a1026786a82f980969f7 /js/src/frontend/Parser.h | |
parent | 8a4aeb6f58649af6e0a6d1df30b133510cbb2187 (diff) | |
download | UXP-dab8877c10fcc9dd5d86e6fd3d1924e474076726.tar UXP-dab8877c10fcc9dd5d86e6fd3d1924e474076726.tar.gz UXP-dab8877c10fcc9dd5d86e6fd3d1924e474076726.tar.lz UXP-dab8877c10fcc9dd5d86e6fd3d1924e474076726.tar.xz UXP-dab8877c10fcc9dd5d86e6fd3d1924e474076726.zip |
104442 - Part 1: Report the position and the kind of previous declaration for redeclaration error.
Diffstat (limited to 'js/src/frontend/Parser.h')
-rw-r--r-- | js/src/frontend/Parser.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h index 824dddb58..6b5ade425 100644 --- a/js/src/frontend/Parser.h +++ b/js/src/frontend/Parser.h @@ -146,9 +146,9 @@ class ParseContext : public Nestable<ParseContext> } MOZ_MUST_USE bool addDeclaredName(ParseContext* pc, AddDeclaredNamePtr& p, JSAtom* name, - DeclarationKind kind) + DeclarationKind kind, uint32_t pos) { - return maybeReportOOM(pc, declared_->add(p, name, DeclaredNameInfo(kind))); + return maybeReportOOM(pc, declared_->add(p, name, DeclaredNameInfo(kind, pos))); } // Remove all VarForAnnexBLexicalFunction declarations of a certain @@ -1437,15 +1437,17 @@ class Parser final : public ParserBase, private JS::AutoGCRooter bool hasValidSimpleStrictParameterNames(); - void reportRedeclaration(HandlePropertyName name, DeclarationKind kind, TokenPos pos); - bool notePositionalFormalParameter(Node fn, HandlePropertyName name, + void reportRedeclaration(HandlePropertyName name, DeclarationKind prevKind, TokenPos pos, + uint32_t prevPos); + bool notePositionalFormalParameter(Node fn, HandlePropertyName name, uint32_t beginPos, bool disallowDuplicateParams, bool* duplicatedParam); bool noteDestructuredPositionalFormalParameter(Node fn, Node destruct); mozilla::Maybe<DeclarationKind> isVarRedeclaredInEval(HandlePropertyName name, DeclarationKind kind); - bool tryDeclareVar(HandlePropertyName name, DeclarationKind kind, - mozilla::Maybe<DeclarationKind>* redeclaredKind); - bool tryDeclareVarForAnnexBLexicalFunction(HandlePropertyName name, bool* tryAnnexB); + bool tryDeclareVar(HandlePropertyName name, DeclarationKind kind, uint32_t beginPos, + mozilla::Maybe<DeclarationKind>* redeclaredKind, uint32_t* prevPos); + bool tryDeclareVarForAnnexBLexicalFunction(HandlePropertyName name, uint32_t beginPos, + bool* tryAnnexB); bool checkLexicalDeclarationDirectlyWithinBlock(ParseContext::Statement& stmt, DeclarationKind kind, TokenPos pos); bool noteDeclaredName(HandlePropertyName name, DeclarationKind kind, TokenPos pos); |