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

Side by Side Diff: tests/compiler/dart2js/kernel/helper.dart

Issue 2275603004: Add empty kernel-ssa test (Closed)
Patch Set: Also add a status file Created 4 years, 4 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
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'package:compiler/src/elements/elements.dart' show Element;
6 import 'package:compiler/src/js_backend/backend.dart' show JavaScriptBackend;
7 import 'package:compiler/src/commandline_options.dart' show Flags;
8 import 'package:test/test.dart';
9
10 import '../memory_compiler.dart';
11
12 Future<String> compile(String code, {String entry: 'main',
13 bool useKernel: true}) async {
14 List<String> options = <String>[
15 Flags.disableTypeInference,
16 Flags.disableInlining,
17 ];
18 if (useKernel) options.add(Flags.useKernel);
19
20 if (entry != 'main' && !code.contains('main')) {
21 code = "$code\n\nmain() => $entry;";
22 }
23 CompilationResult result = await runCompiler(
24 memorySourceFiles: {'main.dart': code},
25 options: options);
26 expect(result.isSuccess, isTrue);
27 Compiler compiler = result.compiler;
28 Element element = compiler.mainApp.find(entry);
29 js.JavaScriptBackend backend = compiler.backend;
30 return backend.getGeneratedCode(element);
31 }
32
33 void check(String code, {String entry: 'main'}) async {
34 var original = await compile(code, entry: entry, useKernel: false);
35 var kernel = await compile(code, entry: entry, useKernel: true);
36 expect(original, kernel);
37 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/kernel/empty_test.dart ('k') | tests/compiler/dart2js/memory_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698