Backed out changeset 1a71f73b9b7d due to bustage.

This commit is contained in:
Nicholas Nethercote 2013-03-25 18:03:59 -07:00
Родитель a314e7e543
Коммит 7654afc995
4 изменённых файлов: 16 добавлений и 51 удалений

Просмотреть файл

@ -46,7 +46,7 @@ ParseContext<ParseHandler>::ParseContext(Parser<ParseHandler> *prs, SharedContex
decls_(prs->context),
args_(prs->context),
vars_(prs->context),
yieldOffset(0),
yieldNode(ParseHandler::null()),
parserPC(&prs->pc),
lexdeps(prs->context),
parent(prs->pc),

Просмотреть файл

@ -332,9 +332,12 @@ ParseContext<ParseHandler>::generateFunctionBindings(JSContext *cx, InternalHand
template <typename ParseHandler>
bool
Parser<ParseHandler>::report(ParseReportKind kind, bool strict, uint32_t offset,
unsigned errorNumber, va_list args)
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 = false;
switch (kind) {
case ParseError:
@ -351,30 +354,6 @@ Parser<ParseHandler>::report(ParseReportKind kind, bool strict, uint32_t offset,
result = tokenStream.reportStrictModeErrorNumberVA(offset, strict, errorNumber, args);
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);
return result;
}
@ -2903,7 +2882,7 @@ Parser<ParseHandler>::returnOrYield(bool useAssignExpr)
pc->sc->asFunctionBox()->setIsGenerator();
} else {
pc->yieldCount++;
pc->yieldOffset = handler.getPosition(pn).begin;
pc->yieldNode = pn;
}
}
#endif
@ -5236,7 +5215,7 @@ class GenexpGuard
ParseContext<ParseHandler> *pc = parser->pc;
if (pc->parenDepth == 0) {
pc->yieldCount = 0;
pc->yieldOffset = 0;
pc->yieldNode = ParseHandler::null();
}
startYieldCount = pc->yieldCount;
pc->parenDepth++;
@ -5267,12 +5246,10 @@ GenexpGuard<ParseHandler>::checkValidBody(Node pn, unsigned err)
{
ParseContext<ParseHandler> *pc = parser->pc;
if (pc->yieldCount > startYieldCount) {
uint32_t offset = pc->yieldOffset
? pc->yieldOffset
: (pn ? parser->handler.getPosition(pn)
: parser->tokenStream.currentToken().pos).begin;
parser->reportWithOffset(ParseError, false, offset, err, js_yield_str);
Node errorNode = pc->yieldNode;
if (!errorNode)
errorNode = pn;
parser->report(ParseError, false, errorNode, err, js_yield_str);
return false;
}

Просмотреть файл

@ -155,10 +155,10 @@ struct ParseContext /* tree context for semantic checks */
bool generateFunctionBindings(JSContext *cx, InternalHandle<Bindings*> bindings) const;
public:
uint32_t yieldOffset; /* offset of a yield expression that might
be an error if we turn out to be inside
a generator expression. Zero means
there isn't one. */
Node yieldNode; /* parse node for a yield expression that might
be an error if we turn out to be inside a
generator expression */
private:
ParseContext **parserPC; /* this points to the Parser's active pc
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. */
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 reportWithOffset(ParseReportKind kind, bool strict, uint32_t offset, unsigned errorNumber,
...);
Parser(JSContext *cx, const CompileOptions &options,
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) {}