Enable computed properties
This commit is contained in:
parent
8d5b65a533
commit
15187e5e1d
|
@ -10416,22 +10416,18 @@ module ts {
|
|||
return false;
|
||||
}
|
||||
|
||||
function checkGrammarComputedPropertyName(node: Node): void {
|
||||
function checkGrammarComputedPropertyName(node: Node): boolean {
|
||||
// If node is not a computedPropertyName, just skip the grammar checking
|
||||
if (node.kind !== SyntaxKind.ComputedPropertyName) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
// Since computed properties are not supported in the type checker, disallow them in TypeScript 1.4
|
||||
// Once full support is added, remove this error.
|
||||
grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_not_currently_supported);
|
||||
return;
|
||||
|
||||
var computedPropertyName = <ComputedPropertyName>node;
|
||||
if (compilerOptions.target < ScriptTarget.ES6) {
|
||||
grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher);
|
||||
return grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher);
|
||||
}
|
||||
else if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>computedPropertyName.expression).operator === SyntaxKind.CommaToken) {
|
||||
grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
|
||||
return grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -445,6 +445,5 @@ 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 },
|
||||
Computed_property_names_are_not_currently_supported: { code: 9002, category: DiagnosticCategory.Error, key: "Computed property names are not currently supported.", isEarly: true },
|
||||
};
|
||||
}
|
|
@ -1880,10 +1880,5 @@
|
|||
"category": "Error",
|
||||
"code": 9001,
|
||||
"isEarly": true
|
||||
},
|
||||
"Computed property names are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9002,
|
||||
"isEarly": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (1 errors) ====
|
||||
var v = { [yield]: foo }
|
||||
~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
|
@ -1,5 +1,5 @@
|
|||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,13): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (2 errors) ====
|
||||
|
@ -8,5 +8,5 @@ tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,1
|
|||
!!! error TS9001: Generators are not currently supported.
|
||||
var v = { [yield]: foo }
|
||||
~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (1 errors) ====
|
||||
var v = { *[foo()]() { } }
|
||||
~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
|
@ -1,13 +0,0 @@
|
|||
tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts(2,9): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts(3,9): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts (2 errors) ====
|
||||
var v = {
|
||||
get [0 + 1]() { return 0 },
|
||||
~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
set [0 + 1](v: string) { } //No error
|
||||
~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
}
|
14
tests/baselines/reference/computedPropertyNames1.js
Normal file
14
tests/baselines/reference/computedPropertyNames1.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
//// [computedPropertyNames1.ts]
|
||||
var v = {
|
||||
get [0 + 1]() { return 0 },
|
||||
set [0 + 1](v: string) { } //No error
|
||||
}
|
||||
|
||||
//// [computedPropertyNames1.js]
|
||||
var v = {
|
||||
get [0 + 1]() {
|
||||
return 0;
|
||||
},
|
||||
set [0 + 1](v) {
|
||||
} //No error
|
||||
};
|
|
@ -1,37 +1,19 @@
|
|||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(4,5): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(5,12): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(7,9): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(9,16): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts (8 errors) ====
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts (2 errors) ====
|
||||
var methodName = "method";
|
||||
var accessorName = "accessor";
|
||||
class C {
|
||||
[methodName]() { }
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
static [methodName]() { }
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
get [accessorName]() { }
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
set [accessorName](v) { }
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
static get [accessorName]() { }
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
static set [accessorName](v) { }
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
}
|
48
tests/baselines/reference/computedPropertyNames2.js
Normal file
48
tests/baselines/reference/computedPropertyNames2.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
//// [computedPropertyNames2.ts]
|
||||
var methodName = "method";
|
||||
var accessorName = "accessor";
|
||||
class C {
|
||||
[methodName]() { }
|
||||
static [methodName]() { }
|
||||
get [accessorName]() { }
|
||||
set [accessorName](v) { }
|
||||
static get [accessorName]() { }
|
||||
static set [accessorName](v) { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames2.js]
|
||||
var methodName = "method";
|
||||
var accessorName = "accessor";
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[methodName] = function () {
|
||||
};
|
||||
C[methodName] = function () {
|
||||
};
|
||||
Object.defineProperty(C.prototype, accessorName, {
|
||||
get: function () {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, accessorName, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, accessorName, {
|
||||
get: function () {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, accessorName, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
|
@ -1,36 +1,18 @@
|
|||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(3,5): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(8,16): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (8 errors) ====
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (2 errors) ====
|
||||
var id;
|
||||
class C {
|
||||
[0 + 1]() { }
|
||||
~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
static [() => { }]() { }
|
||||
~~~~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
get [delete id]() { }
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
set [[0, 1]](v) { }
|
||||
~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
static get [<String>""]() { }
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
static set [id.toString()](v) { }
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
}
|
47
tests/baselines/reference/computedPropertyNames3.js
Normal file
47
tests/baselines/reference/computedPropertyNames3.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
//// [computedPropertyNames3.ts]
|
||||
var id;
|
||||
class C {
|
||||
[0 + 1]() { }
|
||||
static [() => { }]() { }
|
||||
get [delete id]() { }
|
||||
set [[0, 1]](v) { }
|
||||
static get [<String>""]() { }
|
||||
static set [id.toString()](v) { }
|
||||
}
|
||||
|
||||
//// [computedPropertyNames3.js]
|
||||
var id;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[0 + 1] = function () {
|
||||
};
|
||||
C[function () {
|
||||
}] = function () {
|
||||
};
|
||||
Object.defineProperty(C.prototype, delete id, {
|
||||
get: function () {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C.prototype, [0, 1], {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, "", {
|
||||
get: function () {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(C, id.toString(), {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
|
@ -1,9 +1,8 @@
|
|||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: Computed property names are not allowed in method overloads.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: Computed property names are not allowed in method overloads.
|
||||
tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(6,5): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (2 errors) ====
|
||||
var methodName = "method";
|
||||
var accessorName = "accessor";
|
||||
class C {
|
||||
|
@ -14,6 +13,4 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.
|
|||
~~~~~~~~~~~~
|
||||
!!! error TS1168: Computed property names are not allowed in method overloads.
|
||||
[methodName](v?: string) { }
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName12.ts(2,4): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName12.ts (1 errors) ====
|
||||
class C {
|
||||
[e]() { }
|
||||
~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
}
|
13
tests/baselines/reference/parserComputedPropertyName12.js
Normal file
13
tests/baselines/reference/parserComputedPropertyName12.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
//// [parserComputedPropertyName12.ts]
|
||||
class C {
|
||||
[e]() { }
|
||||
}
|
||||
|
||||
//// [parserComputedPropertyName12.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[e] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
|
@ -1,7 +0,0 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName17.ts(1,15): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName17.ts (1 errors) ====
|
||||
var v = { set [e](v) { } }
|
||||
~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
|
@ -0,0 +1,6 @@
|
|||
//// [parserComputedPropertyName17.ts]
|
||||
var v = { set [e](v) { } }
|
||||
|
||||
//// [parserComputedPropertyName17.js]
|
||||
var v = { set [e](v) {
|
||||
} };
|
|
@ -1,7 +0,0 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName2.ts(1,11): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName2.ts (1 errors) ====
|
||||
var v = { [e]: 1 };
|
||||
~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
5
tests/baselines/reference/parserComputedPropertyName2.js
Normal file
5
tests/baselines/reference/parserComputedPropertyName2.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
//// [parserComputedPropertyName2.ts]
|
||||
var v = { [e]: 1 };
|
||||
|
||||
//// [parserComputedPropertyName2.js]
|
||||
var v = { [e]: 1 };
|
|
@ -1,9 +0,0 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName24.ts(2,9): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName24.ts (1 errors) ====
|
||||
class C {
|
||||
set [e](v) { }
|
||||
~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
}
|
17
tests/baselines/reference/parserComputedPropertyName24.js
Normal file
17
tests/baselines/reference/parserComputedPropertyName24.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
//// [parserComputedPropertyName24.ts]
|
||||
class C {
|
||||
set [e](v) { }
|
||||
}
|
||||
|
||||
//// [parserComputedPropertyName24.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, e, {
|
||||
set: function (v) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
})();
|
|
@ -1,7 +0,0 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName3.ts(1,11): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName3.ts (1 errors) ====
|
||||
var v = { [e]() { } };
|
||||
~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
6
tests/baselines/reference/parserComputedPropertyName3.js
Normal file
6
tests/baselines/reference/parserComputedPropertyName3.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
//// [parserComputedPropertyName3.ts]
|
||||
var v = { [e]() { } };
|
||||
|
||||
//// [parserComputedPropertyName3.js]
|
||||
var v = { [e]() {
|
||||
} };
|
|
@ -1,9 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName35.ts(2,5): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName35.ts(2,6): error TS1171: A comma expression is not allowed in a computed property name.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName35.ts (1 errors) ====
|
||||
var x = {
|
||||
[0, 1]: { }
|
||||
~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
~~~~
|
||||
!!! error TS1171: A comma expression is not allowed in a computed property name.
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
//// [parserComputedPropertyName35.ts]
|
||||
var x = {
|
||||
[0, 1]: { }
|
||||
}
|
||||
|
||||
//// [parserComputedPropertyName35.js]
|
||||
var x = {
|
||||
[0, 1]: {}
|
||||
};
|
|
@ -1,9 +0,0 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName37.ts(2,5): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName37.ts (1 errors) ====
|
||||
var v = {
|
||||
[public]: 0
|
||||
~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
};
|
|
@ -0,0 +1,9 @@
|
|||
//// [parserComputedPropertyName37.ts]
|
||||
var v = {
|
||||
[public]: 0
|
||||
};
|
||||
|
||||
//// [parserComputedPropertyName37.js]
|
||||
var v = {
|
||||
[public]: 0
|
||||
};
|
|
@ -1,9 +0,0 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName38.ts(2,5): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName38.ts (1 errors) ====
|
||||
class C {
|
||||
[public]() { }
|
||||
~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
}
|
13
tests/baselines/reference/parserComputedPropertyName38.js
Normal file
13
tests/baselines/reference/parserComputedPropertyName38.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
//// [parserComputedPropertyName38.ts]
|
||||
class C {
|
||||
[public]() { }
|
||||
}
|
||||
|
||||
//// [parserComputedPropertyName38.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[public] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
|
@ -1,7 +0,0 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts(1,15): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts (1 errors) ====
|
||||
var v = { get [e]() { } };
|
||||
~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
6
tests/baselines/reference/parserComputedPropertyName4.js
Normal file
6
tests/baselines/reference/parserComputedPropertyName4.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
//// [parserComputedPropertyName4.ts]
|
||||
var v = { get [e]() { } };
|
||||
|
||||
//// [parserComputedPropertyName4.js]
|
||||
var v = { get [e]() {
|
||||
} };
|
|
@ -1,9 +0,0 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName40.ts(2,5): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName40.ts (1 errors) ====
|
||||
class C {
|
||||
[a ? "" : ""]() {}
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
}
|
13
tests/baselines/reference/parserComputedPropertyName40.js
Normal file
13
tests/baselines/reference/parserComputedPropertyName40.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
//// [parserComputedPropertyName40.ts]
|
||||
class C {
|
||||
[a ? "" : ""]() {}
|
||||
}
|
||||
|
||||
//// [parserComputedPropertyName40.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[a ? "" : ""] = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
|
@ -1,9 +0,0 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts (1 errors) ====
|
||||
var v = {
|
||||
[0 in []]: true
|
||||
~~~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
//// [parserComputedPropertyName41.ts]
|
||||
var v = {
|
||||
[0 in []]: true
|
||||
}
|
||||
|
||||
//// [parserComputedPropertyName41.js]
|
||||
var v = {
|
||||
[0 in []]: true
|
||||
};
|
|
@ -1,7 +0,0 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,22): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts (1 errors) ====
|
||||
var v = { public get [e]() { } };
|
||||
~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
6
tests/baselines/reference/parserComputedPropertyName5.js
Normal file
6
tests/baselines/reference/parserComputedPropertyName5.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
//// [parserComputedPropertyName5.ts]
|
||||
var v = { public get [e]() { } };
|
||||
|
||||
//// [parserComputedPropertyName5.js]
|
||||
var v = { get [e]() {
|
||||
} };
|
|
@ -1,10 +0,0 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,11): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,19): error TS9002: Computed property names are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts (2 errors) ====
|
||||
var v = { [e]: 1, [e + e]: 2 };
|
||||
~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
~~~~~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
5
tests/baselines/reference/parserComputedPropertyName6.js
Normal file
5
tests/baselines/reference/parserComputedPropertyName6.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
//// [parserComputedPropertyName6.ts]
|
||||
var v = { [e]: 1, [e + e]: 2 };
|
||||
|
||||
//// [parserComputedPropertyName6.js]
|
||||
var v = { [e]: 1, [e + e]: 2 };
|
|
@ -1,7 +1,7 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,11): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (1 errors) ====
|
||||
var v = { [e]: 1 };
|
||||
~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
|
@ -1,7 +1,7 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,11): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (1 errors) ====
|
||||
var v = { [e]() { } };
|
||||
~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
|
@ -1,7 +1,7 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS9002: Computed property names are not currently supported.
|
||||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (1 errors) ====
|
||||
var v = { get [e]() { } };
|
||||
~~~
|
||||
!!! error TS9002: Computed property names are not currently supported.
|
||||
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
|
Loading…
Reference in a new issue