Treat line ending after yield keyword as end of YieldExpression

(as per http://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-evaluation).
This commit is contained in:
Ingvar Stepanyan
2014-07-27 04:24:26 +03:00
committed by Marijn Haverbeke
parent 9d552efe45
commit acbef8557f
3 changed files with 139 additions and 42 deletions

View File

@@ -6138,6 +6138,86 @@ test("(function* () { yield v })", {
locations: true
});
test("(function* () { yield\nv })", {
type: "Program",
body: [{
type: "ExpressionStatement",
expression: {
type: "FunctionExpression",
id: null,
params: [],
defaults: [],
body: {
type: "BlockStatement",
body: [
{
type: "ExpressionStatement",
expression: {
type: "YieldExpression",
argument: null,
delegate: false,
range: [16, 21],
loc: {
start: {line: 1, column: 16},
end: {line: 1, column: 21}
}
},
range: [16, 21],
loc: {
start: {line: 1, column: 16},
end: {line: 1, column: 21}
}
},
{
type: "ExpressionStatement",
expression: {
type: "Identifier",
name: "v",
range: [22, 23],
loc: {
start: {line: 2, column: 0},
end: {line: 2, column: 1}
}
},
range: [22, 23],
loc: {
start: {line: 2, column: 0},
end: {line: 2, column: 1}
}
}
],
range: [14, 25],
loc: {
start: {line: 1, column: 14},
end: {line: 2, column: 3}
}
},
rest: null,
generator: true,
expression: false,
range: [0, 26],
loc: {
start: {line: 1, column: 0},
end: {line: 2, column: 4}
}
},
range: [0, 26],
loc: {
start: {line: 1, column: 0},
end: {line: 2, column: 4}
}
}],
range: [0, 26],
loc: {
start: {line: 1, column: 0},
end: {line: 2, column: 4}
}
}, {
ecmaVersion: 6,
ranges: true,
locations: true
});
test("(function* () { yield *v })", {
type: "Program",
body: [{