mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Update an error
This commit is contained in:
@@ -4852,11 +4852,11 @@ module ts {
|
||||
// As noted in ECMAScript 6 language spec, arrow functions never have an arguments objects.
|
||||
// Although in down-level emit of arrow function, we emit it using function expression which means that
|
||||
// arguments objects will be bound to the inner object; emitting arrow function natively in ES6, arguments objects
|
||||
// will be bound to non-arrow function that contain this arrow function. This results in inconsistent behaviour.
|
||||
// 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_argument_object_has_different_behaviour_across_Javascript_versions_Use_function_expression_or_rest_parameters_instead);
|
||||
error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression);
|
||||
}
|
||||
|
||||
if (symbol.flags & SymbolFlags.Import) {
|
||||
|
||||
@@ -452,6 +452,6 @@ module ts {
|
||||
You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." },
|
||||
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported.", isEarly: true },
|
||||
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported.", isEarly: true },
|
||||
The_argument_object_has_different_behaviour_across_Javascript_versions_Use_function_expression_or_rest_parameters_instead: { code: 9002, category: DiagnosticCategory.Error, key: "The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead" },
|
||||
The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." },
|
||||
};
|
||||
}
|
||||
@@ -1909,7 +1909,7 @@
|
||||
"code": 9001,
|
||||
"isEarly": true
|
||||
},
|
||||
"The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead": {
|
||||
"The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": {
|
||||
"category": "Error",
|
||||
"code": 9002
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts(2,15): error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts(7,19): error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts(13,13): error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts(19,15): error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts(2,15): error TS9002: 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 TS9002: 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 TS9002: 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 TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts (4 errors) ====
|
||||
var a = () => {
|
||||
var arg = arguments[0]; // error
|
||||
~~~~~~~~~
|
||||
!!! error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
!!! error TS9002: 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 TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
!!! error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts
|
||||
() => {
|
||||
var arg = arguments[0];
|
||||
~~~~~~~~~
|
||||
!!! error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
!!! error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts
|
||||
foo(() => {
|
||||
var arg = arguments[0]; // error
|
||||
~~~~~~~~~
|
||||
!!! error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
!!! error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
});
|
||||
|
||||
function bar() {
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts(2,15): error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts(7,19): error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts(13,13): error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts(19,15): error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts(2,15): error TS9002: 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 TS9002: 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 TS9002: 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 TS9002: 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 TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
!!! error TS9002: 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 TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
!!! error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6
|
||||
() => {
|
||||
var arg = arguments[0];
|
||||
~~~~~~~~~
|
||||
!!! error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
!!! error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6
|
||||
foo(() => {
|
||||
var arg = arguments[0]; // error
|
||||
~~~~~~~~~
|
||||
!!! error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
|
||||
!!! error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.
|
||||
});
|
||||
|
||||
function bar() {
|
||||
|
||||
Reference in New Issue
Block a user