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

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

Issue 2858223004: Rename KernelElementAdapter and element_adapter.dart to IrToElementMap and ir_map.dart (Closed)
Patch Set: Updated cf. comments. Created 3 years, 7 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 // Partial test that the closed world computed from [WorldImpact]s derived from 5 // Partial test that the closed world computed from [WorldImpact]s derived from
6 // kernel is equivalent to the original computed from resolution. 6 // kernel is equivalent to the original computed from resolution.
7 library dart2js.kernel.compiler_helper; 7 library dart2js.kernel.compiler_helper;
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 10
11 import 'package:compiler/src/commandline_options.dart'; 11 import 'package:compiler/src/commandline_options.dart';
12 import 'package:compiler/src/common.dart'; 12 import 'package:compiler/src/common.dart';
13 import 'package:compiler/src/common/names.dart'; 13 import 'package:compiler/src/common/names.dart';
14 import 'package:compiler/src/common/tasks.dart'; 14 import 'package:compiler/src/common/tasks.dart';
15 import 'package:compiler/src/compiler.dart'; 15 import 'package:compiler/src/compiler.dart';
16 import 'package:compiler/src/elements/elements.dart'; 16 import 'package:compiler/src/elements/elements.dart';
17 import 'package:compiler/src/kernel/element_map.dart'; 17 import 'package:compiler/src/kernel/element_map_impl.dart';
18 import 'package:compiler/src/kernel/kernel_strategy.dart'; 18 import 'package:compiler/src/kernel/kernel_strategy.dart';
19 import 'package:compiler/src/library_loader.dart'; 19 import 'package:compiler/src/library_loader.dart';
20 import 'package:compiler/src/universe/world_builder.dart'; 20 import 'package:compiler/src/universe/world_builder.dart';
21 import 'package:compiler/src/util/util.dart'; 21 import 'package:compiler/src/util/util.dart';
22 import 'package:expect/expect.dart'; 22 import 'package:expect/expect.dart';
23 import 'package:kernel/ast.dart' as ir; 23 import 'package:kernel/ast.dart' as ir;
24 import '../memory_compiler.dart'; 24 import '../memory_compiler.dart';
25 25
26 typedef Future<Compiler> CompileFunction(); 26 typedef Future<Compiler> CompileFunction();
27 27
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 entryPoint: uri, 60 entryPoint: uri,
61 memorySourceFiles: memorySourceFiles, 61 memorySourceFiles: memorySourceFiles,
62 options: [ 62 options: [
63 Flags.analyzeOnly, 63 Flags.analyzeOnly,
64 Flags.enableAssertMessage, 64 Flags.enableAssertMessage,
65 Flags.loadFromDill 65 Flags.loadFromDill
66 ]); 66 ]);
67 ElementResolutionWorldBuilder.useInstantiationMap = true; 67 ElementResolutionWorldBuilder.useInstantiationMap = true;
68 compiler2.resolution.retainCachesForTesting = true; 68 compiler2.resolution.retainCachesForTesting = true;
69 KernelFrontEndStrategy frontEndStrategy = compiler2.frontEndStrategy; 69 KernelFrontEndStrategy frontEndStrategy = compiler2.frontEndStrategy;
70 KernelToElementMap elementMap = frontEndStrategy.elementMap; 70 KernelToElementMapImpl elementMap = frontEndStrategy.elementMap;
71 ir.Program program = new ir.Program( 71 ir.Program program = new ir.Program(
72 compiler.backend.kernelTask.kernel.libraryDependencies(uri)); 72 compiler.backend.kernelTask.kernel.libraryDependencies(uri));
73 LibraryElement library = compiler.libraryLoader.lookupLibrary(uri); 73 LibraryElement library = compiler.libraryLoader.lookupLibrary(uri);
74 Expect.isNotNull(library, 'No library found for $uri'); 74 Expect.isNotNull(library, 'No library found for $uri');
75 program.mainMethod = compiler.backend.kernelTask.kernel 75 program.mainMethod = compiler.backend.kernelTask.kernel
76 .functionToIr(library.findExported(Identifiers.main)); 76 .functionToIr(library.findExported(Identifiers.main));
77 compiler2.libraryLoader = new MemoryDillLibraryLoaderTask( 77 compiler2.libraryLoader = new MemoryDillLibraryLoaderTask(
78 elementMap, compiler2.reporter, compiler2.measurer, program); 78 elementMap, compiler2.reporter, compiler2.measurer, program);
79 await compiler2.run(uri); 79 await compiler2.run(uri);
80 return compiler2; 80 return compiler2;
(...skipping 24 matching lines...) Expand all
105 entryPoint: entryPoint, 105 entryPoint: entryPoint,
106 memorySourceFiles: memorySourceFiles, 106 memorySourceFiles: memorySourceFiles,
107 options: [ 107 options: [
108 Flags.analyzeOnly, 108 Flags.analyzeOnly,
109 Flags.enableAssertMessage, 109 Flags.enableAssertMessage,
110 Flags.loadFromDill 110 Flags.loadFromDill
111 ]); 111 ]);
112 ElementResolutionWorldBuilder.useInstantiationMap = true; 112 ElementResolutionWorldBuilder.useInstantiationMap = true;
113 compiler2.resolution.retainCachesForTesting = true; 113 compiler2.resolution.retainCachesForTesting = true;
114 KernelFrontEndStrategy frontEndStrategy = compiler2.frontEndStrategy; 114 KernelFrontEndStrategy frontEndStrategy = compiler2.frontEndStrategy;
115 KernelToElementMap elementMap = frontEndStrategy.elementMap; 115 KernelToElementMapImpl elementMap = frontEndStrategy.elementMap;
116 compiler2.libraryLoader = new MemoryDillLibraryLoaderTask( 116 compiler2.libraryLoader = new MemoryDillLibraryLoaderTask(
117 elementMap, 117 elementMap,
118 compiler2.reporter, 118 compiler2.reporter,
119 compiler2.measurer, 119 compiler2.measurer,
120 compiler.backend.kernelTask.program); 120 compiler.backend.kernelTask.program);
121 await compiler2.run(entryPoint); 121 await compiler2.run(entryPoint);
122 return new Pair<Compiler, Compiler>(compiler, compiler2); 122 return new Pair<Compiler, Compiler>(compiler, compiler2);
123 } 123 }
124 124
125 class MemoryDillLibraryLoaderTask extends DillLibraryLoaderTask { 125 class MemoryDillLibraryLoaderTask extends DillLibraryLoaderTask {
126 final ir.Program program; 126 final ir.Program program;
127 127
128 MemoryDillLibraryLoaderTask(KernelToElementMap elementMap, 128 MemoryDillLibraryLoaderTask(KernelToElementMapImpl elementMap,
129 DiagnosticReporter reporter, Measurer measurer, this.program) 129 DiagnosticReporter reporter, Measurer measurer, this.program)
130 : super(elementMap, null, null, reporter, measurer); 130 : super(elementMap, null, null, reporter, measurer);
131 131
132 Future<LoadedLibraries> loadLibrary(Uri resolvedUri, 132 Future<LoadedLibraries> loadLibrary(Uri resolvedUri,
133 {bool skipFileWithPartOfTag: false}) async { 133 {bool skipFileWithPartOfTag: false}) async {
134 return createLoadedLibraries(program); 134 return createLoadedLibraries(program);
135 } 135 }
136 } 136 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/kernel/closed_world2_test.dart ('k') | tests/compiler/dart2js/kernel/impact_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698