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

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

Issue 1019923005: Dart2js deferred loading. Follow types of functions when calculating dependencies. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix indentation Created 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/compiler/lib/src/elements/modelx.dart » ('j') | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library deferred_load; 5 library deferred_load;
6 6
7 import 'constants/expressions.dart'; 7 import 'constants/expressions.dart';
8 import 'constants/values.dart' show 8 import 'constants/values.dart' show
9 ConstantValue, 9 ConstantValue,
10 ConstructedConstantValue, 10 ConstructedConstantValue,
(...skipping 20 matching lines...) Expand all
31 ElementKind, 31 ElementKind,
32 Elements, 32 Elements,
33 FunctionElement, 33 FunctionElement,
34 LibraryElement, 34 LibraryElement,
35 MetadataAnnotation, 35 MetadataAnnotation,
36 PrefixElement, 36 PrefixElement,
37 ScopeContainerElement, 37 ScopeContainerElement,
38 TypedefElement, 38 TypedefElement,
39 VoidElement; 39 VoidElement;
40 40
41 import 'dart_types.dart';
42
41 import 'util/util.dart' show 43 import 'util/util.dart' show
42 Link, makeUnique; 44 Link, makeUnique;
43 import 'util/uri_extras.dart' as uri_extras; 45 import 'util/uri_extras.dart' as uri_extras;
44 46
45 import 'util/setlet.dart' show 47 import 'util/setlet.dart' show
46 Setlet; 48 Setlet;
47 49
48 import 'tree/tree.dart' show 50 import 'tree/tree.dart' show
49 Import, 51 Import,
50 LibraryTag, 52 LibraryTag,
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 296 }
295 297
296 // TODO(sigurdm): How is metadata on a patch-class handled? 298 // TODO(sigurdm): How is metadata on a patch-class handled?
297 for (MetadataAnnotation metadata in element.metadata) { 299 for (MetadataAnnotation metadata in element.metadata) {
298 ConstantExpression constant = 300 ConstantExpression constant =
299 backend.constants.getConstantForMetadata(metadata); 301 backend.constants.getConstantForMetadata(metadata);
300 if (constant != null) { 302 if (constant != null) {
301 addConstants(constant.value); 303 addConstants(constant.value);
302 } 304 }
303 } 305 }
306
307 collectTypeDependencies(DartType type) {
308 if (type is FunctionType) {
309 for (DartType argumentType in type.parameterTypes) {
310 collectTypeDependencies(argumentType);
311 }
312 for (DartType argumentType in type.optionalParameterTypes) {
313 collectTypeDependencies(argumentType);
314 }
315 for (DartType argumentType in type.namedParameterTypes) {
316 collectTypeDependencies(argumentType);
317 }
318 collectTypeDependencies(type.returnType);
319 } else if (type is TypedefType) {
320 type.element.alias;
karlklose 2015/04/13 08:10:57 Add the type's element to elements? Shouldn't thi
sigurdm 2015/04/13 13:37:08 Done
321 } else if (type is InterfaceType) {
322 elements.add(type.element);
323 }
324 }
325
326 if (element is FunctionElement) {
327 collectTypeDependencies(element.type);
328 }
329
304 if (element.isClass) { 330 if (element.isClass) {
305 // If we see a class, add everything its live instance members refer 331 // If we see a class, add everything its live instance members refer
306 // to. Static members are not relevant, unless we are processing 332 // to. Static members are not relevant, unless we are processing
307 // extra dependencies due to mirrors. 333 // extra dependencies due to mirrors.
308 void addLiveInstanceMember(Element element) { 334 void addLiveInstanceMember(Element element) {
309 if (!compiler.enqueuer.resolution.hasBeenResolved(element)) return; 335 if (!compiler.enqueuer.resolution.hasBeenResolved(element)) return;
310 if (!isMirrorUsage && !element.isInstanceMember) return; 336 if (!isMirrorUsage && !element.isInstanceMember) return;
311 collectDependencies(element.implementation); 337 collectDependencies(element.implementation);
312 } 338 }
313 ClassElement cls = element.declaration; 339 ClassElement cls = element.declaration;
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 _importingLibrary = importingLibrary; 855 _importingLibrary = importingLibrary;
830 856
831 String get importingLibraryName { 857 String get importingLibraryName {
832 String libraryName = _importingLibrary.getLibraryName(); 858 String libraryName = _importingLibrary.getLibraryName();
833 return libraryName == "" 859 return libraryName == ""
834 ? "<unnamed>" 860 ? "<unnamed>"
835 : libraryName; 861 : libraryName;
836 } 862 }
837 863
838 } 864 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/elements/modelx.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698