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

Side by Side Diff: pkg/kernel/lib/analyzer/loader.dart

Issue 2617963002: Option to include redirecting factories. (Closed)
Patch Set: Changed upstream branch, no code changes. Created 3 years, 11 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 | « pkg/kernel/lib/analyzer/ast_from_analyzer.dart ('k') | no next file » | 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) 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 library kernel.analyzer.loader; 4 library kernel.analyzer.loader;
5 5
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:io' as io; 7 import 'dart:io' as io;
8 8
9 import 'package:analyzer/analyzer.dart'; 9 import 'package:analyzer/analyzer.dart';
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 ast.Member getMemberReference(Element element); 75 ast.Member getMemberReference(Element element);
76 ast.Class getRootClassReference(); 76 ast.Class getRootClassReference();
77 ast.Constructor getRootClassConstructorReference(); 77 ast.Constructor getRootClassConstructorReference();
78 ast.Class getCoreClassReference(String className); 78 ast.Class getCoreClassReference(String className);
79 ast.Constructor getCoreClassConstructorReference(String className, 79 ast.Constructor getCoreClassConstructorReference(String className,
80 {String constructorName, String library}); 80 {String constructorName, String library});
81 ast.TypeParameter tryGetClassTypeParameter(TypeParameterElement element); 81 ast.TypeParameter tryGetClassTypeParameter(TypeParameterElement element);
82 ast.Class getSharedMixinApplicationClass( 82 ast.Class getSharedMixinApplicationClass(
83 ast.Library library, ast.Class supertype, ast.Class mixin); 83 ast.Library library, ast.Class supertype, ast.Class mixin);
84 bool get strongMode; 84 bool get strongMode;
85
86 /// Whether or not to include redirecting factories in the output.
87 bool get ignoreRedirectingFactories;
85 } 88 }
86 89
87 class DartLoader implements ReferenceLevelLoader { 90 class DartLoader implements ReferenceLevelLoader {
88 final Repository repository; 91 final Repository repository;
89 final ApplicationRoot applicationRoot; 92 final ApplicationRoot applicationRoot;
90 final Bimap<ClassElement, ast.Class> _classes = 93 final Bimap<ClassElement, ast.Class> _classes =
91 new Bimap<ClassElement, ast.Class>(); 94 new Bimap<ClassElement, ast.Class>();
92 final Bimap<Element, ast.Member> _members = new Bimap<Element, ast.Member>(); 95 final Bimap<Element, ast.Member> _members = new Bimap<Element, ast.Member>();
93 final Map<TypeParameterElement, ast.TypeParameter> _classTypeParameters = 96 final Map<TypeParameterElement, ast.TypeParameter> _classTypeParameters =
94 <TypeParameterElement, ast.TypeParameter>{}; 97 <TypeParameterElement, ast.TypeParameter>{};
95 final Map<ast.Library, Map<String, ast.Class>> _mixinApplications = 98 final Map<ast.Library, Map<String, ast.Class>> _mixinApplications =
96 <ast.Library, Map<String, ast.Class>>{}; 99 <ast.Library, Map<String, ast.Class>>{};
97 final AnalysisContext context; 100 final AnalysisContext context;
98 LibraryElement _dartCoreLibrary; 101 LibraryElement _dartCoreLibrary;
99 final List errors = []; 102 final List errors = [];
100 final List libraryElements = []; 103 final List libraryElements = [];
101 104
102 /// Classes that have been referenced, and must be promoted to type level 105 /// Classes that have been referenced, and must be promoted to type level
103 /// so as not to expose partially initialized classes. 106 /// so as not to expose partially initialized classes.
104 final List<ast.Class> temporaryClassWorklist = []; 107 final List<ast.Class> temporaryClassWorklist = [];
105 108
109 final bool ignoreRedirectingFactories;
110
106 LibraryElement _libraryBeingLoaded = null; 111 LibraryElement _libraryBeingLoaded = null;
107 112
108 bool get strongMode => context.analysisOptions.strongMode; 113 bool get strongMode => context.analysisOptions.strongMode;
109 114
110 DartLoader(this.repository, DartOptions options, Packages packages, 115 DartLoader(this.repository, DartOptions options, Packages packages,
111 {DartSdk dartSdk}) 116 {DartSdk dartSdk, this.ignoreRedirectingFactories: true})
112 : this.context = createContext(options, packages, dartSdk: dartSdk), 117 : this.context = createContext(options, packages, dartSdk: dartSdk),
113 this.applicationRoot = options.applicationRoot; 118 this.applicationRoot = options.applicationRoot;
114 119
115 String getLibraryName(LibraryElement element) { 120 String getLibraryName(LibraryElement element) {
116 return element.name.isEmpty ? null : element.name; 121 return element.name.isEmpty ? null : element.name;
117 } 122 }
118 123
119 ast.Library getLibraryReference(LibraryElement element) { 124 ast.Library getLibraryReference(LibraryElement element) {
120 var uri = applicationRoot.relativeUri(element.source.uri); 125 var uri = applicationRoot.relativeUri(element.source.uri);
121 return repository.getLibraryReference(uri) 126 return repository.getLibraryReference(uri)
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 AnalysisContext context = AnalysisEngine.instance.createAnalysisContext() 861 AnalysisContext context = AnalysisEngine.instance.createAnalysisContext()
857 ..sourceFactory = new SourceFactory(resolvers) 862 ..sourceFactory = new SourceFactory(resolvers)
858 ..analysisOptions = createAnalysisOptions(options.strongMode); 863 ..analysisOptions = createAnalysisOptions(options.strongMode);
859 864
860 options.declaredVariables.forEach((String name, String value) { 865 options.declaredVariables.forEach((String name, String value) {
861 context.declaredVariables.define(name, value); 866 context.declaredVariables.define(name, value);
862 }); 867 });
863 868
864 return context; 869 return context;
865 } 870 }
OLDNEW
« no previous file with comments | « pkg/kernel/lib/analyzer/ast_from_analyzer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698