mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-29 18:47:31 +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)
|
if (!initializer)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!tokenStream.getToken(&tt)) {
|
if (!matchOrInsertSemicolonAfterExpression()) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(khyperia): Implement ASI
|
|
||||||
if (tt != TOK_SEMI) {
|
|
||||||
error(JSMSG_MISSING_SEMI_FIELD);
|
|
||||||
return false;
|
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
|
// 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`.
|
// (but don't consume) the next token to decide how to set `*propType`.
|
||||||
//
|
//
|
||||||
// `=` or `;` ==> PropertyType::Field (classes only)
|
|
||||||
// `=` ==> PropertyType::CoverInitializedName
|
|
||||||
// `,` or `}` ==> PropertyType::Shorthand
|
// `,` or `}` ==> PropertyType::Shorthand
|
||||||
// `(` ==> PropertyType::Method
|
// `(` ==> 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
|
// The caller must check `*propType` and throw if whatever we parsed isn't
|
||||||
// allowed here (for example, a getter in a destructuring pattern).
|
// allowed here (for example, a getter in a destructuring pattern).
|
||||||
|
|
@ -10718,17 +10713,8 @@ Parser<ParseHandler>::propertyOrMethodName(YieldHandling yieldHandling,
|
||||||
return propName;
|
return propName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (propertyNameContext == PropertyNameInClass && (tt == TOK_SEMI || tt == TOK_ASSIGN)) {
|
if (propertyNameContext != PropertyNameInClass &&
|
||||||
if (isGenerator || isAsync || isGetter || isSetter) {
|
TokenKindIsPossibleIdentifierName(ltok) &&
|
||||||
error(JSMSG_BAD_PROP_ID);
|
|
||||||
return null();
|
|
||||||
}
|
|
||||||
tokenStream.ungetToken();
|
|
||||||
*propType = PropertyType::Field;
|
|
||||||
return propName;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TokenKindIsPossibleIdentifierName(ltok) &&
|
|
||||||
(tt == TOK_COMMA || tt == TOK_RC || tt == TOK_ASSIGN))
|
(tt == TOK_COMMA || tt == TOK_RC || tt == TOK_ASSIGN))
|
||||||
{
|
{
|
||||||
if (isGenerator || isAsync || isGetter || isSetter) {
|
if (isGenerator || isAsync || isGetter || isSetter) {
|
||||||
|
|
@ -10759,6 +10745,16 @@ Parser<ParseHandler>::propertyOrMethodName(YieldHandling yieldHandling,
|
||||||
return propName;
|
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);
|
error(JSMSG_COLON_AFTER_ID);
|
||||||
return null();
|
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_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_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_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")
|
MSG_DEF(JSMSG_FIELDS_NOT_SUPPORTED, 0, JSEXN_SYNTAXERR, "fields are not currently supported")
|
||||||
|
|
||||||
// asm.js
|
// asm.js
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue