class: center, middle # The Test that Should Not Be --- class: center, middle # Background: Grammar Conventions --- # Grammar Production Parameters > ### 5.1.5 Grammar Notation > > [...] > > A production may be parameterized by a subscripted annotation of the form > "
[parameters]
", which may appear as a suffix to the nonterminal > symbol defined by the production. “parameters” may be either a single name or a > comma separated list of names. A parameterized production is shorthand for a > set of productions defining all combinations of the parameter names, preceded > by an underscore, appended to the parameterized nonterminal symbol. --- # Grammar Production Parameters > This means that: > >
>
StatementList
[Return]
>
ReturnStatement
>
ExpressionStatement
>
> > is a convenient abbreviation for: > >
>
StatementList
>
ReturnStatement
>
ExpressionStatement
>
StatementList_Return
>
ReturnStatement
>
ExpressionStatement
>
--- # Grammar Production Parameters > and that: > >
>
StatementList
[Return, In]
>
ReturnStatement
>
ExpressionStatement
>
> > is an abbreviation for: > >
StatementList
>
ReturnStatement
>
ExpressionStatement
>
StatementList_Return
>
ReturnStatement
>
ExpressionStatement
>
StatementList_In
>
ReturnStatement
>
ExpressionStatement
>
StatementList_Return_In
>
ReturnStatement
>
ExpressionStatement
> --- # Apparent Origins From the ECMAScript 5 spec: >
>
RelationalExpression
>
ShiftExpression
>
RelationalExpression
<
ShiftExpression
>
RelationalExpression
>
ShiftExpression
>
RelationalExpression
<=
ShiftExpression
>
RelationalExpression
>=
ShiftExpression
>
RelationalExpression
instanceof
ShiftExpression
>
RelationalExpression
in
ShiftExpression
>
RelationalExpressionNoIn
>
ShiftExpression
>
RelationalExpressionNoIn
<
ShiftExpression
>
RelationalExpressionNoIn
>
ShiftExpression
>
RelationalExpressionNoIn
<=
ShiftExpression
>
RelationalExpressionNoIn
>=
ShiftExpression
>
RelationalExpressionNoIn
instanceof
ShiftExpression
>
--- class: center, middle # The Grammer Under Test --- class: middle > ## [14.4](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions) Generator Function Definitions > > Syntax > >
>
GeneratorMethod
[Yield]
>
>
*
PropertyName
[?Yield]
>
(
StrictFormalParameters
[Yield,GeneratorParameter]
>
)
{
GeneratorBody
}
>
>
--- class: center, middle # The Test that Should Not Be --- ```js // Copyright (C) 2015 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- description: > When the `yield` keyword occurs within the Initializer of a SingleNameBinding witihn the FormalParameters of a GeneratorMethod, it behaves as a YieldExpression. es6id: 14.4 features: [generators] flags: [noStrict] ---*/ var yield = 'defaultViaIdentifier'; var obj; var iter = (function*() { obj = { *method(x = yield) { return x; } }; }()); iter.next(); iter.next('defaultViaExpression'); assert.sameValue(obj.method().next().value, 'defaultViaExpression'); ``` --- class: center, middle ![](img/twitter-p1.png) --- class: center, middle ![](img/twitter-p2.png) --- class: center, middle ![](img/twitter-p3.png) ---
--- class: center, middle # The Test that Should Not Be --- class: center, middle # The Test that Should Not Be (and Isn't)