Address code review

This commit is contained in:
Yui T
2015-01-30 12:20:21 -08:00
parent fb2c5020a3
commit cf5aadb28d
5 changed files with 20 additions and 25 deletions
+2 -7
View File
@@ -4856,7 +4856,7 @@ module ts {
// 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.An_argument_object_has_different_behaviour_across_Javascript_versions_Use_function_expression_or_rest_parameters_instead);
error(node, Diagnostics.The_argument_object_has_different_behaviour_across_Javascript_versions_Use_function_expression_or_rest_parameters_instead);
}
if (symbol.flags & SymbolFlags.Import) {
@@ -4915,12 +4915,7 @@ module ts {
container = getThisContainer(container, /* includeArrowFunctions */ false);
// When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code
if (compilerOptions.target >= ScriptTarget.ES6) {
needToCaptureLexicalThis = false;
}
else {
needToCaptureLexicalThis = true;
}
needToCaptureLexicalThis = !(compilerOptions.target >= ScriptTarget.ES6);
}
switch (container.kind) {
@@ -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 },
An_argument_object_has_different_behaviour_across_Javascript_versions_Use_function_expression_or_rest_parameters_instead: { code: 9002, category: DiagnosticCategory.Error, key: "An argument object has different behaviour across Javascript versions. Use function expression or rest parameters instead" },
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" },
};
}
+1 -1
View File
@@ -1909,7 +1909,7 @@
"code": 9001,
"isEarly": true
},
"An argument object has different behaviour across Javascript versions. Use function expression or rest parameters instead": {
"The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead": {
"category": "Error",
"code": 9002
}
@@ -1,21 +1,21 @@
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts(2,15): error TS9002: An 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: An 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: An 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: An 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 '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 (4 errors) ====
var a = () => {
var arg = arguments[0]; // error
~~~~~~~~~
!!! error TS9002: An argument object has different behaviour across Javascript versions. Use function expression or rest parameters instead
!!! error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
}
var b = function () {
var a = () => {
var arg = arguments[0]; // error
~~~~~~~~~
!!! error TS9002: An argument object has different behaviour across Javascript versions. Use function expression or rest parameters instead
!!! error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
}
}
@@ -23,7 +23,7 @@ tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts
() => {
var arg = arguments[0];
~~~~~~~~~
!!! error TS9002: An argument object has different behaviour across Javascript versions. Use function expression or rest parameters instead
!!! error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
}
}
@@ -31,7 +31,7 @@ tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts
foo(() => {
var arg = arguments[0]; // error
~~~~~~~~~
!!! error TS9002: An argument object has different behaviour across Javascript versions. Use function expression or rest parameters instead
!!! error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
});
function bar() {
@@ -1,21 +1,21 @@
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts(2,15): error TS9002: An 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: An 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: An 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: An 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 '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 (4 errors) ====
var a = () => {
var arg = arguments[0]; // error
~~~~~~~~~
!!! error TS9002: An argument object has different behaviour across Javascript versions. Use function expression or rest parameters instead
!!! error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
}
var b = function () {
var a = () => {
var arg = arguments[0]; // error
~~~~~~~~~
!!! error TS9002: An argument object has different behaviour across Javascript versions. Use function expression or rest parameters instead
!!! error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
}
}
@@ -23,7 +23,7 @@ tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6
() => {
var arg = arguments[0];
~~~~~~~~~
!!! error TS9002: An argument object has different behaviour across Javascript versions. Use function expression or rest parameters instead
!!! error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
}
}
@@ -31,7 +31,7 @@ tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6
foo(() => {
var arg = arguments[0]; // error
~~~~~~~~~
!!! error TS9002: An argument object has different behaviour across Javascript versions. Use function expression or rest parameters instead
!!! error TS9002: The 'argument' object has different behaviour across Javascript versions. Use function expression or rest parameters instead
});
function bar() {