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

Side by Side Diff: pkg/compiler/lib/src/resolution/registry.dart

Issue 1416253002: Remove requiredTypes (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 2 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) 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 dart2js.resolution.registry; 5 library dart2js.resolution.registry;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/backend_api.dart' show 8 import '../common/backend_api.dart' show
9 Backend, 9 Backend,
10 ForeignResolver; 10 ForeignResolver;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 void registerStaticInvocation(Element element) { 83 void registerStaticInvocation(Element element) {
84 world.registerStaticUse(element); 84 world.registerStaticUse(element);
85 } 85 }
86 86
87 String toString() => 'EagerRegistry for ${mapping.analyzedElement}'; 87 String toString() => 'EagerRegistry for ${mapping.analyzedElement}';
88 } 88 }
89 89
90 class _ResolutionWorldImpact extends ResolutionImpact with WorldImpactBuilder { 90 class _ResolutionWorldImpact extends ResolutionImpact with WorldImpactBuilder {
91 final String name; 91 final String name;
92 Setlet<Feature> _features; 92 Setlet<Feature> _features;
93 // TODO(johnniwinther): This seems to be a union of other sets.
94 Setlet<DartType> _requiredTypes;
95 Setlet<MapLiteralUse> _mapLiterals; 93 Setlet<MapLiteralUse> _mapLiterals;
96 Setlet<ListLiteralUse> _listLiterals; 94 Setlet<ListLiteralUse> _listLiterals;
97 Setlet<String> _constSymbolNames; 95 Setlet<String> _constSymbolNames;
98 96
99 _ResolutionWorldImpact(this.name); 97 _ResolutionWorldImpact(this.name);
100 98
101 void registerRequiredType(DartType type) {
102 assert(type != null);
103 if (_requiredTypes == null) {
104 _requiredTypes = new Setlet<DartType>();
105 }
106 _requiredTypes.add(type);
107 }
108
109 @override
110 Iterable<DartType> get requiredTypes {
111 return _requiredTypes != null
112 ? _requiredTypes : const <DartType>[];
113 }
114
115 void registerMapLiteral(MapLiteralUse mapLiteralUse) { 99 void registerMapLiteral(MapLiteralUse mapLiteralUse) {
116 assert(mapLiteralUse != null); 100 assert(mapLiteralUse != null);
117 if (_mapLiterals == null) { 101 if (_mapLiterals == null) {
118 _mapLiterals = new Setlet<MapLiteralUse>(); 102 _mapLiterals = new Setlet<MapLiteralUse>();
119 } 103 }
120 _mapLiterals.add(mapLiteralUse); 104 _mapLiterals.add(mapLiteralUse);
121 } 105 }
122 106
123 @override 107 @override
124 Iterable<MapLiteralUse> get mapLiterals { 108 Iterable<MapLiteralUse> get mapLiterals {
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 ////////////////////////////////////////////////////////////////////////////// 346 //////////////////////////////////////////////////////////////////////////////
363 347
364 void registerStaticUse(Element element) { 348 void registerStaticUse(Element element) {
365 worldImpact.registerStaticUse(element); 349 worldImpact.registerStaticUse(element);
366 } 350 }
367 351
368 void registerImplicitSuperCall(FunctionElement superConstructor) { 352 void registerImplicitSuperCall(FunctionElement superConstructor) {
369 registerStaticUse(superConstructor); 353 registerStaticUse(superConstructor);
370 } 354 }
371 355
372 // TODO(johnniwinther): Remove this.
373 // Use [registerInstantiatedType] of `rawType` instead.
374 @deprecated
375 void registerInstantiatedClass(ClassElement element) {
376 element.ensureResolved(compiler.resolution);
377 registerInstantiatedType(element.rawType);
378 }
379
380 void registerLazyField() { 356 void registerLazyField() {
381 worldImpact.registerFeature(Feature.LAZY_FIELD); 357 worldImpact.registerFeature(Feature.LAZY_FIELD);
382 } 358 }
383 359
384 void registerMetadataConstant(MetadataAnnotation metadata) { 360 void registerMetadataConstant(MetadataAnnotation metadata) {
385 backend.registerMetadataConstant(metadata, metadata.annotatedElement, this); 361 backend.registerMetadataConstant(metadata, metadata.annotatedElement, this);
386 } 362 }
387 363
388 void registerThrowRuntimeError() { 364 void registerThrowRuntimeError() {
389 worldImpact.registerFeature(Feature.THROW_RUNTIME_ERROR); 365 worldImpact.registerFeature(Feature.THROW_RUNTIME_ERROR);
390 } 366 }
391 367
392 void registerCompileTimeError(ErroneousElement error) { 368 void registerCompileTimeError(ErroneousElement error) {
393 worldImpact.registerFeature(Feature.COMPILE_TIME_ERROR); 369 worldImpact.registerFeature(Feature.COMPILE_TIME_ERROR);
394 } 370 }
395 371
396 void registerTypeVariableBoundCheck() { 372 void registerTypeVariableBoundCheck() {
397 worldImpact.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK); 373 worldImpact.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK);
398 } 374 }
399 375
400 void registerThrowNoSuchMethod() { 376 void registerThrowNoSuchMethod() {
401 worldImpact.registerFeature(Feature.THROW_NO_SUCH_METHOD); 377 worldImpact.registerFeature(Feature.THROW_NO_SUCH_METHOD);
402 } 378 }
403 379
404 /// Register a checked mode check against [type]. 380 /// Register a checked mode check against [type].
405 void registerCheckedModeCheck(DartType type) { 381 void registerCheckedModeCheck(DartType type) {
406 worldImpact.registerCheckedModeCheckedType(type); 382 worldImpact.registerCheckedModeCheckedType(type);
407 mapping.addRequiredType(type); 383 }
384
385 /// Register an on-catch clause of [type].
386 void registerOnCatchType(DartType type) {
387 worldImpact.registerOnCatchType(type);
408 } 388 }
409 389
410 /// Register an is-test or is-not-test of [type]. 390 /// Register an is-test or is-not-test of [type].
411 void registerIsCheck(DartType type) { 391 void registerIsCheck(DartType type) {
412 worldImpact.registerIsCheck(type); 392 worldImpact.registerIsCheck(type);
413 mapping.addRequiredType(type);
414 } 393 }
415 394
416 /// Register an as-cast of [type]. 395 /// Register an as-cast of [type].
417 void registerAsCast(DartType type) { 396 void registerAsCast(DartType type) {
418 worldImpact.registerAsCast(type); 397 worldImpact.registerAsCast(type);
419 mapping.addRequiredType(type);
420 } 398 }
421 399
422 void registerClosure(LocalFunctionElement element) { 400 void registerClosure(LocalFunctionElement element) {
423 worldImpact.registerClosure(element); 401 worldImpact.registerClosure(element);
424 } 402 }
425 403
426 void registerSuperUse(Node node) { 404 void registerSuperUse(Node node) {
427 mapping.addSuperUse(node); 405 mapping.addSuperUse(node);
428 } 406 }
429 407
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 void registerConstSymbol(String name) { 462 void registerConstSymbol(String name) {
485 worldImpact.registerConstSymbolName(name); 463 worldImpact.registerConstSymbolName(name);
486 } 464 }
487 465
488 void registerSymbolConstructor() { 466 void registerSymbolConstructor() {
489 worldImpact.registerFeature(Feature.SYMBOL_CONSTRUCTOR); 467 worldImpact.registerFeature(Feature.SYMBOL_CONSTRUCTOR);
490 } 468 }
491 469
492 void registerInstantiatedType(InterfaceType type) { 470 void registerInstantiatedType(InterfaceType type) {
493 worldImpact.registerInstantiatedType(type); 471 worldImpact.registerInstantiatedType(type);
494 mapping.addRequiredType(type);
495 } 472 }
496 473
497 void registerAbstractClassInstantiation() { 474 void registerAbstractClassInstantiation() {
498 worldImpact.registerFeature(Feature.ABSTRACT_CLASS_INSTANTIATION); 475 worldImpact.registerFeature(Feature.ABSTRACT_CLASS_INSTANTIATION);
499 } 476 }
500 477
501 void registerRequiredType(DartType type, Element enclosingElement) {
502 worldImpact.registerRequiredType(type);
503 mapping.addRequiredType(type);
504 }
505
506 void registerStringInterpolation() { 478 void registerStringInterpolation() {
507 worldImpact.registerFeature(Feature.STRING_INTERPOLATION); 479 worldImpact.registerFeature(Feature.STRING_INTERPOLATION);
508 } 480 }
509 481
510 void registerFallThroughError() { 482 void registerFallThroughError() {
511 worldImpact.registerFeature(Feature.FALL_THROUGH_ERROR); 483 worldImpact.registerFeature(Feature.FALL_THROUGH_ERROR);
512 } 484 }
513 485
514 void registerCatchStatement() { 486 void registerCatchStatement() {
515 worldImpact.registerFeature(Feature.CATCH_STATEMENT); 487 worldImpact.registerFeature(Feature.CATCH_STATEMENT);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 @override 576 @override
605 void registerInstantiatedType(InterfaceType type) { 577 void registerInstantiatedType(InterfaceType type) {
606 registry.registerInstantiatedType(type); 578 registry.registerInstantiatedType(type);
607 } 579 }
608 580
609 @override 581 @override
610 DartType resolveTypeFromString(Node node, String typeName) { 582 DartType resolveTypeFromString(Node node, String typeName) {
611 return visitor.resolveTypeFromString(node, typeName); 583 return visitor.resolveTypeFromString(node, typeName);
612 } 584 }
613 } 585 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/members.dart ('k') | pkg/compiler/lib/src/resolution/resolution.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698