mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1296814 - Report bad-class-member errors using a specified offset instead of a node's offset. r=arai
--HG-- extra : rebase_source : 68379c893ea8d05b544a045d378e94f1be4b9305
This commit is contained in:
parent
e72e3de588
commit
29058eaa77
@ -6599,6 +6599,10 @@ Parser<ParseHandler>::classDefinition(YieldHandling yieldHandling,
|
||||
tokenStream.ungetToken();
|
||||
}
|
||||
|
||||
uint32_t nameOffset;
|
||||
if (!tokenStream.peekOffset(&nameOffset, TokenStream::KeywordIsName))
|
||||
return null();
|
||||
|
||||
PropertyType propType;
|
||||
Node propName = propertyName(yieldHandling, classMethods, &propType, &propAtom);
|
||||
if (!propName)
|
||||
@ -6609,7 +6613,7 @@ Parser<ParseHandler>::classDefinition(YieldHandling yieldHandling,
|
||||
propType != PropertyType::AsyncMethod &&
|
||||
propType != PropertyType::Constructor && propType != PropertyType::DerivedConstructor)
|
||||
{
|
||||
error(JSMSG_BAD_METHOD_DEF);
|
||||
errorAt(nameOffset, JSMSG_BAD_METHOD_DEF);
|
||||
return null();
|
||||
}
|
||||
|
||||
@ -6619,17 +6623,17 @@ Parser<ParseHandler>::classDefinition(YieldHandling yieldHandling,
|
||||
propType = PropertyType::SetterNoExpressionClosure;
|
||||
if (!isStatic && propAtom == context->names().constructor) {
|
||||
if (propType != PropertyType::Method) {
|
||||
reportWithNode(ParseError, false, propName, JSMSG_BAD_METHOD_DEF);
|
||||
errorAt(nameOffset, JSMSG_BAD_METHOD_DEF);
|
||||
return null();
|
||||
}
|
||||
if (seenConstructor) {
|
||||
reportWithNode(ParseError, false, propName, JSMSG_DUPLICATE_PROPERTY, "constructor");
|
||||
errorAt(nameOffset, JSMSG_DUPLICATE_PROPERTY, "constructor");
|
||||
return null();
|
||||
}
|
||||
seenConstructor = true;
|
||||
propType = hasHeritage ? PropertyType::DerivedConstructor : PropertyType::Constructor;
|
||||
} else if (isStatic && propAtom == context->names().prototype) {
|
||||
reportWithNode(ParseError, false, propName, JSMSG_BAD_METHOD_DEF);
|
||||
errorAt(nameOffset, JSMSG_BAD_METHOD_DEF);
|
||||
return null();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user