mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Fix comment
This commit is contained in:
@@ -1047,7 +1047,8 @@ module ts {
|
||||
// Emit identifier as an identifier
|
||||
emit(node.name);
|
||||
write(": ");
|
||||
// Even though this is stored as identified because it is in short-hand property assignment, treated it as expression
|
||||
// Even though this is stored as identified because it is in short-hand property assignment,
|
||||
// treated it as expression
|
||||
emitExpressionIdentifier(node.name);
|
||||
emitTrailingComments(node);
|
||||
}
|
||||
|
||||
@@ -2687,6 +2687,7 @@ module ts {
|
||||
(<PropertyDeclaration>node).initializer = makeFunctionExpression(SyntaxKind.FunctionExpression, node.pos, undefined, sig, body);
|
||||
return finishNode(node);
|
||||
}
|
||||
// Disallow optional property assignment
|
||||
if (token === SyntaxKind.QuestionToken) {
|
||||
var questionStart = scanner.getTokenPos();
|
||||
grammarErrorAtPos(questionStart, scanner.getStartPos() - questionStart, Diagnostics.A_object_member_cannot_be_declared_optional);
|
||||
|
||||
@@ -11,13 +11,14 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(16,6): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(17,6): error TS1005: '=' expected.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(18,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(20,17): error TS1005: ':' expected.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(15,5): error TS2300: Duplicate identifier 'a'.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(15,7): error TS2304: Cannot find name 'b'.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(16,5): error TS2300: Duplicate identifier 'a'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts (17 errors) ====
|
||||
==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts (18 errors) ====
|
||||
// errors
|
||||
var y = {
|
||||
"stringLiteral",
|
||||
@@ -69,4 +70,8 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr
|
||||
!!! error TS1005: '=' expected.
|
||||
};
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
|
||||
var v = { class }; // error
|
||||
~
|
||||
!!! error TS1005: ':' expected.
|
||||
@@ -0,0 +1,24 @@
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorWithModule.ts(10,10): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorWithModule.ts(14,3): error TS2339: Property 'y' does not exist on type 'typeof m'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorWithModule.ts (2 errors) ====
|
||||
// module export
|
||||
var x = "Foo";
|
||||
module m {
|
||||
export var x;
|
||||
}
|
||||
|
||||
module n {
|
||||
var z = 10000;
|
||||
export var y = {
|
||||
m.x // error
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
};
|
||||
}
|
||||
|
||||
m.y.x;
|
||||
~
|
||||
!!! error TS2339: Property 'y' does not exist on type 'typeof m'.
|
||||
|
||||
@@ -15,4 +15,6 @@ var x = {
|
||||
a.b,
|
||||
a["ss"],
|
||||
a[1],
|
||||
};
|
||||
};
|
||||
|
||||
var v = { class }; // error
|
||||
@@ -0,0 +1,14 @@
|
||||
// module export
|
||||
var x = "Foo";
|
||||
module m {
|
||||
export var x;
|
||||
}
|
||||
|
||||
module n {
|
||||
var z = 10000;
|
||||
export var y = {
|
||||
m.x // error
|
||||
};
|
||||
}
|
||||
|
||||
m.y.x;
|
||||
@@ -1,14 +1,13 @@
|
||||
// module export
|
||||
var x = "Foo";
|
||||
|
||||
module m {
|
||||
export var x;
|
||||
}
|
||||
|
||||
module m {
|
||||
var z = 10000;
|
||||
export var y = {
|
||||
var z = x;
|
||||
var y = {
|
||||
a: x,
|
||||
x
|
||||
};
|
||||
}
|
||||
|
||||
m.y.x;
|
||||
|
||||
Reference in New Issue
Block a user