regen sdk and expectations
diff --git a/test/codegen/expect/DeltaBlue.js b/test/codegen/expect/DeltaBlue.js index bd36f4f..8b7c278 100644 --- a/test/codegen/expect/DeltaBlue.js +++ b/test/codegen/expect/DeltaBlue.js
@@ -28,7 +28,7 @@ this.name = name; } nextWeaker() { - return dart.const_(dart.list([STRONG_PREFERRED, PREFERRED, STRONG_DEFAULT, NORMAL, WEAK_DEFAULT, WEAKEST], Strength))[dartx.get](this.value); + return dart.const(dart.list([STRONG_PREFERRED, PREFERRED, STRONG_DEFAULT, NORMAL, WEAK_DEFAULT, WEAKEST], Strength))[dartx.get](this.value); } static stronger(s1, s2) { return dart.notNull(s1.value) < dart.notNull(s2.value); @@ -54,13 +54,13 @@ }), names: ['stronger', 'weaker', 'weakest', 'strongest'] }); - const REQUIRED = dart.const_(new Strength(0, "required")); - const STRONG_PREFERRED = dart.const_(new Strength(1, "strongPreferred")); - const PREFERRED = dart.const_(new Strength(2, "preferred")); - const STRONG_DEFAULT = dart.const_(new Strength(3, "strongDefault")); - const NORMAL = dart.const_(new Strength(4, "normal")); - const WEAK_DEFAULT = dart.const_(new Strength(5, "weakDefault")); - const WEAKEST = dart.const_(new Strength(6, "weakest")); + const REQUIRED = dart.const(new Strength(0, "required")); + const STRONG_PREFERRED = dart.const(new Strength(1, "strongPreferred")); + const PREFERRED = dart.const(new Strength(2, "preferred")); + const STRONG_DEFAULT = dart.const(new Strength(3, "strongDefault")); + const NORMAL = dart.const(new Strength(4, "normal")); + const WEAK_DEFAULT = dart.const(new Strength(5, "weakDefault")); + const WEAKEST = dart.const(new Strength(6, "weakest")); class Constraint extends core.Object { Constraint(strength) { this.strength = strength;
diff --git a/test/codegen/expect/collection/priority_queue.js b/test/codegen/expect/collection/priority_queue.js index 04ecc42..a17ee31 100644 --- a/test/codegen/expect/collection/priority_queue.js +++ b/test/codegen/expect/collection/priority_queue.js
@@ -38,7 +38,7 @@ } } clear() { - this[_queue] = dart.const_(dart.list([], E)); + this[_queue] = dart.const(dart.list([], E)); this[_length] = 0; } contains(object) { @@ -76,7 +76,7 @@ removeAll() { let result = this[_queue]; let length = this[_length]; - this[_queue] = dart.const_(dart.list([], E)); + this[_queue] = dart.const(dart.list([], E)); this[_length] = 0; return result[dartx.take](length); }
diff --git a/test/codegen/expect/dom/dom.js b/test/codegen/expect/dom/dom.js index 6cd1f49..c577cad 100644 --- a/test/codegen/expect/dom/dom.js +++ b/test/codegen/expect/dom/dom.js
@@ -12,7 +12,7 @@ dart.setSignature(Overload, { constructors: () => ({Overload: [Overload, []]}) }); - const overload = dart.const_(new Overload()); + const overload = dart.const(new Overload()); class CustomEvent extends core.Object {} dart.setSignature(CustomEvent, { constructors: () => ({CustomEvent: [CustomEvent, [core.String], {detail: dart.dynamic, bubbles: dart.dynamic, cancelable: dart.dynamic}]})
diff --git a/test/codegen/expect/fieldtest.js b/test/codegen/expect/fieldtest.js index f9a1984..4d0a6cd 100644 --- a/test/codegen/expect/fieldtest.js +++ b/test/codegen/expect/fieldtest.js
@@ -105,11 +105,11 @@ }[this.index]; } }; - MyEnum.Val1 = dart.const_(new MyEnum(0)); - MyEnum.Val2 = dart.const_(new MyEnum(1)); - MyEnum.Val3 = dart.const_(new MyEnum(2)); - MyEnum.Val4 = dart.const_(new MyEnum(3)); - MyEnum.values = dart.const_(dart.list([MyEnum.Val1, MyEnum.Val2, MyEnum.Val3, MyEnum.Val4], MyEnum)); + MyEnum.Val1 = dart.const(new MyEnum(0)); + MyEnum.Val2 = dart.const(new MyEnum(1)); + MyEnum.Val3 = dart.const(new MyEnum(2)); + MyEnum.Val4 = dart.const(new MyEnum(3)); + MyEnum.values = dart.const(dart.list([MyEnum.Val1, MyEnum.Val2, MyEnum.Val3, MyEnum.Val4], MyEnum)); function main() { let a = new A(); foo(a);
diff --git a/test/codegen/expect/js/js.js b/test/codegen/expect/js/js.js index ecfed1a..336e12d 100644 --- a/test/codegen/expect/js/js.js +++ b/test/codegen/expect/js/js.js
@@ -23,7 +23,7 @@ dart.setSignature(_Anonymous, { constructors: () => ({_Anonymous: [_Anonymous, []]}) }); - const anonymous = dart.const_(new _Anonymous()); + const anonymous = dart.const(new _Anonymous()); // Exports: exports.JS = JS; exports.anonymous = anonymous;
diff --git a/test/codegen/expect/js/src/varargs.js b/test/codegen/expect/js/src/varargs.js index 1462de4..8a2f9d9 100644 --- a/test/codegen/expect/js/src/varargs.js +++ b/test/codegen/expect/js/src/varargs.js
@@ -12,7 +12,7 @@ dart.setSignature(_Rest, { constructors: () => ({_Rest: [_Rest, []]}) }); - const rest = dart.const_(new _Rest()); + const rest = dart.const(new _Rest()); function spread(args) { dart.throw(new core.StateError('The spread function cannot be called, ' + 'it should be compiled away.')); }
diff --git a/test/codegen/expect/misc.js b/test/codegen/expect/misc.js index 0bcb924..673cf39 100644 --- a/test/codegen/expect/misc.js +++ b/test/codegen/expect/misc.js
@@ -12,7 +12,7 @@ dart.setSignature(_Uninitialized, { constructors: () => ({_Uninitialized: [_Uninitialized, []]}) }); - const UNINITIALIZED = dart.const_(new _Uninitialized()); + const UNINITIALIZED = dart.const(new _Uninitialized()); const Generic$ = dart.generic(function(T) { class Generic extends core.Object { get type() { @@ -44,7 +44,7 @@ } dart.fn(_isWhitespace, core.bool, [core.String]); const expr = 'foo'; - const _escapeMap = dart.const_(dart.map({'\n': '\\n', '\r': '\\r', '\f': '\\f', '\b': '\\b', '\t': '\\t', '\v': '\\v', '': '\\x7F', [`\${${expr}}`]: ''})); + const _escapeMap = dart.const(dart.map({'\n': '\\n', '\r': '\\r', '\f': '\\f', '\b': '\\b', '\t': '\\t', '\v': '\\v', '': '\\x7F', [`\${${expr}}`]: ''})); function main() { core.print(dart.toString(1)); core.print(dart.toString(1.0));
diff --git a/test/codegen/expect/node_modules.js b/test/codegen/expect/node_modules.js new file mode 100644 index 0000000..8992f90 --- /dev/null +++ b/test/codegen/expect/node_modules.js
@@ -0,0 +1,48 @@ +'use strict'; +let dart = require("dart/_runtime"); +let core = require("dart/core"); +let dartx = dart.dartx; +const Callback = dart.typedef('Callback', () => dart.functionType(dart.void, [], {i: core.int})); +class A extends core.Object {} +class _A extends core.Object {} +const B$ = dart.generic(function(T) { + class B extends core.Object {} + return B; +}); +const B = B$(); +const _B$ = dart.generic(function(T) { + class _B extends core.Object {} + return _B; +}); +const _B = _B$(); +function f() { +} +dart.fn(f); +function _f() { +} +dart.fn(_f); +const constant = "abc"; +exports.finalConstant = "abc"; +exports.mutable = "abc"; +dart.defineLazyProperties(exports, { + get lazy() { + return dart.as(dart.fn(() => { + core.print('lazy'); + return "abc"; + })(), core.String); + }, + get lazyMutable() { + return dart.as(dart.fn(() => { + core.print('lazyMutable'); + return "abc"; + })(), core.String); + }, + set lazyMutable(_) {} +}); +// Exports: +exports.Callback = Callback; +exports.A = A; +exports.B$ = B$; +exports.B = B; +exports.f = f; +exports.constant = constant;
diff --git a/test/codegen/expect/node_modules.txt b/test/codegen/expect/node_modules.txt new file mode 100644 index 0000000..314e2da --- /dev/null +++ b/test/codegen/expect/node_modules.txt
@@ -0,0 +1 @@ +// Messages from compiling node_modules.dart
diff --git a/test/codegen/expect/sunflower/dom.js b/test/codegen/expect/sunflower/dom.js index c6594db..c324f79 100644 --- a/test/codegen/expect/sunflower/dom.js +++ b/test/codegen/expect/sunflower/dom.js
@@ -12,7 +12,7 @@ dart.setSignature(Overload, { constructors: () => ({Overload: [Overload, []]}) }); - const overload = dart.const_(new Overload()); + const overload = dart.const(new Overload()); class CustomEvent extends core.Object {} dart.setSignature(CustomEvent, { constructors: () => ({CustomEvent: [CustomEvent, [core.String], {detail: dart.dynamic, bubbles: dart.dynamic, cancelable: dart.dynamic}]})
diff --git a/test/codegen/node_modules.dart b/test/codegen/node_modules.dart new file mode 100644 index 0000000..6370fdc --- /dev/null +++ b/test/codegen/node_modules.dart
@@ -0,0 +1,25 @@ +library test; + +import 'dart:js'; + +typedef void Callback({int i}); + +class A {} +class _A {} +class B<T> {} +class _B<T> {} + +f() {} +_f() {} + +const String constant = "abc"; +final String finalConstant = "abc"; +final String lazy = (() { + print('lazy'); + return "abc"; +})(); +String mutable = "abc"; +String lazyMutable = (() { + print('lazyMutable'); + return "abc"; +})();
diff --git a/test/codegen_test.dart b/test/codegen_test.dart index 537c9b3..febd7a9 100644 --- a/test/codegen_test.dart +++ b/test/codegen_test.dart
@@ -153,7 +153,9 @@ var closure = filename == 'closure'; var moduleFormat = filename == 'es6_modules' ? ModuleFormat.es6 - : ModuleFormat.legacy; + : filename == 'node_modules' + ? ModuleFormat.node + : ModuleFormat.legacy; var success; // TODO(vsm): Is it okay to reuse the same context here? If there is // overlap between test files, we may need separate ones for each