mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 17:31:47 +09:00
parent
014953c532
commit
447261cf87
2 changed files with 16 additions and 21 deletions
|
|
@ -7485,13 +7485,7 @@ Parser<ParseHandler>::classMember(YieldHandling yieldHandling, DefaultHandling d
|
|||
if (!initializer)
|
||||
return false;
|
||||
|
||||
if (!tokenStream.getToken(&tt)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO(khyperia): Implement ASI
|
||||
if (tt != TOK_SEMI) {
|
||||
error(JSMSG_MISSING_SEMI_FIELD);
|
||||
if (!matchOrInsertSemicolonAfterExpression()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -10639,10 +10633,11 @@ Parser<ParseHandler>::propertyOrMethodName(YieldHandling yieldHandling,
|
|||
// In the last case, where there's not a `:` token to consume, we peek at
|
||||
// (but don't consume) the next token to decide how to set `*propType`.
|
||||
//
|
||||
// `=` or `;` ==> PropertyType::Field (classes only)
|
||||
// `=` ==> PropertyType::CoverInitializedName
|
||||
// `,` or `}` ==> PropertyType::Shorthand
|
||||
// `(` ==> PropertyType::Method
|
||||
// `=`, not in a class ==> PropertyType::CoverInitializedName
|
||||
// '=', in a class ==> PropertyType::Field
|
||||
// any token, in a class ==> PropertyType::Field (ASI)
|
||||
//
|
||||
// The caller must check `*propType` and throw if whatever we parsed isn't
|
||||
// allowed here (for example, a getter in a destructuring pattern).
|
||||
|
|
@ -10718,17 +10713,8 @@ Parser<ParseHandler>::propertyOrMethodName(YieldHandling yieldHandling,
|
|||
return propName;
|
||||
}
|
||||
|
||||
if (propertyNameContext == PropertyNameInClass && (tt == TOK_SEMI || tt == TOK_ASSIGN)) {
|
||||
if (isGenerator || isAsync || isGetter || isSetter) {
|
||||
error(JSMSG_BAD_PROP_ID);
|
||||
return null();
|
||||
}
|
||||
tokenStream.ungetToken();
|
||||
*propType = PropertyType::Field;
|
||||
return propName;
|
||||
}
|
||||
|
||||
if (TokenKindIsPossibleIdentifierName(ltok) &&
|
||||
if (propertyNameContext != PropertyNameInClass &&
|
||||
TokenKindIsPossibleIdentifierName(ltok) &&
|
||||
(tt == TOK_COMMA || tt == TOK_RC || tt == TOK_ASSIGN))
|
||||
{
|
||||
if (isGenerator || isAsync || isGetter || isSetter) {
|
||||
|
|
@ -10759,6 +10745,16 @@ Parser<ParseHandler>::propertyOrMethodName(YieldHandling yieldHandling,
|
|||
return propName;
|
||||
}
|
||||
|
||||
if (propertyNameContext == PropertyNameInClass) {
|
||||
if (isGenerator || isAsync || isGetter || isSetter) {
|
||||
error(JSMSG_BAD_PROP_ID);
|
||||
return null();
|
||||
}
|
||||
tokenStream.ungetToken();
|
||||
*propType = PropertyType::Field;
|
||||
return propName;
|
||||
}
|
||||
|
||||
error(JSMSG_COLON_AFTER_ID);
|
||||
return null();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -362,7 +362,6 @@ MSG_DEF(JSMSG_BAD_NEWTARGET, 0, JSEXN_SYNTAXERR, "new.target only allo
|
|||
MSG_DEF(JSMSG_BAD_NEW_OPTIONAL, 0, JSEXN_SYNTAXERR, "new keyword cannot be used with an optional chain")
|
||||
MSG_DEF(JSMSG_BAD_OPTIONAL_TEMPLATE, 0, JSEXN_SYNTAXERR, "tagged template cannot be used with optional chain")
|
||||
MSG_DEF(JSMSG_ESCAPED_KEYWORD, 0, JSEXN_SYNTAXERR, "keywords must be written literally, without embedded escapes")
|
||||
MSG_DEF(JSMSG_MISSING_SEMI_FIELD, 0, JSEXN_SYNTAXERR, "missing ; after field definition")
|
||||
MSG_DEF(JSMSG_FIELDS_NOT_SUPPORTED, 0, JSEXN_SYNTAXERR, "fields are not currently supported")
|
||||
|
||||
// asm.js
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue