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

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

Issue 2841583002: Add FrontEndStrategy, ResolutionFrontEndStrategy and KernelFrontEndStrategy (Closed)
Patch Set: Updated cf. comments Created 3 years, 8 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:io'; 6 import 'dart:io';
7 import 'memory_compiler.dart'; 7 import 'memory_compiler.dart';
8 import 'package:async_helper/async_helper.dart'; 8 import 'package:async_helper/async_helper.dart';
9 import 'package:compiler/src/common_elements.dart';
9 import 'package:compiler/src/diagnostics/spannable.dart' show Spannable; 10 import 'package:compiler/src/diagnostics/spannable.dart' show Spannable;
10 import 'package:compiler/src/elements/entities.dart' 11 import 'package:compiler/src/elements/entities.dart'
11 show LibraryEntity, ClassEntity; 12 show LibraryEntity, ClassEntity;
12 import 'package:compiler/src/kernel/world_builder.dart';
13 import 'package:compiler/src/library_loader.dart' 13 import 'package:compiler/src/library_loader.dart'
14 show ScriptLoader, LibraryLoaderTask; 14 show ScriptLoader, DillLibraryLoaderTask;
15 import 'package:compiler/src/script.dart' show Script; 15 import 'package:compiler/src/script.dart' show Script;
16 import 'package:compiler/src/apiimpl.dart' show CompilerImpl; 16 import 'package:compiler/src/apiimpl.dart' show CompilerImpl;
17 import "package:expect/expect.dart"; 17 import "package:expect/expect.dart";
18 import 'package:path/path.dart' as path; 18 import 'package:path/path.dart' as path;
19 19
20 final String dartkExecutable = Platform.isWindows 20 final String dartkExecutable = Platform.isWindows
21 ? 'tools/dartk_wrappers/dartk.bat' 21 ? 'tools/dartk_wrappers/dartk.bat'
22 : 'tools/dartk_wrappers/dartk'; 22 : 'tools/dartk_wrappers/dartk';
23 23
24 /// Run the dartk.dart script, and return the binary encoded results. 24 /// Run the dartk.dart script, and return the binary encoded results.
(...skipping 26 matching lines...) Expand all
51 Uri entryPoint = Uri.parse('memory:main.dill'); 51 Uri entryPoint = Uri.parse('memory:main.dill');
52 List<int> kernelBinary = runDartk(filename); 52 List<int> kernelBinary = runDartk(filename);
53 53
54 CompilerImpl compiler = compilerFor( 54 CompilerImpl compiler = compilerFor(
55 entryPoint: entryPoint, 55 entryPoint: entryPoint,
56 memorySourceFiles: {'main.dill': kernelBinary}, 56 memorySourceFiles: {'main.dill': kernelBinary},
57 diagnosticHandler: diagnostics, 57 diagnosticHandler: diagnostics,
58 outputProvider: output, 58 outputProvider: output,
59 options: ['--read-dill']); 59 options: ['--read-dill']);
60 await compiler.setupSdk(); 60 await compiler.setupSdk();
61 dynamic loader = new LibraryLoaderTask( 61 await compiler.libraryLoader.loadLibrary(entryPoint);
62 true,
63 compiler.resolvedUriTranslator,
64 new TestScriptLoader(compiler),
65 null,
66 null,
67 null,
68 null,
69 null,
70 compiler.reporter,
71 compiler.measurer);
72
73 await loader.loadLibrary(entryPoint);
74 62
75 Expect.equals(0, diagnostics.errors.length); 63 Expect.equals(0, diagnostics.errors.length);
76 Expect.equals(0, diagnostics.warnings.length); 64 Expect.equals(0, diagnostics.warnings.length);
77 65
78 KernelWorldBuilder worldBuilder = loader.worldBuilder; 66 ElementEnvironment environment = compiler.elementEnvironment;
79 LibraryEntity library = worldBuilder.lookupLibrary(uri); 67 LibraryEntity library = environment.lookupLibrary(uri);
80 Expect.isNotNull(library); 68 Expect.isNotNull(library);
81 ClassEntity clss = worldBuilder.lookupClass(library, 'ListLiteralTest'); 69 ClassEntity clss = environment.lookupClass(library, 'ListLiteralTest');
82 Expect.isNotNull(clss); 70 Expect.isNotNull(clss);
83 var member = worldBuilder.lookupClassMember(clss, 'testMain'); 71 var member = environment.lookupClassMember(clss, 'testMain');
84 Expect.isNotNull(member); 72 Expect.isNotNull(member);
85 }); 73 });
86 } 74 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | tests/compiler/dart2js/kernel/closed_world2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698