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

Side by Side Diff: pkg/compiler/lib/src/kernel/kernel.dart

Issue 2760923004: Eliminate multi-callback structure for LibraryLoader. (Closed)
Patch Set: . Created 3 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) 2016, the Dart project authors. Please see the AUTHORS file 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 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:collection' show Queue; 6 import 'dart:collection' show Queue;
7 7
8 import 'package:kernel/ast.dart' as ir; 8 import 'package:kernel/ast.dart' as ir;
9 import 'package:kernel/verifier.dart' show CheckParentPointers; 9 import 'package:kernel/verifier.dart' show CheckParentPointers;
10 10
(...skipping 19 matching lines...) Expand all
30 ExportElement, 30 ExportElement,
31 FieldElement, 31 FieldElement,
32 FunctionElement, 32 FunctionElement,
33 ImportElement, 33 ImportElement,
34 LibraryElement, 34 LibraryElement,
35 LocalFunctionElement, 35 LocalFunctionElement,
36 MetadataAnnotation, 36 MetadataAnnotation,
37 MixinApplicationElement, 37 MixinApplicationElement,
38 TypeVariableElement; 38 TypeVariableElement;
39 import '../elements/modelx.dart' show ErroneousFieldElementX; 39 import '../elements/modelx.dart' show ErroneousFieldElementX;
40 import '../library_loader.dart' show LoadedLibraries;
40 import '../tree/tree.dart' show FunctionExpression, Node; 41 import '../tree/tree.dart' show FunctionExpression, Node;
41 import 'constant_visitor.dart'; 42 import 'constant_visitor.dart';
42 import 'kernel_visitor.dart' show IrFunction, KernelVisitor; 43 import 'kernel_visitor.dart' show IrFunction, KernelVisitor;
43 44
44 typedef void WorkAction(); 45 typedef void WorkAction();
45 46
46 class WorkItem { 47 class WorkItem {
47 final Element element; 48 final Element element;
48 final WorkAction action; 49 final WorkAction action;
49 50
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 ClassElement cls = element.enclosingClass; 136 ClassElement cls = element.enclosingClass;
136 if (cls != null && cls.isMixinApplication) { 137 if (cls != null && cls.isMixinApplication) {
137 MixinApplicationElement mixinApplication = cls; 138 MixinApplicationElement mixinApplication = cls;
138 element = mixinApplication.mixin; 139 element = mixinApplication.mixin;
139 } 140 }
140 irLibrary = libraryToIr(element.library); 141 irLibrary = libraryToIr(element.library);
141 } 142 }
142 return new ir.Name(name, irLibrary); 143 return new ir.Name(name, irLibrary);
143 } 144 }
144 145
145 Future<ir.Library> loadLibrary(Uri uri) async { 146 Future<ir.Library> loadLibrary(Uri uri) async {
Siggi Cherem (dart-lang) 2017/03/24 17:40:27 it appears this method is never called, so we can
Emily Fortuna 2017/03/24 18:30:19 ah good point!
146 return libraryToIr(await compiler.libraryLoader.loadLibrary(uri)); 147 LoadedLibraries libraries = await compiler.libraryLoader.loadLibrary(uri);
148 await compiler.processLoadedLibraries(libraries);
149 return libraryToIr(libraries.rootLibrary);
147 } 150 }
148 151
149 ir.Library libraryToIr(LibraryElement library) { 152 ir.Library libraryToIr(LibraryElement library) {
150 library = library.declaration; 153 library = library.declaration;
151 return libraries.putIfAbsent(library, () { 154 return libraries.putIfAbsent(library, () {
152 String name = library.hasLibraryName ? library.libraryName : null; 155 String name = library.hasLibraryName ? library.libraryName : null;
153 ir.Library libraryNode = new ir.Library(library.canonicalUri, 156 ir.Library libraryNode = new ir.Library(library.canonicalUri,
154 name: name, classes: null, procedures: null, fields: null); 157 name: name, classes: null, procedures: null, fields: null);
155 addWork(library, () { 158 addWork(library, () {
156 Queue<ir.Class> classes = new Queue<ir.Class>(); 159 Queue<ir.Class> classes = new Queue<ir.Class>();
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 } 787 }
785 788
786 class ConstructorTarget { 789 class ConstructorTarget {
787 final ConstructorElement element; 790 final ConstructorElement element;
788 final ResolutionDartType type; 791 final ResolutionDartType type;
789 792
790 ConstructorTarget(this.element, this.type); 793 ConstructorTarget(this.element, this.type);
791 794
792 String toString() => "ConstructorTarget($element, $type)"; 795 String toString() => "ConstructorTarget($element, $type)";
793 } 796 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698