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

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
« no previous file with comments | « tests/compiler/dart2js/codegen_helper.dart ('k') | tests/compiler/dart2js/exit_code_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 if (minify) { 105 if (minify) {
106 options.add(Flags.minify); 106 options.add(Flags.minify);
107 } 107 }
108 if (analyzeAll) { 108 if (analyzeAll) {
109 options.add(Flags.analyzeAll); 109 options.add(Flags.analyzeAll);
110 } 110 }
111 if (trustJSInteropTypeAnnotations) { 111 if (trustJSInteropTypeAnnotations) {
112 options.add(Flags.trustJSInteropTypeAnnotations); 112 options.add(Flags.trustJSInteropTypeAnnotations);
113 } 113 }
114 114
115 if (disableInlining) {
116 options.add(Flags.disableInlining);
117 }
118
115 Map<String, String> source; 119 Map<String, String> source;
116 if (entry != 'main') { 120 if (entry != 'main') {
117 source = {'main.dart': "$code\n\nmain() => $entry;" }; 121 source = {'main.dart': "$code\n\nmain() => $entry;" };
118 } else { 122 } else {
119 source = {'main.dart': code}; 123 source = {'main.dart': code};
120 } 124 }
121 125
122 CompilationResult result = await runCompiler( 126 CompilationResult result = await runCompiler(
123 memorySourceFiles: source, 127 memorySourceFiles: source,
124 options: options, 128 options: options,
125 outputProvider: outputCollector, 129 outputProvider: outputCollector);
126 beforeRun: (compiler) {
127 if (disableInlining) {
128 compiler.disableInlining = true;
129 }
130 });
131 Expect.isTrue(result.isSuccess); 130 Expect.isTrue(result.isSuccess);
132 Compiler compiler = result.compiler; 131 Compiler compiler = result.compiler;
133 lego.Element element = compiler.mainApp.find(entry); 132 lego.Element element = compiler.mainApp.find(entry);
134 js.JavaScriptBackend backend = compiler.backend; 133 js.JavaScriptBackend backend = compiler.backend;
135 String generated = backend.getGeneratedCode(element); 134 String generated = backend.getGeneratedCode(element);
136 if (check != null) { 135 if (check != null) {
137 check(generated); 136 check(generated);
138 } 137 }
139 return returnAll ? outputCollector.getOutput('', 'js') : generated; 138 return returnAll ? outputCollector.getOutput('', 'js') : generated;
140 } 139 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); 290 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)');
292 final spaceRe = new RegExp('\\s+'); 291 final spaceRe = new RegExp('\\s+');
293 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); 292 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)');
294 if (shouldMatch) { 293 if (shouldMatch) {
295 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); 294 Expect.isTrue(new RegExp(regexp).hasMatch(generated));
296 } else { 295 } else {
297 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); 296 Expect.isFalse(new RegExp(regexp).hasMatch(generated));
298 } 297 }
299 }); 298 });
300 } 299 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/codegen_helper.dart ('k') | tests/compiler/dart2js/exit_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698