mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-13 14:09:06 -05:00
Merge pull request #2802 from Microsoft/allowArrowArgumentsES6
Only error in ES3 and ES5 when using 'arguments' in an arrow function
This commit is contained in:
@@ -5404,8 +5404,8 @@ module ts {
|
||||
// will be bound to non-arrow function that contain this arrow function. This results in inconsistent behavior.
|
||||
// To avoid that we will give an error to users if they use arguments objects in arrow function so that they
|
||||
// can explicitly bound arguments objects
|
||||
if (symbol === argumentsSymbol && getContainingFunction(node).kind === SyntaxKind.ArrowFunction) {
|
||||
error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression);
|
||||
if (symbol === argumentsSymbol && getContainingFunction(node).kind === SyntaxKind.ArrowFunction && languageVersion < ScriptTarget.ES6) {
|
||||
error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
|
||||
}
|
||||
|
||||
if (symbol.flags & SymbolFlags.Alias && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// <auto-generated />
|
||||
/// <reference path="types.ts" />
|
||||
/* @internal */
|
||||
module ts {
|
||||
export var Diagnostics = {
|
||||
Unterminated_string_literal: { code: 1002, category: DiagnosticCategory.Error, key: "Unterminated string literal." },
|
||||
@@ -357,7 +358,7 @@ module ts {
|
||||
Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: DiagnosticCategory.Error, key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." },
|
||||
Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: DiagnosticCategory.Error, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." },
|
||||
Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type or a string type." },
|
||||
The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." },
|
||||
The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { code: 2496, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression." },
|
||||
External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." },
|
||||
External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." },
|
||||
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
|
||||
|
||||
@@ -1419,7 +1419,7 @@
|
||||
"category": "Error",
|
||||
"code": 2495
|
||||
},
|
||||
"The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": {
|
||||
"The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.": {
|
||||
"category": "Error",
|
||||
"code": 2496
|
||||
},
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts(2,15): error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts(7,19): error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts(13,13): error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts(19,15): error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments01.ts(2,15): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments01.ts(7,19): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments01.ts(13,13): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments01.ts(19,15): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts (4 errors) ====
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments01.ts (4 errors) ====
|
||||
var a = () => {
|
||||
var arg = arguments[0]; // error
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
|
||||
var b = function () {
|
||||
var a = () => {
|
||||
var arg = arguments[0]; // error
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts
|
||||
() => {
|
||||
var arg = arguments[0];
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts
|
||||
foo(() => {
|
||||
var arg = arguments[0]; // error
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
});
|
||||
|
||||
function bar() {
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [emitArrowFunctionWhenUsingArgumentsES6.ts]
|
||||
//// [emitArrowFunctionWhenUsingArguments01.ts]
|
||||
var a = () => {
|
||||
var arg = arguments[0]; // error
|
||||
}
|
||||
@@ -31,28 +31,28 @@ function bar() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArgumentsES6.js]
|
||||
var a = () => {
|
||||
//// [emitArrowFunctionWhenUsingArguments01.js]
|
||||
var a = function () {
|
||||
var arg = arguments[0]; // error
|
||||
};
|
||||
var b = function () {
|
||||
var a = () => {
|
||||
var a = function () {
|
||||
var arg = arguments[0]; // error
|
||||
};
|
||||
};
|
||||
function baz() {
|
||||
(() => {
|
||||
(function () {
|
||||
var arg = arguments[0];
|
||||
});
|
||||
}
|
||||
function foo(inputFunc) { }
|
||||
foo(() => {
|
||||
foo(function () {
|
||||
var arg = arguments[0]; // error
|
||||
});
|
||||
function bar() {
|
||||
var arg = arguments[0]; // no error
|
||||
}
|
||||
(() => {
|
||||
(function () {
|
||||
function foo() {
|
||||
var arg = arguments[0]; // no error
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments.ts]
|
||||
//// [emitArrowFunctionWhenUsingArguments01_ES6.ts]
|
||||
var a = () => {
|
||||
var arg = arguments[0]; // error
|
||||
}
|
||||
@@ -31,7 +31,7 @@ function bar() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments.js]
|
||||
//// [emitArrowFunctionWhenUsingArguments01_ES6.js]
|
||||
var a = () => {
|
||||
var arg = arguments[0]; // error
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments01_ES6.ts ===
|
||||
var a = () => {
|
||||
>a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 0, 3))
|
||||
|
||||
var arg = arguments[0]; // error
|
||||
>arg : Symbol(arg, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 1, 7))
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
|
||||
var b = function () {
|
||||
>b : Symbol(b, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 4, 3))
|
||||
|
||||
var a = () => {
|
||||
>a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 5, 7))
|
||||
|
||||
var arg = arguments[0]; // error
|
||||
>arg : Symbol(arg, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 6, 11))
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
}
|
||||
|
||||
function baz() {
|
||||
>baz : Symbol(baz, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 8, 1))
|
||||
|
||||
() => {
|
||||
var arg = arguments[0];
|
||||
>arg : Symbol(arg, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 12, 5))
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
}
|
||||
|
||||
function foo(inputFunc: () => void) { }
|
||||
>foo : Symbol(foo, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 14, 1))
|
||||
>inputFunc : Symbol(inputFunc, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 16, 13))
|
||||
|
||||
foo(() => {
|
||||
>foo : Symbol(foo, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 14, 1))
|
||||
|
||||
var arg = arguments[0]; // error
|
||||
>arg : Symbol(arg, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 18, 7))
|
||||
>arguments : Symbol(arguments)
|
||||
|
||||
});
|
||||
|
||||
function bar() {
|
||||
>bar : Symbol(bar, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 19, 3))
|
||||
|
||||
var arg = arguments[0]; // no error
|
||||
>arg : Symbol(arg, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 22, 7))
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
|
||||
|
||||
() => {
|
||||
function foo() {
|
||||
>foo : Symbol(foo, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 26, 7))
|
||||
|
||||
var arg = arguments[0]; // no error
|
||||
>arg : Symbol(arg, Decl(emitArrowFunctionWhenUsingArguments01_ES6.ts, 28, 5))
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments01_ES6.ts ===
|
||||
var a = () => {
|
||||
>a : () => void
|
||||
>() => { var arg = arguments[0]; // error} : () => void
|
||||
|
||||
var arg = arguments[0]; // error
|
||||
>arg : any
|
||||
>arguments[0] : any
|
||||
>arguments : IArguments
|
||||
>0 : number
|
||||
}
|
||||
|
||||
var b = function () {
|
||||
>b : () => void
|
||||
>function () { var a = () => { var arg = arguments[0]; // error }} : () => void
|
||||
|
||||
var a = () => {
|
||||
>a : () => void
|
||||
>() => { var arg = arguments[0]; // error } : () => void
|
||||
|
||||
var arg = arguments[0]; // error
|
||||
>arg : any
|
||||
>arguments[0] : any
|
||||
>arguments : IArguments
|
||||
>0 : number
|
||||
}
|
||||
}
|
||||
|
||||
function baz() {
|
||||
>baz : () => void
|
||||
|
||||
() => {
|
||||
>() => { var arg = arguments[0]; } : () => void
|
||||
|
||||
var arg = arguments[0];
|
||||
>arg : any
|
||||
>arguments[0] : any
|
||||
>arguments : IArguments
|
||||
>0 : number
|
||||
}
|
||||
}
|
||||
|
||||
function foo(inputFunc: () => void) { }
|
||||
>foo : (inputFunc: () => void) => void
|
||||
>inputFunc : () => void
|
||||
|
||||
foo(() => {
|
||||
>foo(() => { var arg = arguments[0]; // error}) : void
|
||||
>foo : (inputFunc: () => void) => void
|
||||
>() => { var arg = arguments[0]; // error} : () => void
|
||||
|
||||
var arg = arguments[0]; // error
|
||||
>arg : any
|
||||
>arguments[0] : any
|
||||
>arguments : IArguments
|
||||
>0 : number
|
||||
|
||||
});
|
||||
|
||||
function bar() {
|
||||
>bar : () => void
|
||||
|
||||
var arg = arguments[0]; // no error
|
||||
>arg : any
|
||||
>arguments[0] : any
|
||||
>arguments : IArguments
|
||||
>0 : number
|
||||
}
|
||||
|
||||
|
||||
() => {
|
||||
>() => { function foo() { var arg = arguments[0]; // no error }} : () => void
|
||||
|
||||
function foo() {
|
||||
>foo : () => void
|
||||
|
||||
var arg = arguments[0]; // no error
|
||||
>arg : any
|
||||
>arguments[0] : any
|
||||
>arguments : IArguments
|
||||
>0 : number
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments02.ts(2,15): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments02.ts (1 errors) ====
|
||||
|
||||
var a = () => arguments;
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments02.ts]
|
||||
|
||||
var a = () => arguments;
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments02.js]
|
||||
var a = function () { return arguments; };
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments02_ES6.ts]
|
||||
|
||||
var a = () => arguments;
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments02_ES6.js]
|
||||
var a = () => arguments;
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments02_ES6.ts ===
|
||||
|
||||
var a = () => arguments;
|
||||
>a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments02_ES6.ts, 1, 3))
|
||||
>arguments : Symbol(arguments)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments02_ES6.ts ===
|
||||
|
||||
var a = () => arguments;
|
||||
>a : () => IArguments
|
||||
>() => arguments : () => IArguments
|
||||
>arguments : IArguments
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments03.ts(3,15): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments03.ts (1 errors) ====
|
||||
|
||||
var arguments;
|
||||
var a = () => arguments;
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments03.ts]
|
||||
|
||||
var arguments;
|
||||
var a = () => arguments;
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments03.js]
|
||||
var arguments;
|
||||
var a = function () { return arguments; };
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments03_ES6.ts]
|
||||
|
||||
var arguments;
|
||||
var a = () => arguments;
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments03_ES6.js]
|
||||
var arguments;
|
||||
var a = () => arguments;
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments03_ES6.ts ===
|
||||
|
||||
var arguments;
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments03_ES6.ts, 1, 3))
|
||||
|
||||
var a = () => arguments;
|
||||
>a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments03_ES6.ts, 2, 3))
|
||||
>arguments : Symbol(arguments)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments03_ES6.ts ===
|
||||
|
||||
var arguments;
|
||||
>arguments : any
|
||||
|
||||
var a = () => arguments;
|
||||
>a : () => IArguments
|
||||
>() => arguments : () => IArguments
|
||||
>arguments : IArguments
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments04.ts(4,19): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments04.ts (1 errors) ====
|
||||
|
||||
function f() {
|
||||
var arguments;
|
||||
var a = () => arguments;
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments04.ts]
|
||||
|
||||
function f() {
|
||||
var arguments;
|
||||
var a = () => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments04.js]
|
||||
function f() {
|
||||
var arguments;
|
||||
var a = function () { return arguments; };
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments04_ES6.ts]
|
||||
|
||||
function f() {
|
||||
var arguments;
|
||||
var a = () => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments04_ES6.js]
|
||||
function f() {
|
||||
var arguments;
|
||||
var a = () => arguments;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments04_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments04_ES6.ts, 0, 0))
|
||||
|
||||
var arguments;
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments04_ES6.ts, 2, 7))
|
||||
|
||||
var a = () => arguments;
|
||||
>a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments04_ES6.ts, 3, 7))
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments04_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
var arguments;
|
||||
>arguments : any
|
||||
|
||||
var a = () => arguments;
|
||||
>a : () => IArguments
|
||||
>() => arguments : () => IArguments
|
||||
>arguments : IArguments
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments05.ts(3,19): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments05.ts (1 errors) ====
|
||||
|
||||
function f(arguments) {
|
||||
var a = () => arguments;
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments05.ts]
|
||||
|
||||
function f(arguments) {
|
||||
var a = () => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments05.js]
|
||||
function f(arguments) {
|
||||
var a = function () { return arguments; };
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments05_ES6.ts]
|
||||
|
||||
function f(arguments) {
|
||||
var a = () => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments05_ES6.js]
|
||||
function f(arguments) {
|
||||
var a = () => arguments;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments05_ES6.ts ===
|
||||
|
||||
function f(arguments) {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments05_ES6.ts, 0, 0))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments05_ES6.ts, 1, 11))
|
||||
|
||||
var a = () => arguments;
|
||||
>a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments05_ES6.ts, 2, 7))
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments05_ES6.ts ===
|
||||
|
||||
function f(arguments) {
|
||||
>f : (arguments: any) => void
|
||||
>arguments : any
|
||||
|
||||
var a = () => arguments;
|
||||
>a : () => IArguments
|
||||
>() => arguments : () => IArguments
|
||||
>arguments : IArguments
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments06.ts(3,25): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments06.ts (1 errors) ====
|
||||
|
||||
function f(arguments) {
|
||||
var a = () => () => arguments;
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments06.ts]
|
||||
|
||||
function f(arguments) {
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments06.js]
|
||||
function f(arguments) {
|
||||
var a = function () { return function () { return arguments; }; };
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments06_ES6.ts]
|
||||
|
||||
function f(arguments) {
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments06_ES6.js]
|
||||
function f(arguments) {
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments06_ES6.ts ===
|
||||
|
||||
function f(arguments) {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments06_ES6.ts, 0, 0))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments06_ES6.ts, 1, 11))
|
||||
|
||||
var a = () => () => arguments;
|
||||
>a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments06_ES6.ts, 2, 7))
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments06_ES6.ts ===
|
||||
|
||||
function f(arguments) {
|
||||
>f : (arguments: any) => void
|
||||
>arguments : any
|
||||
|
||||
var a = () => () => arguments;
|
||||
>a : () => () => IArguments
|
||||
>() => () => arguments : () => () => IArguments
|
||||
>() => arguments : () => IArguments
|
||||
>arguments : IArguments
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments07.ts(3,34): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments07.ts (1 errors) ====
|
||||
|
||||
function f(arguments) {
|
||||
var a = (arguments) => () => arguments;
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments07.ts]
|
||||
|
||||
function f(arguments) {
|
||||
var a = (arguments) => () => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments07.js]
|
||||
function f(arguments) {
|
||||
var a = function (arguments) { return function () { return arguments; }; };
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments07_ES6.ts]
|
||||
|
||||
function f(arguments) {
|
||||
var a = (arguments) => () => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments07_ES6.js]
|
||||
function f(arguments) {
|
||||
var a = (arguments) => () => arguments;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments07_ES6.ts ===
|
||||
|
||||
function f(arguments) {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments07_ES6.ts, 0, 0))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments07_ES6.ts, 1, 11))
|
||||
|
||||
var a = (arguments) => () => arguments;
|
||||
>a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments07_ES6.ts, 2, 7))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments07_ES6.ts, 2, 13))
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments07_ES6.ts ===
|
||||
|
||||
function f(arguments) {
|
||||
>f : (arguments: any) => void
|
||||
>arguments : any
|
||||
|
||||
var a = (arguments) => () => arguments;
|
||||
>a : (arguments: any) => () => IArguments
|
||||
>(arguments) => () => arguments : (arguments: any) => () => IArguments
|
||||
>arguments : any
|
||||
>() => arguments : () => IArguments
|
||||
>arguments : IArguments
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments08.ts]
|
||||
|
||||
function f(arguments) {
|
||||
var a = () => (arguments) => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments08.js]
|
||||
function f(arguments) {
|
||||
var a = function () { return function (arguments) { return arguments; }; };
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments08.ts ===
|
||||
|
||||
function f(arguments) {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments08.ts, 0, 0))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments08.ts, 1, 11))
|
||||
|
||||
var a = () => (arguments) => arguments;
|
||||
>a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments08.ts, 2, 7))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments08.ts, 2, 19))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments08.ts, 2, 19))
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments08.ts ===
|
||||
|
||||
function f(arguments) {
|
||||
>f : (arguments: any) => void
|
||||
>arguments : any
|
||||
|
||||
var a = () => (arguments) => arguments;
|
||||
>a : () => (arguments: any) => any
|
||||
>() => (arguments) => arguments : () => (arguments: any) => any
|
||||
>(arguments) => arguments : (arguments: any) => any
|
||||
>arguments : any
|
||||
>arguments : any
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments08_ES6.ts]
|
||||
|
||||
function f(arguments) {
|
||||
var a = () => (arguments) => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments08_ES6.js]
|
||||
function f(arguments) {
|
||||
var a = () => (arguments) => arguments;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments08_ES6.ts ===
|
||||
|
||||
function f(arguments) {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments08_ES6.ts, 0, 0))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments08_ES6.ts, 1, 11))
|
||||
|
||||
var a = () => (arguments) => arguments;
|
||||
>a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments08_ES6.ts, 2, 7))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments08_ES6.ts, 2, 19))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments08_ES6.ts, 2, 19))
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments08_ES6.ts ===
|
||||
|
||||
function f(arguments) {
|
||||
>f : (arguments: any) => void
|
||||
>arguments : any
|
||||
|
||||
var a = () => (arguments) => arguments;
|
||||
>a : () => (arguments: any) => any
|
||||
>() => (arguments) => arguments : () => (arguments: any) => any
|
||||
>(arguments) => arguments : (arguments: any) => any
|
||||
>arguments : any
|
||||
>arguments : any
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments09.ts(3,25): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments09.ts (1 errors) ====
|
||||
|
||||
function f(_arguments) {
|
||||
var a = () => () => arguments;
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments09.ts]
|
||||
|
||||
function f(_arguments) {
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments09.js]
|
||||
function f(_arguments) {
|
||||
var a = function () { return function () { return arguments; }; };
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments09_ES6.ts]
|
||||
|
||||
function f(_arguments) {
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments09_ES6.js]
|
||||
function f(_arguments) {
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments09_ES6.ts ===
|
||||
|
||||
function f(_arguments) {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments09_ES6.ts, 0, 0))
|
||||
>_arguments : Symbol(_arguments, Decl(emitArrowFunctionWhenUsingArguments09_ES6.ts, 1, 11))
|
||||
|
||||
var a = () => () => arguments;
|
||||
>a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments09_ES6.ts, 2, 7))
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments09_ES6.ts ===
|
||||
|
||||
function f(_arguments) {
|
||||
>f : (_arguments: any) => void
|
||||
>_arguments : any
|
||||
|
||||
var a = () => () => arguments;
|
||||
>a : () => () => IArguments
|
||||
>() => () => arguments : () => () => IArguments
|
||||
>() => arguments : () => IArguments
|
||||
>arguments : IArguments
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments10.ts(4,25): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments10.ts (1 errors) ====
|
||||
|
||||
function f() {
|
||||
var _arguments = 10;
|
||||
var a = () => () => arguments;
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments10.ts]
|
||||
|
||||
function f() {
|
||||
var _arguments = 10;
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments10.js]
|
||||
function f() {
|
||||
var _arguments = 10;
|
||||
var a = function () { return function () { return arguments; }; };
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments10_ES6.ts]
|
||||
|
||||
function f() {
|
||||
var _arguments = 10;
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments10_ES6.js]
|
||||
function f() {
|
||||
var _arguments = 10;
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments10_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments10_ES6.ts, 0, 0))
|
||||
|
||||
var _arguments = 10;
|
||||
>_arguments : Symbol(_arguments, Decl(emitArrowFunctionWhenUsingArguments10_ES6.ts, 2, 7))
|
||||
|
||||
var a = () => () => arguments;
|
||||
>a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments10_ES6.ts, 3, 7))
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments10_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
var _arguments = 10;
|
||||
>_arguments : number
|
||||
>10 : number
|
||||
|
||||
var a = () => () => arguments;
|
||||
>a : () => () => IArguments
|
||||
>() => () => arguments : () => () => IArguments
|
||||
>() => arguments : () => IArguments
|
||||
>arguments : IArguments
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments11.ts(4,25): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments11.ts (1 errors) ====
|
||||
|
||||
function f(arguments) {
|
||||
var _arguments = 10;
|
||||
var a = () => () => arguments;
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments11.ts]
|
||||
|
||||
function f(arguments) {
|
||||
var _arguments = 10;
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments11.js]
|
||||
function f(arguments) {
|
||||
var _arguments = 10;
|
||||
var a = function () { return function () { return arguments; }; };
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments11_ES6.ts]
|
||||
|
||||
function f(arguments) {
|
||||
var _arguments = 10;
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments11_ES6.js]
|
||||
function f(arguments) {
|
||||
var _arguments = 10;
|
||||
var a = () => () => arguments;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments11_ES6.ts ===
|
||||
|
||||
function f(arguments) {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments11_ES6.ts, 0, 0))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments11_ES6.ts, 1, 11))
|
||||
|
||||
var _arguments = 10;
|
||||
>_arguments : Symbol(_arguments, Decl(emitArrowFunctionWhenUsingArguments11_ES6.ts, 2, 7))
|
||||
|
||||
var a = () => () => arguments;
|
||||
>a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments11_ES6.ts, 3, 7))
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments11_ES6.ts ===
|
||||
|
||||
function f(arguments) {
|
||||
>f : (arguments: any) => void
|
||||
>arguments : any
|
||||
|
||||
var _arguments = 10;
|
||||
>_arguments : number
|
||||
>10 : number
|
||||
|
||||
var a = () => () => arguments;
|
||||
>a : () => () => IArguments
|
||||
>() => () => arguments : () => () => IArguments
|
||||
>() => arguments : () => IArguments
|
||||
>arguments : IArguments
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments12.ts(3,7): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments12.ts(4,23): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments12.ts (2 errors) ====
|
||||
|
||||
class C {
|
||||
f(arguments) {
|
||||
~~~~~~~~~
|
||||
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
|
||||
var a = () => arguments;
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments12.ts]
|
||||
|
||||
class C {
|
||||
f(arguments) {
|
||||
var a = () => arguments;
|
||||
}
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments12.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.f = function (arguments) {
|
||||
var a = function () { return arguments; };
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,12 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments12_ES6.ts(3,7): error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments12_ES6.ts (1 errors) ====
|
||||
|
||||
class C {
|
||||
f(arguments) {
|
||||
~~~~~~~~~
|
||||
!!! error TS1210: Invalid use of 'arguments'. Class definitions are automatically in strict mode.
|
||||
var a = () => arguments;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments12_ES6.ts]
|
||||
|
||||
class C {
|
||||
f(arguments) {
|
||||
var a = () => arguments;
|
||||
}
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments12_ES6.js]
|
||||
class C {
|
||||
f(arguments) {
|
||||
var a = () => arguments;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments13.ts]
|
||||
|
||||
function f() {
|
||||
var _arguments = 10;
|
||||
var a = (arguments) => () => _arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments13.js]
|
||||
function f() {
|
||||
var _arguments = 10;
|
||||
var a = function (arguments) { return function () { return _arguments; }; };
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments13.ts ===
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments13.ts, 0, 0))
|
||||
|
||||
var _arguments = 10;
|
||||
>_arguments : Symbol(_arguments, Decl(emitArrowFunctionWhenUsingArguments13.ts, 2, 7))
|
||||
|
||||
var a = (arguments) => () => _arguments;
|
||||
>a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments13.ts, 3, 7))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments13.ts, 3, 13))
|
||||
>_arguments : Symbol(_arguments, Decl(emitArrowFunctionWhenUsingArguments13.ts, 2, 7))
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments13.ts ===
|
||||
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
var _arguments = 10;
|
||||
>_arguments : number
|
||||
>10 : number
|
||||
|
||||
var a = (arguments) => () => _arguments;
|
||||
>a : (arguments: any) => () => number
|
||||
>(arguments) => () => _arguments : (arguments: any) => () => number
|
||||
>arguments : any
|
||||
>() => _arguments : () => number
|
||||
>_arguments : number
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments13_ES6.ts]
|
||||
|
||||
function f() {
|
||||
var _arguments = 10;
|
||||
var a = (arguments) => () => _arguments;
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments13_ES6.js]
|
||||
function f() {
|
||||
var _arguments = 10;
|
||||
var a = (arguments) => () => _arguments;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments13_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments13_ES6.ts, 0, 0))
|
||||
|
||||
var _arguments = 10;
|
||||
>_arguments : Symbol(_arguments, Decl(emitArrowFunctionWhenUsingArguments13_ES6.ts, 2, 7))
|
||||
|
||||
var a = (arguments) => () => _arguments;
|
||||
>a : Symbol(a, Decl(emitArrowFunctionWhenUsingArguments13_ES6.ts, 3, 7))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments13_ES6.ts, 3, 13))
|
||||
>_arguments : Symbol(_arguments, Decl(emitArrowFunctionWhenUsingArguments13_ES6.ts, 2, 7))
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments13_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
var _arguments = 10;
|
||||
>_arguments : number
|
||||
>10 : number
|
||||
|
||||
var a = (arguments) => () => _arguments;
|
||||
>a : (arguments: any) => () => number
|
||||
>(arguments) => () => _arguments : (arguments: any) => () => number
|
||||
>arguments : any
|
||||
>() => _arguments : () => number
|
||||
>_arguments : number
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments14.ts(5,22): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments14.ts (1 errors) ====
|
||||
|
||||
function f() {
|
||||
if (Math.random()) {
|
||||
const arguments = 100;
|
||||
return () => arguments;
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments14.ts]
|
||||
|
||||
function f() {
|
||||
if (Math.random()) {
|
||||
const arguments = 100;
|
||||
return () => arguments;
|
||||
}
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments14.js]
|
||||
function f() {
|
||||
if (Math.random()) {
|
||||
var arguments_1 = 100;
|
||||
return function () { return arguments; };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments14_ES6.ts]
|
||||
|
||||
function f() {
|
||||
if (Math.random()) {
|
||||
let arguments = 100;
|
||||
return () => arguments;
|
||||
}
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments14_ES6.js]
|
||||
function f() {
|
||||
if (Math.random()) {
|
||||
let arguments = 100;
|
||||
return () => arguments;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments14_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments14_ES6.ts, 0, 0))
|
||||
|
||||
if (Math.random()) {
|
||||
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1664, 1))
|
||||
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
|
||||
let arguments = 100;
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments14_ES6.ts, 3, 11))
|
||||
|
||||
return () => arguments;
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments14_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : () => () => IArguments
|
||||
|
||||
if (Math.random()) {
|
||||
>Math.random() : number
|
||||
>Math.random : () => number
|
||||
>Math : Math
|
||||
>random : () => number
|
||||
|
||||
let arguments = 100;
|
||||
>arguments : number
|
||||
>100 : number
|
||||
|
||||
return () => arguments;
|
||||
>() => arguments : () => IArguments
|
||||
>arguments : IArguments
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments15.ts(6,22): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments15.ts (1 errors) ====
|
||||
|
||||
function f() {
|
||||
var arguments = "hello";
|
||||
if (Math.random()) {
|
||||
const arguments = 100;
|
||||
return () => arguments;
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments15.ts]
|
||||
|
||||
function f() {
|
||||
var arguments = "hello";
|
||||
if (Math.random()) {
|
||||
const arguments = 100;
|
||||
return () => arguments;
|
||||
}
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments15.js]
|
||||
function f() {
|
||||
var arguments = "hello";
|
||||
if (Math.random()) {
|
||||
var arguments_1 = 100;
|
||||
return function () { return arguments; };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments15_ES6.ts]
|
||||
|
||||
function f() {
|
||||
var arguments = "hello";
|
||||
if (Math.random()) {
|
||||
const arguments = 100;
|
||||
return () => arguments;
|
||||
}
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments15_ES6.js]
|
||||
function f() {
|
||||
var arguments = "hello";
|
||||
if (Math.random()) {
|
||||
const arguments = 100;
|
||||
return () => arguments;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments15_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments15_ES6.ts, 0, 0))
|
||||
|
||||
var arguments = "hello";
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments15_ES6.ts, 2, 7))
|
||||
|
||||
if (Math.random()) {
|
||||
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1664, 1))
|
||||
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
|
||||
const arguments = 100;
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments15_ES6.ts, 4, 13))
|
||||
|
||||
return () => arguments;
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments15_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : () => () => IArguments
|
||||
|
||||
var arguments = "hello";
|
||||
>arguments : string
|
||||
>"hello" : string
|
||||
|
||||
if (Math.random()) {
|
||||
>Math.random() : number
|
||||
>Math.random : () => number
|
||||
>Math : Math
|
||||
>random : () => number
|
||||
|
||||
const arguments = 100;
|
||||
>arguments : number
|
||||
>100 : number
|
||||
|
||||
return () => arguments;
|
||||
>() => arguments : () => IArguments
|
||||
>arguments : IArguments
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments16.ts(5,22): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments16.ts (1 errors) ====
|
||||
|
||||
function f() {
|
||||
var arguments = "hello";
|
||||
if (Math.random()) {
|
||||
return () => arguments[0];
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
var arguments = "world";
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments16.ts]
|
||||
|
||||
function f() {
|
||||
var arguments = "hello";
|
||||
if (Math.random()) {
|
||||
return () => arguments[0];
|
||||
}
|
||||
var arguments = "world";
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments16.js]
|
||||
function f() {
|
||||
var arguments = "hello";
|
||||
if (Math.random()) {
|
||||
return function () { return arguments[0]; };
|
||||
}
|
||||
var arguments = "world";
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments16_ES6.ts]
|
||||
|
||||
function f() {
|
||||
var arguments = "hello";
|
||||
if (Math.random()) {
|
||||
return () => arguments[0];
|
||||
}
|
||||
var arguments = "world";
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments16_ES6.js]
|
||||
function f() {
|
||||
var arguments = "hello";
|
||||
if (Math.random()) {
|
||||
return () => arguments[0];
|
||||
}
|
||||
var arguments = "world";
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments16_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments16_ES6.ts, 0, 0))
|
||||
|
||||
var arguments = "hello";
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments16_ES6.ts, 2, 7), Decl(emitArrowFunctionWhenUsingArguments16_ES6.ts, 6, 7))
|
||||
|
||||
if (Math.random()) {
|
||||
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1664, 1))
|
||||
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
|
||||
return () => arguments[0];
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
var arguments = "world";
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments16_ES6.ts, 2, 7), Decl(emitArrowFunctionWhenUsingArguments16_ES6.ts, 6, 7))
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments16_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : () => () => any
|
||||
|
||||
var arguments = "hello";
|
||||
>arguments : string
|
||||
>"hello" : string
|
||||
|
||||
if (Math.random()) {
|
||||
>Math.random() : number
|
||||
>Math.random : () => number
|
||||
>Math : Math
|
||||
>random : () => number
|
||||
|
||||
return () => arguments[0];
|
||||
>() => arguments[0] : () => any
|
||||
>arguments[0] : any
|
||||
>arguments : IArguments
|
||||
>0 : number
|
||||
}
|
||||
var arguments = "world";
|
||||
>arguments : string
|
||||
>"world" : string
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments17.ts(5,22): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments17.ts (1 errors) ====
|
||||
|
||||
function f() {
|
||||
var { arguments } = { arguments: "hello" };
|
||||
if (Math.random()) {
|
||||
return () => arguments[0];
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
var arguments = "world";
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments17.ts]
|
||||
|
||||
function f() {
|
||||
var { arguments } = { arguments: "hello" };
|
||||
if (Math.random()) {
|
||||
return () => arguments[0];
|
||||
}
|
||||
var arguments = "world";
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments17.js]
|
||||
function f() {
|
||||
var arguments = { arguments: "hello" }.arguments;
|
||||
if (Math.random()) {
|
||||
return function () { return arguments[0]; };
|
||||
}
|
||||
var arguments = "world";
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments17_ES6.ts]
|
||||
|
||||
function f() {
|
||||
var { arguments } = { arguments: "hello" };
|
||||
if (Math.random()) {
|
||||
return () => arguments[0];
|
||||
}
|
||||
var arguments = "world";
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments17_ES6.js]
|
||||
function f() {
|
||||
var { arguments } = { arguments: "hello" };
|
||||
if (Math.random()) {
|
||||
return () => arguments[0];
|
||||
}
|
||||
var arguments = "world";
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments17_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments17_ES6.ts, 0, 0))
|
||||
|
||||
var { arguments } = { arguments: "hello" };
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments17_ES6.ts, 2, 9), Decl(emitArrowFunctionWhenUsingArguments17_ES6.ts, 6, 7))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments17_ES6.ts, 2, 25))
|
||||
|
||||
if (Math.random()) {
|
||||
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1664, 1))
|
||||
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
|
||||
return () => arguments[0];
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
var arguments = "world";
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments17_ES6.ts, 2, 9), Decl(emitArrowFunctionWhenUsingArguments17_ES6.ts, 6, 7))
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments17_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : () => () => any
|
||||
|
||||
var { arguments } = { arguments: "hello" };
|
||||
>arguments : string
|
||||
>{ arguments: "hello" } : { arguments: string; }
|
||||
>arguments : string
|
||||
>"hello" : string
|
||||
|
||||
if (Math.random()) {
|
||||
>Math.random() : number
|
||||
>Math.random : () => number
|
||||
>Math : Math
|
||||
>random : () => number
|
||||
|
||||
return () => arguments[0];
|
||||
>() => arguments[0] : () => any
|
||||
>arguments[0] : any
|
||||
>arguments : IArguments
|
||||
>0 : number
|
||||
}
|
||||
var arguments = "world";
|
||||
>arguments : string
|
||||
>"world" : string
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments18.ts(5,22): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments18.ts (1 errors) ====
|
||||
|
||||
function f() {
|
||||
var { arguments: args } = { arguments };
|
||||
if (Math.random()) {
|
||||
return () => arguments;
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments18.ts]
|
||||
|
||||
function f() {
|
||||
var { arguments: args } = { arguments };
|
||||
if (Math.random()) {
|
||||
return () => arguments;
|
||||
}
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments18.js]
|
||||
function f() {
|
||||
var args = { arguments: arguments }.arguments;
|
||||
if (Math.random()) {
|
||||
return function () { return arguments; };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments18_ES6.ts]
|
||||
|
||||
function f() {
|
||||
var { arguments: args } = { arguments };
|
||||
if (Math.random()) {
|
||||
return () => arguments;
|
||||
}
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments18_ES6.js]
|
||||
function f() {
|
||||
var { arguments: args } = { arguments };
|
||||
if (Math.random()) {
|
||||
return () => arguments;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments18_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments18_ES6.ts, 0, 0))
|
||||
|
||||
var { arguments: args } = { arguments };
|
||||
>args : Symbol(args, Decl(emitArrowFunctionWhenUsingArguments18_ES6.ts, 2, 9))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments18_ES6.ts, 2, 31))
|
||||
|
||||
if (Math.random()) {
|
||||
>Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1664, 1))
|
||||
>random : Symbol(Math.random, Decl(lib.d.ts, 608, 38))
|
||||
|
||||
return () => arguments;
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments18_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : () => () => IArguments
|
||||
|
||||
var { arguments: args } = { arguments };
|
||||
>arguments : any
|
||||
>args : IArguments
|
||||
>{ arguments } : { arguments: IArguments; }
|
||||
>arguments : IArguments
|
||||
|
||||
if (Math.random()) {
|
||||
>Math.random() : number
|
||||
>Math.random : () => number
|
||||
>Math : Math
|
||||
>random : () => number
|
||||
|
||||
return () => arguments;
|
||||
>() => arguments : () => IArguments
|
||||
>arguments : IArguments
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments19.ts(6,33): error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments19.ts (1 errors) ====
|
||||
|
||||
function f() {
|
||||
function g() {
|
||||
var _arguments = 10; // No capture in 'g', so no conflict.
|
||||
function h() {
|
||||
var capture = () => arguments; // Should trigger an '_arguments' capture into function 'h'
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.
|
||||
foo(_arguments); // Error as this does not resolve to the user defined '_arguments'
|
||||
}
|
||||
}
|
||||
|
||||
function foo(x: any) {
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments19.ts]
|
||||
|
||||
function f() {
|
||||
function g() {
|
||||
var _arguments = 10; // No capture in 'g', so no conflict.
|
||||
function h() {
|
||||
var capture = () => arguments; // Should trigger an '_arguments' capture into function 'h'
|
||||
foo(_arguments); // Error as this does not resolve to the user defined '_arguments'
|
||||
}
|
||||
}
|
||||
|
||||
function foo(x: any) {
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments19.js]
|
||||
function f() {
|
||||
function g() {
|
||||
var _arguments = 10; // No capture in 'g', so no conflict.
|
||||
function h() {
|
||||
var capture = function () { return arguments; }; // Should trigger an '_arguments' capture into function 'h'
|
||||
foo(_arguments); // Error as this does not resolve to the user defined '_arguments'
|
||||
}
|
||||
}
|
||||
function foo(x) {
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//// [emitArrowFunctionWhenUsingArguments19_ES6.ts]
|
||||
|
||||
function f() {
|
||||
function g() {
|
||||
var _arguments = 10; // No capture in 'g', so no conflict.
|
||||
function h() {
|
||||
var capture = () => arguments; // Should trigger an '_arguments' capture into function 'h'
|
||||
foo(_arguments); // Error as this does not resolve to the user defined '_arguments'
|
||||
}
|
||||
}
|
||||
|
||||
function foo(x: any) {
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
||||
//// [emitArrowFunctionWhenUsingArguments19_ES6.js]
|
||||
function f() {
|
||||
function g() {
|
||||
var _arguments = 10; // No capture in 'g', so no conflict.
|
||||
function h() {
|
||||
var capture = () => arguments; // Should trigger an '_arguments' capture into function 'h'
|
||||
foo(_arguments); // Error as this does not resolve to the user defined '_arguments'
|
||||
}
|
||||
}
|
||||
function foo(x) {
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments19_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments19_ES6.ts, 0, 0))
|
||||
|
||||
function g() {
|
||||
>g : Symbol(g, Decl(emitArrowFunctionWhenUsingArguments19_ES6.ts, 1, 14))
|
||||
|
||||
var _arguments = 10; // No capture in 'g', so no conflict.
|
||||
>_arguments : Symbol(_arguments, Decl(emitArrowFunctionWhenUsingArguments19_ES6.ts, 3, 11))
|
||||
|
||||
function h() {
|
||||
>h : Symbol(h, Decl(emitArrowFunctionWhenUsingArguments19_ES6.ts, 3, 28))
|
||||
|
||||
var capture = () => arguments; // Should trigger an '_arguments' capture into function 'h'
|
||||
>capture : Symbol(capture, Decl(emitArrowFunctionWhenUsingArguments19_ES6.ts, 5, 15))
|
||||
>arguments : Symbol(arguments)
|
||||
|
||||
foo(_arguments); // Error as this does not resolve to the user defined '_arguments'
|
||||
>foo : Symbol(foo, Decl(emitArrowFunctionWhenUsingArguments19_ES6.ts, 8, 5))
|
||||
>_arguments : Symbol(_arguments, Decl(emitArrowFunctionWhenUsingArguments19_ES6.ts, 3, 11))
|
||||
}
|
||||
}
|
||||
|
||||
function foo(x: any) {
|
||||
>foo : Symbol(foo, Decl(emitArrowFunctionWhenUsingArguments19_ES6.ts, 8, 5))
|
||||
>x : Symbol(x, Decl(emitArrowFunctionWhenUsingArguments19_ES6.ts, 10, 17))
|
||||
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments19_ES6.ts ===
|
||||
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
function g() {
|
||||
>g : () => void
|
||||
|
||||
var _arguments = 10; // No capture in 'g', so no conflict.
|
||||
>_arguments : number
|
||||
>10 : number
|
||||
|
||||
function h() {
|
||||
>h : () => void
|
||||
|
||||
var capture = () => arguments; // Should trigger an '_arguments' capture into function 'h'
|
||||
>capture : () => IArguments
|
||||
>() => arguments : () => IArguments
|
||||
>arguments : IArguments
|
||||
|
||||
foo(_arguments); // Error as this does not resolve to the user defined '_arguments'
|
||||
>foo(_arguments) : number
|
||||
>foo : (x: any) => number
|
||||
>_arguments : number
|
||||
}
|
||||
}
|
||||
|
||||
function foo(x: any) {
|
||||
>foo : (x: any) => number
|
||||
>x : any
|
||||
|
||||
return 100;
|
||||
>100 : number
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts(2,15): error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts(7,19): error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts(13,13): error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts(19,15): error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts (4 errors) ====
|
||||
var a = () => {
|
||||
var arg = arguments[0]; // error
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
}
|
||||
|
||||
var b = function () {
|
||||
var a = () => {
|
||||
var arg = arguments[0]; // error
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
}
|
||||
}
|
||||
|
||||
function baz() {
|
||||
() => {
|
||||
var arg = arguments[0];
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
}
|
||||
}
|
||||
|
||||
function foo(inputFunc: () => void) { }
|
||||
foo(() => {
|
||||
var arg = arguments[0]; // error
|
||||
~~~~~~~~~
|
||||
!!! error TS2496: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
});
|
||||
|
||||
function bar() {
|
||||
var arg = arguments[0]; // no error
|
||||
}
|
||||
|
||||
|
||||
() => {
|
||||
function foo() {
|
||||
var arg = arguments[0]; // no error
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user