Bug 666399 - New Harmony syntax for generators. r=Waldo

Add a GeneratorKind enumeration, and use it in the parser and runtime to
indicate whether a function is a non-generator, a legacy generator, or a
star generator.

Always parse "yield" as TOK_YIELD, regardless of the version.  Add
TokenStream::currentName() to retrieve the current token's name, which
works for TOK_NAME or TOK_YIELD.  The parser should check the validity
of "yield" as a name, if needed, using checkYieldNameValidity().

Parse "function*" as the StarGenerator GeneratorKind, and allow star
generators to be lazily parsed.

Separate parsing of return statements from yield expressions.
This commit is contained in:
Andy Wingo
2013-08-20 11:03:24 +02:00
parent 0d4adcb8f7
commit c9c35ef7bb
23 changed files with 605 additions and 212 deletions

View File

@@ -104,7 +104,6 @@ const char js_typeof_str[] = "typeof";
const char js_void_str[] = "void";
const char js_while_str[] = "while";
const char js_with_str[] = "with";
const char js_yield_str[] = "yield";
/*
* For a browser build from 2007-08-09 after the browser starts up there are