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

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

Issue 1422623014: Add TypeUse. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 13 matching lines...) Expand all
24 import '../elements/elements.dart'; 24 import '../elements/elements.dart';
25 import '../tree/tree.dart'; 25 import '../tree/tree.dart';
26 import '../util/util.dart' show 26 import '../util/util.dart' show
27 Setlet; 27 Setlet;
28 import '../universe/call_structure.dart' show 28 import '../universe/call_structure.dart' show
29 CallStructure; 29 CallStructure;
30 import '../universe/selector.dart' show 30 import '../universe/selector.dart' show
31 Selector; 31 Selector;
32 import '../universe/use.dart' show 32 import '../universe/use.dart' show
33 DynamicUse, 33 DynamicUse,
34 StaticUse; 34 StaticUse,
35 TypeUse;
35 import '../universe/world_impact.dart' show 36 import '../universe/world_impact.dart' show
36 WorldImpactBuilder; 37 WorldImpactBuilder;
37 import '../world.dart' show World; 38 import '../world.dart' show World;
38 39
39 import 'send_structure.dart'; 40 import 'send_structure.dart';
40 41
41 import 'members.dart' show 42 import 'members.dart' show
42 ResolverVisitor; 43 ResolverVisitor;
43 import 'tree_elements.dart' show 44 import 'tree_elements.dart' show
44 TreeElementMapping; 45 TreeElementMapping;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 309 }
309 310
310 void registerTypeVariableBoundCheck() { 311 void registerTypeVariableBoundCheck() {
311 worldImpact.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK); 312 worldImpact.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK);
312 } 313 }
313 314
314 void registerThrowNoSuchMethod() { 315 void registerThrowNoSuchMethod() {
315 worldImpact.registerFeature(Feature.THROW_NO_SUCH_METHOD); 316 worldImpact.registerFeature(Feature.THROW_NO_SUCH_METHOD);
316 } 317 }
317 318
318 /// Register a checked mode check against [type]. 319 /// Register the use of a type.
319 void registerCheckedModeCheck(DartType type) { 320 void registerTypeUse(TypeUse typeUse) {
320 worldImpact.registerCheckedModeCheckedType(type); 321 worldImpact.registerTypeUse(typeUse);
321 }
322
323 /// Register an on-catch clause of [type].
324 void registerOnCatchType(DartType type) {
325 worldImpact.registerOnCatchType(type);
326 }
327
328 /// Register an is-test or is-not-test of [type].
329 void registerIsCheck(DartType type) {
330 worldImpact.registerIsCheck(type);
331 }
332
333 /// Register an as-cast of [type].
334 void registerAsCast(DartType type) {
335 worldImpact.registerAsCast(type);
336 } 322 }
337 323
338 void registerClosure(LocalFunctionElement element) { 324 void registerClosure(LocalFunctionElement element) {
339 worldImpact.registerClosure(element); 325 worldImpact.registerClosure(element);
340 } 326 }
341 327
342 void registerSuperUse(Node node) { 328 void registerSuperUse(Node node) {
343 mapping.addSuperUse(node); 329 mapping.addSuperUse(node);
344 } 330 }
345 331
346 void registerSuperNoSuchMethod() { 332 void registerSuperNoSuchMethod() {
347 worldImpact.registerFeature(Feature.SUPER_NO_SUCH_METHOD); 333 worldImpact.registerFeature(Feature.SUPER_NO_SUCH_METHOD);
348 } 334 }
349 335
350 void registerTypeLiteral(Send node, DartType type) { 336 void registerTypeLiteral(Send node, DartType type) {
351 mapping.setType(node, type); 337 mapping.setType(node, type);
352 worldImpact.registerTypeLiteral(type); 338 worldImpact.registerTypeUse(new TypeUse.typeLiteral(type));
353 } 339 }
354 340
355 void registerLiteralList(Node node, 341 void registerLiteralList(Node node,
356 InterfaceType type, 342 InterfaceType type,
357 {bool isConstant, 343 {bool isConstant,
358 bool isEmpty}) { 344 bool isEmpty}) {
359 setType(node, type); 345 setType(node, type);
360 worldImpact.registerListLiteral( 346 worldImpact.registerListLiteral(
361 new ListLiteralUse(type, isConstant: isConstant, isEmpty: isEmpty)); 347 new ListLiteralUse(type, isConstant: isConstant, isEmpty: isEmpty));
362 } 348 }
(...skipping 21 matching lines...) Expand all
384 } 370 }
385 371
386 void registerConstSymbol(String name) { 372 void registerConstSymbol(String name) {
387 worldImpact.registerConstSymbolName(name); 373 worldImpact.registerConstSymbolName(name);
388 } 374 }
389 375
390 void registerSymbolConstructor() { 376 void registerSymbolConstructor() {
391 worldImpact.registerFeature(Feature.SYMBOL_CONSTRUCTOR); 377 worldImpact.registerFeature(Feature.SYMBOL_CONSTRUCTOR);
392 } 378 }
393 379
394 void registerInstantiatedType(InterfaceType type) {
395 worldImpact.registerInstantiatedType(type);
396 }
397
398 void registerAbstractClassInstantiation() { 380 void registerAbstractClassInstantiation() {
399 worldImpact.registerFeature(Feature.ABSTRACT_CLASS_INSTANTIATION); 381 worldImpact.registerFeature(Feature.ABSTRACT_CLASS_INSTANTIATION);
400 } 382 }
401 383
402 void registerStringInterpolation() { 384 void registerStringInterpolation() {
403 worldImpact.registerFeature(Feature.STRING_INTERPOLATION); 385 worldImpact.registerFeature(Feature.STRING_INTERPOLATION);
404 } 386 }
405 387
406 void registerFallThroughError() { 388 void registerFallThroughError() {
407 worldImpact.registerFeature(Feature.FALL_THROUGH_ERROR); 389 worldImpact.registerFeature(Feature.FALL_THROUGH_ERROR);
(...skipping 18 matching lines...) Expand all
426 void registerMixinUse(MixinApplicationElement mixinApplication, 408 void registerMixinUse(MixinApplicationElement mixinApplication,
427 ClassElement mixin) { 409 ClassElement mixin) {
428 universe.registerMixinUse(mixinApplication, mixin); 410 universe.registerMixinUse(mixinApplication, mixin);
429 } 411 }
430 412
431 void registerThrowExpression() { 413 void registerThrowExpression() {
432 worldImpact.registerFeature(Feature.THROW_EXPRESSION); 414 worldImpact.registerFeature(Feature.THROW_EXPRESSION);
433 } 415 }
434 416
435 void registerInstantiation(InterfaceType type) { 417 void registerInstantiation(InterfaceType type) {
436 registerInstantiatedType(type); 418 worldImpact.registerTypeUse(new TypeUse.instantiation(type));
437 } 419 }
438 420
439 void registerAssert(bool hasMessage) { 421 void registerAssert(bool hasMessage) {
440 worldImpact.registerFeature( 422 worldImpact.registerFeature(
441 hasMessage ? Feature.ASSERT_WITH_MESSAGE : Feature.ASSERT); 423 hasMessage ? Feature.ASSERT_WITH_MESSAGE : Feature.ASSERT);
442 } 424 }
443 425
444 void registerSendStructure(Send node, SendStructure sendStructure) { 426 void registerSendStructure(Send node, SendStructure sendStructure) {
445 mapping.setSendStructure(node, sendStructure); 427 mapping.setSendStructure(node, sendStructure);
446 } 428 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 468
487 ForeignResolutionResolver(this.visitor, this.registry); 469 ForeignResolutionResolver(this.visitor, this.registry);
488 470
489 @override 471 @override
490 ConstantExpression getConstant(Node node) { 472 ConstantExpression getConstant(Node node) {
491 return registry.getConstant(node); 473 return registry.getConstant(node);
492 } 474 }
493 475
494 @override 476 @override
495 void registerInstantiatedType(InterfaceType type) { 477 void registerInstantiatedType(InterfaceType type) {
496 registry.registerInstantiatedType(type); 478 registry.registerInstantiation(type);
497 } 479 }
498 480
499 @override 481 @override
500 DartType resolveTypeFromString(Node node, String typeName) { 482 DartType resolveTypeFromString(Node node, String typeName) {
501 return visitor.resolveTypeFromString(node, typeName); 483 return visitor.resolveTypeFromString(node, typeName);
502 } 484 }
503 } 485 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698