test/com/google/javascript/jscomp/Es6TranspilationIntegrationTest.java
/** Class expressions that are the RHS of a 'var' statement. */
Class expressions that are the RHS of a 'var' statement.
Class expressions that are the RHS of a ' var ' statement .
@Test
  public void testClassExpressionInVar() {
    test("var C = class { }",
        "/** @constructor @struct */ var C = function() {}");
    test(
        "var C = class { foo() {} }",
        lines(
            "/** @constructor @struct */ var C = function() {}",
            "",
            "C.prototype.foo = function() {}"));
    test(
        "var C = class C { }",
        lines(
            "/** @constructor @struct @const */",
            "var testcode$classdecl$var0 = function() {};",
            "/** @constructor */",
            "var C = testcode$classdecl$var0;"));
    test(
        "var C = class C { foo() {} }",
        lines(
            "/** @constructor @struct @const */",
            "var testcode$classdecl$var0 = function() {}",
            "testcode$classdecl$var0.prototype.foo = function() {};",
            "",
            "/** @constructor */",
            "var C = testcode$classdecl$var0;"));
  }
@ Test public void testClassExpressionInVar ( ) { test ( "var C = class { }" , "/** @constructor @struct */ var C = function() {}" ) ; test ( "var C = class { foo() {} }" , lines ( "/** @constructor @struct */ var C = function() {}" , "" , "C.prototype.foo = function() {}" ) ) ; test ( "var C = class C { }" , lines ( "/** @constructor @struct @const */" , "var testcode$classdecl$var0 = function() {};" , "/** @constructor */" , "var C = testcode$classdecl$var0;" ) ) ; test ( "var C = class C { foo() {} }" , lines ( "/** @constructor @struct @const */" , "var testcode$classdecl$var0 = function() {}" , "testcode$classdecl$var0.prototype.foo = function() {};" , "" , "/** @constructor */" , "var C = testcode$classdecl$var0;" ) ) ; }
Class expressions that are the RHS of a 'var' statement.
Class expressions that are the RHS of a ' var ' statement .