Support automatic semicolon insertion in class member declarations.

This commit is contained in:
Daniel Rosenwasser
2014-07-16 16:40:20 -07:00
parent 0f7de96483
commit df5c2547fa
5 changed files with 55 additions and 36 deletions

View File

@@ -1,9 +0,0 @@
==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration26.ts (2 errors) ====
class C {
var
~~~
!!! Unexpected token. A constructor, method, accessor, or property was expected.
public
}
~
!!! Declaration or statement expected.

View File

@@ -0,0 +1,12 @@
//// [parserClassDeclaration26.ts]
class C {
var
public
}
//// [parserClassDeclaration26.js]
var C = (function () {
function C() {
}
return C;
})();

View File

@@ -1,24 +0,0 @@
==== tests/cases/compiler/varAsID.ts (2 errors) ====
class Foo {
var; // ok
x=1;
}
var f = new Foo();
class Foo2 {
var // not an error, because of ASI.
~~~
!!! Unexpected token. A constructor, method, accessor, or property was expected.
x=1;
}
~
!!! Declaration or statement expected.
var f2 = new Foo2();

View File

@@ -0,0 +1,36 @@
//// [varAsID.ts]
class Foo {
var; // ok
x=1;
}
var f = new Foo();
class Foo2 {
var // not an error, because of ASI.
x=1;
}
var f2 = new Foo2();
//// [varAsID.js]
var Foo = (function () {
function Foo() {
this.x = 1;
}
return Foo;
})();
var f = new Foo();
var Foo2 = (function () {
function Foo2() {
this.x = 1;
}
return Foo2;
})();
var f2 = new Foo2();