Added es5 conformance tests for async arrow functions, add error for referencing 'arguments' in a generator.

This commit is contained in:
Ron Buckton
2016-06-27 17:34:19 -07:00
parent 203dab4412
commit 644e4dacaf
53 changed files with 596 additions and 3 deletions
+5 -2
View File
@@ -8162,10 +8162,13 @@ namespace ts {
// can explicitly bound arguments objects
if (symbol === argumentsSymbol) {
const container = getContainingFunction(node);
if (container.kind === SyntaxKind.ArrowFunction) {
if (languageVersion < ScriptTarget.ES6) {
if (languageVersion < ScriptTarget.ES6) {
if (container.kind === SyntaxKind.ArrowFunction) {
error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
}
else if (hasModifier(container, ModifierFlags.Async)) {
error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method);
}
}
if (node.flags & NodeFlags.AwaitContext) {
+1 -1
View File
@@ -1695,7 +1695,7 @@
"category": "Error",
"code": 2521
},
"The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression.": {
"The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method.": {
"category": "Error",
"code": 2522
},