@@ -43,8 +43,9 @@ main() {
4343 ..compileSdk = true // To prevent FE from loading an sdk-summary.
4444 ..onDiagnostic = errors.add;
4545
46- var component =
47- await compileScript ('main() => print("hi");' , options: options);
46+ Component component =
47+ (await compileScript ('main() => print("hi");' , options: options))
48+ ? .component;
4849 expect (component, isNotNull);
4950 expect (errors, isNotEmpty);
5051 });
@@ -56,8 +57,9 @@ main() {
5657 Uri .parse ('org-dartlang-test:///not_existing_summary_file' )
5758 ..onDiagnostic = errors.add;
5859
59- var component =
60- await compileScript ('main() => print("hi");' , options: options);
60+ Component component =
61+ (await compileScript ('main() => print("hi");' , options: options))
62+ ? .component;
6163 expect (component, isNotNull);
6264 expect (errors, isNotEmpty);
6365 });
@@ -69,8 +71,9 @@ main() {
6971 // contains broken URIs to ensure we do not attempt to lookup for
7072 // sources of the sdk directly.
7173 ..librariesSpecificationUri = invalidCoreLibsSpecUri;
72- var component =
73- await compileScript ('main() => print("hi");' , options: options);
74+ Component component =
75+ (await compileScript ('main() => print("hi");' , options: options))
76+ ? .component;
7477 var core = component.libraries.firstWhere (isDartCoreLibrary);
7578 var printMember = core.members.firstWhere ((m) => m.name.name == 'print' );
7679
@@ -87,8 +90,10 @@ main() {
8790 });
8891
8992 test ('generated program contains source-info' , () async {
90- var component = await compileScript ('a() => print("hi"); main() {}' ,
91- fileName: 'a.dart' );
93+ Component component = (await compileScript (
94+ 'a() => print("hi"); main() {}' ,
95+ fileName: 'a.dart' ))
96+ ? .component;
9297 // Kernel always store an empty '' key in the map, so there is always at
9398 // least one. Having more means that source-info is added.
9499 expect (component.uriToSource.keys.length, greaterThan (1 ));
@@ -98,8 +103,10 @@ main() {
98103 });
99104
100105 test ('code from summary dependencies are marked external' , () async {
101- var component = await compileScript ('a() => print("hi"); main() {}' ,
102- fileName: 'a.dart' );
106+ Component component = (await compileScript (
107+ 'a() => print("hi"); main() {}' ,
108+ fileName: 'a.dart' ))
109+ ? .component;
103110 for (var lib in component.libraries) {
104111 if (lib.importUri.scheme == 'dart' ) {
105112 expect (lib.isExternal, isTrue);
@@ -108,36 +115,40 @@ main() {
108115
109116 // Pretend that the compiled code is a summary
110117 var bytes = serializeComponent (component);
111- component = await compileScript (
112- {
113- 'b.dart' : 'import "a.dart" as m; b() => m.a(); main() {}' ,
114- 'summary.dill' : bytes
115- },
116- fileName: 'b.dart' ,
117- inputSummaries: ['summary.dill' ]);
118+ component = (await compileScript (
119+ {
120+ 'b.dart' : 'import "a.dart" as m; b() => m.a(); main() {}' ,
121+ 'summary.dill' : bytes
122+ },
123+ fileName: 'b.dart' ,
124+ inputSummaries: ['summary.dill' ]))
125+ ? .component;
118126
119127 var aLib = component.libraries
120128 .firstWhere ((lib) => lib.importUri.path == '/a/b/c/a.dart' );
121129 expect (aLib.isExternal, isTrue);
122130 });
123131
124132 test ('code from linked dependencies are not marked external' , () async {
125- var component = await compileScript ('a() => print("hi"); main() {}' ,
126- fileName: 'a.dart' );
133+ Component component = (await compileScript (
134+ 'a() => print("hi"); main() {}' ,
135+ fileName: 'a.dart' ))
136+ ? .component;
127137 for (var lib in component.libraries) {
128138 if (lib.importUri.scheme == 'dart' ) {
129139 expect (lib.isExternal, isTrue);
130140 }
131141 }
132142
133143 var bytes = serializeComponent (component);
134- component = await compileScript (
135- {
136- 'b.dart' : 'import "a.dart" as m; b() => m.a(); main() {}' ,
137- 'link.dill' : bytes
138- },
139- fileName: 'b.dart' ,
140- linkedDependencies: ['link.dill' ]);
144+ component = (await compileScript (
145+ {
146+ 'b.dart' : 'import "a.dart" as m; b() => m.a(); main() {}' ,
147+ 'link.dill' : bytes
148+ },
149+ fileName: 'b.dart' ,
150+ linkedDependencies: ['link.dill' ]))
151+ ? .component;
141152
142153 var aLib = component.libraries
143154 .firstWhere ((lib) => lib.importUri.path == '/a/b/c/a.dart' );
0 commit comments