Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: tests/compiler/dart2js/compiler_helper.dart

Issue 1803303002: Move all flags to CompilerOptions (first step to stop passing the compiler to (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library compiler_helper; 5 library compiler_helper;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 9
10 import 'package:compiler/src/elements/elements.dart' 10 import 'package:compiler/src/elements/elements.dart'
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 Map<String, String> source; 115 Map<String, String> source;
116 if (entry != 'main') { 116 if (entry != 'main') {
117 source = {'main.dart': "$code\n\nmain() => $entry;" }; 117 source = {'main.dart': "$code\n\nmain() => $entry;" };
118 } else { 118 } else {
119 source = {'main.dart': code}; 119 source = {'main.dart': code};
120 } 120 }
121 121
122 CompilationResult result = await runCompiler( 122 CompilationResult result = await runCompiler(
123 memorySourceFiles: source, 123 memorySourceFiles: source,
124 options: options, 124 options: options,
125 outputProvider: outputCollector, 125 disableInlining: disableInlining,
126 beforeRun: (compiler) { 126 outputProvider: outputCollector);
127 if (disableInlining) {
128 compiler.disableInlining = true;
129 }
130 });
131 Expect.isTrue(result.isSuccess); 127 Expect.isTrue(result.isSuccess);
132 Compiler compiler = result.compiler; 128 Compiler compiler = result.compiler;
133 lego.Element element = compiler.mainApp.find(entry); 129 lego.Element element = compiler.mainApp.find(entry);
134 js.JavaScriptBackend backend = compiler.backend; 130 js.JavaScriptBackend backend = compiler.backend;
135 String generated = backend.getGeneratedCode(element); 131 String generated = backend.getGeneratedCode(element);
136 if (check != null) { 132 if (check != null) {
137 check(generated); 133 check(generated);
138 } 134 }
139 return returnAll ? outputCollector.getOutput('', 'js') : generated; 135 return returnAll ? outputCollector.getOutput('', 'js') : generated;
140 } 136 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); 287 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)');
292 final spaceRe = new RegExp('\\s+'); 288 final spaceRe = new RegExp('\\s+');
293 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); 289 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)');
294 if (shouldMatch) { 290 if (shouldMatch) {
295 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); 291 Expect.isTrue(new RegExp(regexp).hasMatch(generated));
296 } else { 292 } else {
297 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); 293 Expect.isFalse(new RegExp(regexp).hasMatch(generated));
298 } 294 }
299 }); 295 });
300 } 296 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698