зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 1783738) for causing reftest failures with getBuildConfiguration CLOSED TREE
Backed out changeset a10f3d51daad (bug 1783738) Backed out changeset 6cd01666a991 (bug 1783738) Backed out changeset 9d7f488a2cd9 (bug 1783738) Backed out changeset 3ca5e3471c04 (bug 1783738)
This commit is contained in:
Родитель
118f5ba0d6
Коммит
517ada709c
|
@ -334,7 +334,6 @@ MSG_DEF(JSMSG_PAREN_BEFORE_FORMAL, 0, JSEXN_SYNTAXERR, "missing ( before for
|
|||
MSG_DEF(JSMSG_PAREN_BEFORE_SWITCH, 0, JSEXN_SYNTAXERR, "missing ( before switch expression")
|
||||
MSG_DEF(JSMSG_PAREN_BEFORE_WITH, 0, JSEXN_SYNTAXERR, "missing ( before with-statement object")
|
||||
MSG_DEF(JSMSG_PAREN_IN_PAREN, 0, JSEXN_SYNTAXERR, "missing ) in parenthetical")
|
||||
MSG_DEF(JSMSG_PAREN_AFTER_DECORATOR, 0, JSEXN_SYNTAXERR, "missing ) in decorator expression")
|
||||
MSG_DEF(JSMSG_RC_AFTER_EXPORT_SPEC_LIST, 0, JSEXN_SYNTAXERR, "missing '}' after export specifier list")
|
||||
MSG_DEF(JSMSG_RC_AFTER_IMPORT_SPEC_LIST, 0, JSEXN_SYNTAXERR, "missing '}' after module specifier list")
|
||||
MSG_DEF(JSMSG_RESERVED_ID, 1, JSEXN_SYNTAXERR, "{0} is a reserved identifier")
|
||||
|
@ -389,8 +388,6 @@ MSG_DEF(JSMSG_DUPLICATE_ASSERT_KEY, 1, JSEXN_SYNTAXERR, "duplicate assert key
|
|||
MSG_DEF(JSMSG_COLON_AFTER_ASSERT_KEY, 0, JSEXN_SYNTAXERR, "missing : after assert key")
|
||||
MSG_DEF(JSMSG_ASSERT_STRING_LITERAL, 0, JSEXN_SYNTAXERR, "expected string literal")
|
||||
MSG_DEF(JSMSG_ASSERT_KEY_EXPECTED, 0, JSEXN_SYNTAXERR, "expected assertion key")
|
||||
MSG_DEF(JSMSG_DECORATOR_NAME_EXPECTED, 0, JSEXN_SYNTAXERR, "expected decorator name after @")
|
||||
MSG_DEF(JSMSG_CLASS_EXPECTED, 0, JSEXN_SYNTAXERR, "expected class")
|
||||
|
||||
// UTF-8 source text encoding errors
|
||||
MSG_DEF(JSMSG_BAD_LEADING_UTF8_UNIT, 1, JSEXN_SYNTAXERR, "{0} byte doesn't begin a valid UTF-8 code point")
|
||||
|
|
|
@ -560,15 +560,6 @@ static bool GetBuildConfiguration(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DECORATORS
|
||||
value = BooleanValue(true);
|
||||
#else
|
||||
value = BooleanValue(false);
|
||||
#endif
|
||||
if (!JS_SetProperty(cx, info, "decorators", value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef FUZZING
|
||||
value = BooleanValue(true);
|
||||
#else
|
||||
|
|
|
@ -1069,11 +1069,6 @@ restart:
|
|||
MOZ_CRASH("Record and Tuple are not supported yet");
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_DECORATORS
|
||||
case ParseNodeKind::DecoratorList:
|
||||
MOZ_CRASH("Decorators are not supported yet");
|
||||
#endif
|
||||
|
||||
// Most other binary operations (parsed as lists in SpiderMonkey) may
|
||||
// perform conversions triggering side effects. Math operations perform
|
||||
// ToNumber and may fail invoking invalid user-defined toString/valueOf:
|
||||
|
|
|
@ -453,12 +453,10 @@ restart:
|
|||
case ParseNodeKind::SuperCallExpr:
|
||||
case ParseNodeKind::SuperBase:
|
||||
case ParseNodeKind::SetThis:
|
||||
#ifdef ENABLE_DECORATORS
|
||||
case ParseNodeKind::DecoratorList:
|
||||
#endif
|
||||
MOZ_CRASH(
|
||||
"ContainsHoistedDeclaration should have indicated false on "
|
||||
"some parent node without recurring to test this node");
|
||||
|
||||
case ParseNodeKind::LastUnused:
|
||||
case ParseNodeKind::Limit:
|
||||
MOZ_CRASH("unexpected sentinel ParseNodeKind in node");
|
||||
|
|
|
@ -372,15 +372,8 @@ class FullParseHandler {
|
|||
|
||||
ClassNodeType newClass(Node name, Node heritage,
|
||||
LexicalScopeNodeType memberBlock,
|
||||
#ifdef ENABLE_DECORATORS
|
||||
ListNodeType decorators,
|
||||
#endif
|
||||
const TokenPos& pos) {
|
||||
return new_<ClassNode>(name, heritage, memberBlock,
|
||||
#ifdef ENABLE_DECORATORS
|
||||
decorators,
|
||||
#endif
|
||||
pos);
|
||||
return new_<ClassNode>(name, heritage, memberBlock, pos);
|
||||
}
|
||||
ListNodeType newClassMemberList(uint32_t begin) {
|
||||
return new_<ListNode>(ParseNodeKind::ClassMemberList,
|
||||
|
@ -501,61 +494,31 @@ class FullParseHandler {
|
|||
|
||||
checkAndSetIsDirectRHSAnonFunction(funNode);
|
||||
|
||||
return new_<ClassMethod>(
|
||||
ParseNodeKind::DefaultConstructor, key, funNode, AccessorType::None,
|
||||
/* isStatic = */ false, /* initializeIfPrivate = */ nullptr
|
||||
#ifdef ENABLE_DECORATORS
|
||||
,
|
||||
/* decorators = */ nullptr
|
||||
#endif
|
||||
);
|
||||
return new_<ClassMethod>(ParseNodeKind::DefaultConstructor, key, funNode,
|
||||
AccessorType::None,
|
||||
/* isStatic = */ false, nullptr);
|
||||
}
|
||||
|
||||
[[nodiscard]] ClassMethod* newClassMethodDefinition(
|
||||
Node key, FunctionNodeType funNode, AccessorType atype, bool isStatic,
|
||||
mozilla::Maybe<FunctionNodeType> initializerIfPrivate
|
||||
#ifdef ENABLE_DECORATORS
|
||||
,
|
||||
ListNodeType decorators
|
||||
#endif
|
||||
) {
|
||||
mozilla::Maybe<FunctionNodeType> initializerIfPrivate) {
|
||||
MOZ_ASSERT(isUsableAsObjectPropertyName(key));
|
||||
|
||||
checkAndSetIsDirectRHSAnonFunction(funNode);
|
||||
|
||||
if (initializerIfPrivate.isSome()) {
|
||||
return new_<ClassMethod>(ParseNodeKind::ClassMethod, key, funNode, atype,
|
||||
isStatic, initializerIfPrivate.value()
|
||||
#ifdef ENABLE_DECORATORS
|
||||
,
|
||||
decorators
|
||||
#endif
|
||||
);
|
||||
isStatic, initializerIfPrivate.value());
|
||||
}
|
||||
return new_<ClassMethod>(ParseNodeKind::ClassMethod, key, funNode, atype,
|
||||
isStatic, /* initializeIfPrivate = */ nullptr
|
||||
#ifdef ENABLE_DECORATORS
|
||||
,
|
||||
decorators
|
||||
#endif
|
||||
);
|
||||
isStatic, nullptr);
|
||||
}
|
||||
|
||||
[[nodiscard]] ClassField* newClassFieldDefinition(
|
||||
Node name, FunctionNodeType initializer, bool isStatic
|
||||
#ifdef ENABLE_DECORATORS
|
||||
,
|
||||
ListNodeType decorators
|
||||
#endif
|
||||
) {
|
||||
Node name, FunctionNodeType initializer, bool isStatic) {
|
||||
MOZ_ASSERT(isUsableAsObjectPropertyName(name));
|
||||
|
||||
return new_<ClassField>(name, initializer, isStatic
|
||||
#if ENABLE_DECORATORS
|
||||
,
|
||||
decorators
|
||||
#endif
|
||||
);
|
||||
return new_<ClassField>(name, initializer, isStatic);
|
||||
}
|
||||
|
||||
[[nodiscard]] StaticClassBlock* newStaticClassBlock(FunctionNodeType block) {
|
||||
|
|
|
@ -122,7 +122,6 @@ class FunctionBox;
|
|||
F(WithStmt, BinaryNode) \
|
||||
F(ReturnStmt, UnaryNode) \
|
||||
F(NewExpr, BinaryNode) \
|
||||
IF_DECORATORS(F(DecoratorList, ListNode)) \
|
||||
/* Delete operations. These must be sequential. */ \
|
||||
F(DeleteNameExpr, UnaryNode) \
|
||||
F(DeletePropExpr, UnaryNode) \
|
||||
|
@ -469,12 +468,6 @@ inline bool IsTypeofKind(ParseNodeKind kind) {
|
|||
* NewExpr (BinaryNode)
|
||||
* left: ctor expression on the left of the '('
|
||||
* right: Arguments
|
||||
* DecoratorList (ListNode)
|
||||
* head: list of N nodes, each item is one of:
|
||||
* * NameNode (DecoratorMemberExpression)
|
||||
* * CallNode (DecoratorCallExpression)
|
||||
* * Node (DecoratorParenthesizedExpression)
|
||||
* count: N > 0
|
||||
* DeleteNameExpr, DeletePropExpr, DeleteElemExpr, DeleteExpr (UnaryNode)
|
||||
* kid: expression that's evaluated, then the overall delete evaluates to
|
||||
* true; can't be a kind for a more-specific ParseNodeKind::Delete*
|
||||
|
@ -2201,10 +2194,6 @@ class ClassMethod : public BinaryNode {
|
|||
AccessorType accessorType_;
|
||||
FunctionNode* initializerIfPrivate_;
|
||||
|
||||
#ifdef ENABLE_DECORATORS
|
||||
ListNode* decorators_;
|
||||
#endif
|
||||
|
||||
public:
|
||||
/*
|
||||
* Method definitions often keep a name and function body that overlap,
|
||||
|
@ -2212,22 +2201,12 @@ class ClassMethod : public BinaryNode {
|
|||
*/
|
||||
ClassMethod(ParseNodeKind kind, ParseNode* name, ParseNode* body,
|
||||
AccessorType accessorType, bool isStatic,
|
||||
FunctionNode* initializerIfPrivate
|
||||
#ifdef ENABLE_DECORATORS
|
||||
,
|
||||
ListNode* decorators
|
||||
#endif
|
||||
)
|
||||
FunctionNode* initializerIfPrivate)
|
||||
: BinaryNode(kind, TokenPos(name->pn_pos.begin, body->pn_pos.end), name,
|
||||
body),
|
||||
isStatic_(isStatic),
|
||||
accessorType_(accessorType),
|
||||
initializerIfPrivate_(initializerIfPrivate)
|
||||
#ifdef ENABLE_DECORATORS
|
||||
,
|
||||
decorators_(decorators)
|
||||
#endif
|
||||
{
|
||||
initializerIfPrivate_(initializerIfPrivate) {
|
||||
MOZ_ASSERT(kind == ParseNodeKind::DefaultConstructor ||
|
||||
kind == ParseNodeKind::ClassMethod);
|
||||
}
|
||||
|
@ -2248,29 +2227,16 @@ class ClassMethod : public BinaryNode {
|
|||
AccessorType accessorType() const { return accessorType_; }
|
||||
|
||||
FunctionNode* initializerIfPrivate() const { return initializerIfPrivate_; }
|
||||
|
||||
#ifdef ENABLE_DECORATORS
|
||||
ListNode* decorators() const { return decorators_; }
|
||||
#endif
|
||||
};
|
||||
|
||||
class ClassField : public BinaryNode {
|
||||
bool isStatic_;
|
||||
#ifdef ENABLE_DECORATORS
|
||||
ListNode* decorators_;
|
||||
#endif
|
||||
|
||||
public:
|
||||
ClassField(ParseNode* name, ParseNode* initializer, bool isStatic
|
||||
#ifdef ENABLE_DECORATORS
|
||||
,
|
||||
ListNode* decorators
|
||||
#endif
|
||||
)
|
||||
ClassField(ParseNode* name, ParseNode* initializer, bool isStatic)
|
||||
: BinaryNode(ParseNodeKind::ClassField, initializer->pn_pos, name,
|
||||
initializer),
|
||||
isStatic_(isStatic) {
|
||||
}
|
||||
isStatic_(isStatic) {}
|
||||
|
||||
static bool test(const ParseNode& node) {
|
||||
bool match = node.isKind(ParseNodeKind::ClassField);
|
||||
|
@ -2283,10 +2249,6 @@ class ClassField : public BinaryNode {
|
|||
FunctionNode* initializer() const { return &right()->as<FunctionNode>(); }
|
||||
|
||||
bool isStatic() const { return isStatic_; }
|
||||
|
||||
#ifdef ENABLE_DECORATORS
|
||||
ListNode* decorators() const { return decorators_; }
|
||||
#endif
|
||||
};
|
||||
|
||||
// Hold onto the function generated for a class static block like
|
||||
|
@ -2414,23 +2376,11 @@ class ClassNode : public TernaryNode {
|
|||
return &innerScope()->scopeBody()->as<ClassBodyScopeNode>();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DECORATORS
|
||||
ListNode* decorators_;
|
||||
#endif
|
||||
|
||||
public:
|
||||
ClassNode(ParseNode* names, ParseNode* heritage,
|
||||
LexicalScopeNode* memberBlock,
|
||||
#ifdef ENABLE_DECORATORS
|
||||
ListNode* decorators,
|
||||
#endif
|
||||
const TokenPos& pos)
|
||||
: TernaryNode(ParseNodeKind::ClassDecl, names, heritage, memberBlock, pos)
|
||||
#ifdef ENABLE_DECORATORS
|
||||
,
|
||||
decorators_(decorators)
|
||||
#endif
|
||||
{
|
||||
LexicalScopeNode* memberBlock, const TokenPos& pos)
|
||||
: TernaryNode(ParseNodeKind::ClassDecl, names, heritage, memberBlock,
|
||||
pos) {
|
||||
MOZ_ASSERT(innerScope()->scopeBody()->is<ClassBodyScopeNode>());
|
||||
MOZ_ASSERT_IF(names, names->is<ClassNames>());
|
||||
}
|
||||
|
@ -2458,9 +2408,6 @@ class ClassNode : public TernaryNode {
|
|||
ClassBodyScopeNode* scope = bodyScope();
|
||||
return scope->isEmptyScope() ? nullptr : scope;
|
||||
}
|
||||
#ifdef ENABLE_DECORATORS
|
||||
ListNode* decorators() const { return decorators_; }
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -7630,80 +7630,6 @@ static AccessorType ToAccessorType(PropertyType propType) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DECORATORS
|
||||
template <class ParseHandler, typename Unit>
|
||||
typename ParseHandler::ListNodeType
|
||||
GeneralParser<ParseHandler, Unit>::decoratorList(YieldHandling yieldHandling) {
|
||||
ListNodeType decorators =
|
||||
handler_.newList(ParseNodeKind::DecoratorList, pos());
|
||||
|
||||
// Build a decorator list element. At each entry point to this loop we have
|
||||
// already consumed the |@| token
|
||||
TokenKind tt;
|
||||
for (;;) {
|
||||
if (!tokenStream.getToken(&tt, TokenStream::SlashIsInvalid)) {
|
||||
return null();
|
||||
}
|
||||
|
||||
Node decorator = null();
|
||||
if (tt == TokenKind::LeftParen) {
|
||||
// Handle DecoratorParenthesizedExpression
|
||||
decorator = exprInParens(InAllowed, yieldHandling, TripledotProhibited);
|
||||
if (!decorator) {
|
||||
return null();
|
||||
}
|
||||
|
||||
if (!mustMatchToken(TokenKind::RightParen, JSMSG_PAREN_AFTER_DECORATOR)) {
|
||||
return null();
|
||||
}
|
||||
|
||||
if (!tokenStream.getToken(&tt)) {
|
||||
return null();
|
||||
}
|
||||
} else {
|
||||
// Get decorator identifier
|
||||
if (!(tt == TokenKind::Name || TokenKindIsContextualKeyword(tt))) {
|
||||
error(JSMSG_DECORATOR_NAME_EXPECTED);
|
||||
return null();
|
||||
}
|
||||
TaggedParserAtomIndex name = anyChars.currentName();
|
||||
if (!tokenStream.getToken(&tt)) {
|
||||
return null();
|
||||
}
|
||||
|
||||
if (tt == TokenKind::LeftParen) {
|
||||
// Handle DecoratorCallExpression
|
||||
Node decoratorName = handler_.newName(name, pos());
|
||||
bool isSpread = false;
|
||||
Node args = argumentList(yieldHandling, &isSpread);
|
||||
if (!args) {
|
||||
return null();
|
||||
}
|
||||
decorator = handler_.newCall(decoratorName, args,
|
||||
isSpread ? JSOp::SpreadCall : JSOp::Call);
|
||||
|
||||
if (!tokenStream.getToken(&tt)) {
|
||||
return null();
|
||||
}
|
||||
} else {
|
||||
// Handle DecoratorMemberExpression
|
||||
// TODO: Bug 1784513, handle decorator member expressions with `.` in
|
||||
// them.
|
||||
decorator = handler_.newName(name, pos());
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(decorator, "Decorator should exist");
|
||||
handler_.addList(decorators, decorator);
|
||||
|
||||
if (tt != TokenKind::At) {
|
||||
anyChars.ungetToken();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return decorators;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class ParseHandler, typename Unit>
|
||||
bool GeneralParser<ParseHandler, Unit>::classMember(
|
||||
YieldHandling yieldHandling, const ParseContext::ClassStatement& classStmt,
|
||||
|
@ -7725,20 +7651,6 @@ bool GeneralParser<ParseHandler, Unit>::classMember(
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DECORATORS
|
||||
ListNodeType decorators;
|
||||
if (tt == TokenKind::At) {
|
||||
decorators = decoratorList(yieldHandling);
|
||||
if (!decorators) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!tokenStream.getToken(&tt, TokenStream::SlashIsInvalid)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool isStatic = false;
|
||||
if (tt == TokenKind::Static) {
|
||||
if (!tokenStream.peekToken(&tt)) {
|
||||
|
@ -7833,12 +7745,7 @@ bool GeneralParser<ParseHandler, Unit>::classMember(
|
|||
}
|
||||
|
||||
ClassFieldType field =
|
||||
handler_.newClassFieldDefinition(propName, initializer, isStatic
|
||||
#ifdef ENABLE_DECORATORS
|
||||
,
|
||||
decorators
|
||||
#endif
|
||||
);
|
||||
handler_.newClassFieldDefinition(propName, initializer, isStatic);
|
||||
if (!field) {
|
||||
return false;
|
||||
}
|
||||
|
@ -8000,13 +7907,8 @@ bool GeneralParser<ParseHandler, Unit>::classMember(
|
|||
}
|
||||
}
|
||||
|
||||
Node method = handler_.newClassMethodDefinition(propName, funNode, atype,
|
||||
isStatic, initializerIfPrivate
|
||||
#ifdef ENABLE_DECORATORS
|
||||
,
|
||||
decorators
|
||||
#endif
|
||||
);
|
||||
Node method = handler_.newClassMethodDefinition(
|
||||
propName, funNode, atype, isStatic, initializerIfPrivate);
|
||||
if (!method) {
|
||||
return false;
|
||||
}
|
||||
|
@ -8100,28 +8002,7 @@ typename ParseHandler::ClassNodeType
|
|||
GeneralParser<ParseHandler, Unit>::classDefinition(
|
||||
YieldHandling yieldHandling, ClassContext classContext,
|
||||
DefaultHandling defaultHandling) {
|
||||
#ifdef ENABLE_DECORATORS
|
||||
MOZ_ASSERT(anyChars.isCurrentTokenType(TokenKind::At) ||
|
||||
anyChars.isCurrentTokenType(TokenKind::Class));
|
||||
|
||||
ListNodeType decorators = null();
|
||||
if (anyChars.isCurrentTokenType(TokenKind::At)) {
|
||||
decorators = decoratorList(yieldHandling);
|
||||
if (!decorators) {
|
||||
return null();
|
||||
}
|
||||
TokenKind next;
|
||||
if (!tokenStream.getToken(&next)) {
|
||||
return null();
|
||||
}
|
||||
if (next != TokenKind::Class) {
|
||||
error(JSMSG_CLASS_EXPECTED);
|
||||
return null();
|
||||
}
|
||||
}
|
||||
#else
|
||||
MOZ_ASSERT(anyChars.isCurrentTokenType(TokenKind::Class));
|
||||
#endif
|
||||
|
||||
uint32_t classStartOffset = pos().begin;
|
||||
bool savedStrictness = setLocalStrictMode(true);
|
||||
|
@ -8334,9 +8215,6 @@ GeneralParser<ParseHandler, Unit>::classDefinition(
|
|||
}
|
||||
|
||||
return handler_.newClass(nameNode, classHeritage, classBlock,
|
||||
#ifdef ENABLE_DECORATORS
|
||||
decorators,
|
||||
#endif
|
||||
TokenPos(classStartOffset, classEndOffset));
|
||||
}
|
||||
|
||||
|
@ -9459,12 +9337,7 @@ GeneralParser<ParseHandler, Unit>::statementListItem(
|
|||
case TokenKind::Function:
|
||||
return functionStmt(pos().begin, yieldHandling, NameRequired);
|
||||
|
||||
// DecoratorList[?Yield, ?Await] opt ClassDeclaration[?Yield, ~Default]
|
||||
#ifdef ENABLE_DECORATORS
|
||||
case TokenKind::At:
|
||||
return classDefinition(yieldHandling, ClassExpression, NameRequired);
|
||||
#endif
|
||||
|
||||
// ClassDeclaration[?Yield, ~Default]
|
||||
case TokenKind::Class:
|
||||
return classDefinition(yieldHandling, ClassStatement, NameRequired);
|
||||
|
||||
|
@ -12542,11 +12415,6 @@ typename ParseHandler::Node GeneralParser<ParseHandler, Unit>::primaryExpr(
|
|||
return tupleLiteral(yieldHandling);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_DECORATORS
|
||||
case TokenKind::At:
|
||||
return classDefinition(yieldHandling, ClassExpression, NameRequired);
|
||||
#endif
|
||||
|
||||
case TokenKind::LeftParen: {
|
||||
TokenKind next;
|
||||
if (!tokenStream.peekToken(&next, TokenStream::SlashIsRegExp)) {
|
||||
|
|
|
@ -1271,7 +1271,6 @@ class MOZ_STACK_CLASS GeneralParser : public PerHandlerParser<ParseHandler> {
|
|||
ClassNodeType classDefinition(YieldHandling yieldHandling,
|
||||
ClassContext classContext,
|
||||
DefaultHandling defaultHandling);
|
||||
|
||||
struct ClassInitializedMembers {
|
||||
// The number of instance class fields.
|
||||
size_t instanceFields = 0;
|
||||
|
@ -1298,9 +1297,6 @@ class MOZ_STACK_CLASS GeneralParser : public PerHandlerParser<ParseHandler> {
|
|||
return privateMethods > 0 || privateAccessors > 0;
|
||||
}
|
||||
};
|
||||
#ifdef ENABLE_DECORATORS
|
||||
ListNodeType decoratorList(YieldHandling yieldHandling);
|
||||
#endif
|
||||
[[nodiscard]] bool classMember(
|
||||
YieldHandling yieldHandling,
|
||||
const ParseContext::ClassStatement& classStmt,
|
||||
|
|
|
@ -332,9 +332,6 @@ class SyntaxParseHandler {
|
|||
return NodeGeneric;
|
||||
}
|
||||
ClassNodeType newClass(Node name, Node heritage, Node methodBlock,
|
||||
#ifdef ENABLE_DECORATORS
|
||||
ListNodeType decorators,
|
||||
#endif
|
||||
const TokenPos& pos) {
|
||||
return NodeGeneric;
|
||||
}
|
||||
|
@ -388,22 +385,12 @@ class SyntaxParseHandler {
|
|||
}
|
||||
[[nodiscard]] Node newClassMethodDefinition(
|
||||
Node key, FunctionNodeType funNode, AccessorType atype, bool isStatic,
|
||||
mozilla::Maybe<FunctionNodeType> initializerIfPrivate
|
||||
#ifdef ENABLE_DECORATORS
|
||||
,
|
||||
ListNodeType decorators
|
||||
#endif
|
||||
) {
|
||||
mozilla::Maybe<FunctionNodeType> initializerIfPrivate) {
|
||||
return NodeGeneric;
|
||||
}
|
||||
[[nodiscard]] Node newClassFieldDefinition(Node name,
|
||||
FunctionNodeType initializer,
|
||||
bool isStatic
|
||||
#ifdef ENABLE_DECORATORS
|
||||
,
|
||||
ListNodeType decorators
|
||||
#endif
|
||||
) {
|
||||
bool isStatic) {
|
||||
return NodeGeneric;
|
||||
}
|
||||
|
||||
|
|
|
@ -123,14 +123,13 @@
|
|||
MACRO(Import, "keyword 'import'") \
|
||||
MACRO(Class, "keyword 'class'") \
|
||||
MACRO(Extends, "keyword 'extends'") \
|
||||
IF_DECORATORS(MACRO(Accessor, "keyword 'accessor'")) \
|
||||
MACRO(Super, "keyword 'super'") \
|
||||
RANGE(KeywordLast, Super) \
|
||||
\
|
||||
/* contextual keywords */ \
|
||||
MACRO(As, "'as'") \
|
||||
RANGE(ContextualKeywordFirst, As) \
|
||||
/* TODO: Move to alphabetical order when IF_DECORATORS is removed */ \
|
||||
IF_DECORATORS(MACRO(Accessor, "'accessor'")) \
|
||||
MACRO(Assert, "'assert'") \
|
||||
MACRO(Async, "'async'") \
|
||||
MACRO(Await, "'await'") \
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
// |reftest| skip-if(!getBuildConfiguration()['decorators'])
|
||||
|
||||
Reflect.parse("class c {@dec1 field = false;}");
|
||||
Reflect.parse("class c {@dec1 @dec2 @dec3 field = false;}");
|
||||
Reflect.parse("class c {@dec1 @dec2 @dec3('a') static field = false;}");
|
||||
Reflect.parse("class c {@dec1 method() {};}");
|
||||
Reflect.parse("class c {@dec1 @dec2 @dec3 method() {};}");
|
||||
Reflect.parse("class c {@dec1 @dec2 @dec3 static method() {};}");
|
||||
Reflect.parse("class c {@dec1 @dec2('a') @dec3 method(...args) {};}");
|
||||
Reflect.parse("class c {@((a, b, c) => {}) method(a, b) {};}");
|
||||
Reflect.parse("class c {@((a, b, c) => {}) @dec2('a', 'b') @dec3 method(a, b) {};}");
|
||||
Reflect.parse("@dec1 class c {}");
|
||||
Reflect.parse("@dec1 @dec2 @dec3 class c {}");
|
||||
Reflect.parse("@dec1('a') @(() => {}) @dec3 class c {}");
|
||||
Reflect.parse("@dec1('a') @(() => {}) @dec3 class c {@((a, b, c) => {}) @dec2('a', 'b') @dec3 method(a, b) {};}");
|
||||
Reflect.parse("x = @dec class { #x }");
|
||||
Reflect.parse("x = (class A { }, @dec class { })");
|
||||
Reflect.parse("@dec1 class A extends @dec2 class B extends @dec3 class {} {} {}");
|
||||
|
||||
assertThrowsInstanceOf(() => Reflect.parse("class c {@ method() {};}"), SyntaxError);
|
||||
assertThrowsInstanceOf(() => Reflect.parse("class c {@((a, b, c => {}) method(a, b) {};}"), SyntaxError);
|
||||
assertThrowsInstanceOf(() => Reflect.parse("class c {@dec1 static @dec2 method(a, b) {};}"), SyntaxError);
|
||||
assertThrowsInstanceOf(() => Reflect.parse("@dec1 let x = 1"), SyntaxError);
|
||||
assertThrowsInstanceOf(() => Reflect.parse("@dec1 f(a) {}"), SyntaxError);
|
||||
assertThrowsInstanceOf(() => Reflect.parse("@dec1 () => {}"), SyntaxError);
|
||||
assertThrowsInstanceOf(() => Reflect.parse("@class class { x; }"), SyntaxError);
|
||||
assertThrowsInstanceOf(() => Reflect.parse("@for class { x; }"), SyntaxError);
|
||||
|
||||
if (typeof reportCompare === "function") reportCompare(0, 0);
|
Загрузка…
Ссылка в новой задаче