Index: test/codegen/expect/closure.js |
diff --git a/test/codegen/expect/closure.js b/test/codegen/expect/closure.js |
index 6547938d252d28503e63e6b82545499c1950b2db..897bd7927d5e3fb427e93d71b004fec0e3d94b5c 100644 |
--- a/test/codegen/expect/closure.js |
+++ b/test/codegen/expect/closure.js |
@@ -1,16 +1,12 @@ |
-const exports = {}; |
-import dart from "./dart/_runtime"; |
-import core from "./dart/core"; |
-import js from "./dart/js"; |
-let dartx = dart.dartx; |
-function generic_function<T>(items: core.List<T>, seed: T): core.List<T> { |
+export const closure = Object.create(null); |
+import { core, js, dart, dartx } from 'dart_sdk'; |
+closure.generic_function = function<T>(items: core.List<T>, seed: T): core.List<T> { |
let strings = items[dartx.map](dart.fn((i: T): string => `${i}`, core.String, [dart.dynamic]))[dartx.toList](); |
return items; |
-} |
-dart.fn(generic_function, () => dart.definiteFunctionType(core.List, [core.List, dart.dynamic])); |
-/** @typedef */ |
-const Callback = dart.typedef('Callback', () => dart.functionType(dart.void, [], {i: core.int})); |
-const Foo$ = dart.generic(function(T) { |
+}; |
+dart.fn(closure.generic_function, core.List, [core.List, dart.dynamic]); |
+closure.Callback = dart.typedef('Callback', () => dart.functionType(dart.void, [], {i: core.int})); |
+closure.Foo$ = dart.generic(T => { |
class Foo<T> extends core.Object { |
i: number; |
b: boolean; |
@@ -26,20 +22,20 @@ const Foo$ = dart.generic(function(T) { |
this.s = null; |
} |
static build() { |
- return new (Foo$(T))(1, null); |
+ return new (closure.Foo$(T))(1, null); |
} |
untyped_method(a, b) {} |
pass(t: T) { |
dart.as(t, T); |
return t; |
} |
- typed_method(foo: Foo<any>, list: core.List<any>, i: number, n: number, d: number, b: boolean, s: string, a: any[], o: Object, f: Function) { |
+ typed_method(foo: closure.Foo<any>, list: core.List<any>, i: number, n: number, d: number, b: boolean, s: string, a: any[], o: Object, f: Function) { |
return ''; |
} |
optional_params(a, b = null, c: number = null) {} |
static named_params(a, {b = null, c = null}: {b?: any, c?: number} = {}) {} |
nullary_method() {} |
- function_params(f: (x: any, y?: any) => number, g: (x: any, opts?: {y?: string, z?: any}) => any, cb: Callback) { |
+ function_params(f: (x: any, y?: any) => number, g: (x: any, opts?: {y?: string, z?: any}) => any, cb: closure.Callback) { |
dart.as(f, dart.functionType(core.int, [dart.dynamic], [dart.dynamic])); |
dart.as(g, dart.functionType(dart.dynamic, [dart.dynamic], {y: core.String, z: dart.dynamic})); |
cb({i: this.i}); |
@@ -59,56 +55,45 @@ const Foo$ = dart.generic(function(T) { |
} |
dart.setSignature(Foo, { |
constructors: () => ({ |
- Foo: [Foo$(T), [core.int, T]], |
- build: [Foo$(T), []] |
+ Foo: [closure.Foo$(T), [core.int, T]], |
+ build: [closure.Foo$(T), []] |
}), |
methods: () => ({ |
untyped_method: [dart.dynamic, [dart.dynamic, dart.dynamic]], |
pass: [T, [T]], |
- typed_method: [core.String, [Foo$(), core.List, core.int, core.num, core.double, core.bool, core.String, js.JsArray, js.JsObject, js.JsFunction]], |
+ typed_method: [core.String, [closure.Foo, core.List, core.int, core.num, core.double, core.bool, core.String, js.JsArray, js.JsObject, js.JsFunction]], |
optional_params: [dart.dynamic, [dart.dynamic], [dart.dynamic, core.int]], |
nullary_method: [dart.dynamic, []], |
- function_params: [dart.dynamic, [dart.functionType(core.int, [dart.dynamic], [dart.dynamic]), dart.functionType(dart.dynamic, [dart.dynamic], {y: core.String, z: dart.dynamic}), Callback]], |
+ function_params: [dart.dynamic, [dart.functionType(core.int, [dart.dynamic], [dart.dynamic]), dart.functionType(dart.dynamic, [dart.dynamic], {y: core.String, z: dart.dynamic}), closure.Callback]], |
run: [dart.dynamic, [core.List, core.String, dart.functionType(core.List, [core.String]), dart.functionType(core.List$(core.int), [dart.functionType(dart.dynamic, [dart.dynamic])])], {h: core.Map$(core.Map, core.Map)}] |
}), |
statics: () => ({named_params: [dart.dynamic, [dart.dynamic], {b: dart.dynamic, c: core.int}]}), |
names: ['named_params'] |
}); |
- /** @final {string} */ |
- Foo.some_static_constant = "abc"; |
- /** @final {string} */ |
- Foo.some_static_final = "abc"; |
- /** @type {string} */ |
- Foo.some_static_var = "abc"; |
return Foo; |
}); |
-let Foo = Foo$(); |
-class Bar extends core.Object {} |
-const Baz$super = dart.mixin(Foo$(core.int), Bar); |
-class Baz extends Baz$super { |
+closure.Foo = closure.Foo$(); |
+/** @final {string} */ |
+closure.Foo.some_static_constant = "abc"; |
+/** @final {string} */ |
+closure.Foo.some_static_final = "abc"; |
+/** @type {string} */ |
+closure.Foo.some_static_var = "abc"; |
+closure.Bar = class Bar extends core.Object {}; |
+closure.Baz = class Baz extends dart.mixin(closure.Foo$(core.int), closure.Bar) { |
Baz(i: number) { |
super.Foo(i, 123); |
} |
-} |
-dart.setSignature(Baz, { |
- constructors: () => ({Baz: [Baz, [core.int]]}) |
+}; |
+dart.setSignature(closure.Baz, { |
+ constructors: () => ({Baz: [closure.Baz, [core.int]]}) |
}); |
-function main(args): void { |
-} |
-dart.fn(main, dart.void, [dart.dynamic]); |
+closure.main = function(args): void { |
+}; |
+dart.fn(closure.main, dart.void, [dart.dynamic]); |
/** @final {string} */ |
-const some_top_level_constant: string = "abc"; |
+closure.some_top_level_constant = "abc"; |
/** @final {string} */ |
-exports.some_top_level_final = "abc"; |
+closure.some_top_level_final = "abc"; |
/** @type {string} */ |
-exports.some_top_level_var = "abc"; |
-// Exports: |
-exports.generic_function = generic_function; |
-exports.Callback = Callback; |
-exports.Foo$ = Foo$; |
-exports.Foo = Foo; |
-exports.Bar = Bar; |
-exports.Baz = Baz; |
-exports.main = main; |
-exports.some_top_level_constant = some_top_level_constant; |
-export default exports; |
+closure.some_top_level_var = "abc"; |