зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 1a71f73b9b7d due to bustage.
This commit is contained in:
Родитель
a314e7e543
Коммит
7654afc995
|
@ -46,7 +46,7 @@ ParseContext<ParseHandler>::ParseContext(Parser<ParseHandler> *prs, SharedContex
|
||||||
decls_(prs->context),
|
decls_(prs->context),
|
||||||
args_(prs->context),
|
args_(prs->context),
|
||||||
vars_(prs->context),
|
vars_(prs->context),
|
||||||
yieldOffset(0),
|
yieldNode(ParseHandler::null()),
|
||||||
parserPC(&prs->pc),
|
parserPC(&prs->pc),
|
||||||
lexdeps(prs->context),
|
lexdeps(prs->context),
|
||||||
parent(prs->pc),
|
parent(prs->pc),
|
||||||
|
|
|
@ -332,9 +332,12 @@ ParseContext<ParseHandler>::generateFunctionBindings(JSContext *cx, InternalHand
|
||||||
|
|
||||||
template <typename ParseHandler>
|
template <typename ParseHandler>
|
||||||
bool
|
bool
|
||||||
Parser<ParseHandler>::report(ParseReportKind kind, bool strict, uint32_t offset,
|
Parser<ParseHandler>::report(ParseReportKind kind, bool strict, Node pn, unsigned errorNumber, ...)
|
||||||
unsigned errorNumber, va_list args)
|
|
||||||
{
|
{
|
||||||
|
uint32_t offset = (pn ? handler.getPosition(pn) : tokenStream.currentToken().pos).begin;
|
||||||
|
|
||||||
|
va_list args;
|
||||||
|
va_start(args, errorNumber);
|
||||||
bool result = false;
|
bool result = false;
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case ParseError:
|
case ParseError:
|
||||||
|
@ -351,30 +354,6 @@ Parser<ParseHandler>::report(ParseReportKind kind, bool strict, uint32_t offset,
|
||||||
result = tokenStream.reportStrictModeErrorNumberVA(offset, strict, errorNumber, args);
|
result = tokenStream.reportStrictModeErrorNumberVA(offset, strict, errorNumber, args);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename ParseHandler>
|
|
||||||
bool
|
|
||||||
Parser<ParseHandler>::report(ParseReportKind kind, bool strict, Node pn, unsigned errorNumber, ...)
|
|
||||||
{
|
|
||||||
uint32_t offset = (pn ? handler.getPosition(pn) : tokenStream.currentToken().pos).begin;
|
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start(args, errorNumber);
|
|
||||||
bool result = report(kind, strict, offset, errorNumber, args);
|
|
||||||
va_end(args);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename ParseHandler>
|
|
||||||
bool
|
|
||||||
Parser<ParseHandler>::reportWithOffset(ParseReportKind kind, bool strict, uint32_t offset,
|
|
||||||
unsigned errorNumber, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
va_start(args, errorNumber);
|
|
||||||
bool result = report(kind, strict, offset, errorNumber, args);
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2903,7 +2882,7 @@ Parser<ParseHandler>::returnOrYield(bool useAssignExpr)
|
||||||
pc->sc->asFunctionBox()->setIsGenerator();
|
pc->sc->asFunctionBox()->setIsGenerator();
|
||||||
} else {
|
} else {
|
||||||
pc->yieldCount++;
|
pc->yieldCount++;
|
||||||
pc->yieldOffset = handler.getPosition(pn).begin;
|
pc->yieldNode = pn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -5236,7 +5215,7 @@ class GenexpGuard
|
||||||
ParseContext<ParseHandler> *pc = parser->pc;
|
ParseContext<ParseHandler> *pc = parser->pc;
|
||||||
if (pc->parenDepth == 0) {
|
if (pc->parenDepth == 0) {
|
||||||
pc->yieldCount = 0;
|
pc->yieldCount = 0;
|
||||||
pc->yieldOffset = 0;
|
pc->yieldNode = ParseHandler::null();
|
||||||
}
|
}
|
||||||
startYieldCount = pc->yieldCount;
|
startYieldCount = pc->yieldCount;
|
||||||
pc->parenDepth++;
|
pc->parenDepth++;
|
||||||
|
@ -5267,12 +5246,10 @@ GenexpGuard<ParseHandler>::checkValidBody(Node pn, unsigned err)
|
||||||
{
|
{
|
||||||
ParseContext<ParseHandler> *pc = parser->pc;
|
ParseContext<ParseHandler> *pc = parser->pc;
|
||||||
if (pc->yieldCount > startYieldCount) {
|
if (pc->yieldCount > startYieldCount) {
|
||||||
uint32_t offset = pc->yieldOffset
|
Node errorNode = pc->yieldNode;
|
||||||
? pc->yieldOffset
|
if (!errorNode)
|
||||||
: (pn ? parser->handler.getPosition(pn)
|
errorNode = pn;
|
||||||
: parser->tokenStream.currentToken().pos).begin;
|
parser->report(ParseError, false, errorNode, err, js_yield_str);
|
||||||
|
|
||||||
parser->reportWithOffset(ParseError, false, offset, err, js_yield_str);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,10 +155,10 @@ struct ParseContext /* tree context for semantic checks */
|
||||||
bool generateFunctionBindings(JSContext *cx, InternalHandle<Bindings*> bindings) const;
|
bool generateFunctionBindings(JSContext *cx, InternalHandle<Bindings*> bindings) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
uint32_t yieldOffset; /* offset of a yield expression that might
|
Node yieldNode; /* parse node for a yield expression that might
|
||||||
be an error if we turn out to be inside
|
be an error if we turn out to be inside a
|
||||||
a generator expression. Zero means
|
generator expression */
|
||||||
there isn't one. */
|
|
||||||
private:
|
private:
|
||||||
ParseContext **parserPC; /* this points to the Parser's active pc
|
ParseContext **parserPC; /* this points to the Parser's active pc
|
||||||
and holds either |this| or one of
|
and holds either |this| or one of
|
||||||
|
@ -296,13 +296,7 @@ struct Parser : private AutoGCRooter, public StrictModeGetter
|
||||||
/* State specific to the kind of parse being performed. */
|
/* State specific to the kind of parse being performed. */
|
||||||
ParseHandler handler;
|
ParseHandler handler;
|
||||||
|
|
||||||
private:
|
|
||||||
bool report(ParseReportKind kind, bool strict, uint32_t offset,
|
|
||||||
unsigned errorNumber, va_list args);
|
|
||||||
public:
|
|
||||||
bool report(ParseReportKind kind, bool strict, Node pn, unsigned errorNumber, ...);
|
bool report(ParseReportKind kind, bool strict, Node pn, unsigned errorNumber, ...);
|
||||||
bool reportWithOffset(ParseReportKind kind, bool strict, uint32_t offset, unsigned errorNumber,
|
|
||||||
...);
|
|
||||||
|
|
||||||
Parser(JSContext *cx, const CompileOptions &options,
|
Parser(JSContext *cx, const CompileOptions &options,
|
||||||
const jschar *chars, size_t length, bool foldConstants);
|
const jschar *chars, size_t length, bool foldConstants);
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
// Don't assert.
|
|
||||||
try {
|
|
||||||
eval("function x(y = {\
|
|
||||||
x: (7) ? 0 : yield(0)\
|
|
||||||
}");
|
|
||||||
} catch (e) {}
|
|
Загрузка…
Ссылка в новой задаче