OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 part of world_builder; | 5 part of world_builder; |
6 | 6 |
7 /// World builder specific to codegen. | 7 /// World builder specific to codegen. |
8 /// | 8 /// |
9 /// This adds additional access to liveness of selectors and elements. | 9 /// This adds additional access to liveness of selectors and elements. |
10 abstract class CodegenWorldBuilder implements WorldBuilder { | 10 abstract class CodegenWorldBuilder implements WorldBuilder { |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 MethodElement function, void f(DartType type, String name)) { | 507 MethodElement function, void f(DartType type, String name)) { |
508 FunctionSignature parameters = function.functionSignature; | 508 FunctionSignature parameters = function.functionSignature; |
509 parameters.forEachParameter((ParameterElement parameter) { | 509 parameters.forEachParameter((ParameterElement parameter) { |
510 f(parameter.type, parameter.name); | 510 f(parameter.type, parameter.name); |
511 }); | 511 }); |
512 } | 512 } |
513 | 513 |
514 @override | 514 @override |
515 void _processInstantiatedClassMember( | 515 void _processInstantiatedClassMember( |
516 ClassEntity cls, MemberElement member, MemberUsedCallback memberUsed) { | 516 ClassEntity cls, MemberElement member, MemberUsedCallback memberUsed) { |
517 assert(invariant(member, member.isDeclaration)); | 517 assert(member.isDeclaration, failedAt(member)); |
518 if (member.isMalformed) return; | 518 if (member.isMalformed) return; |
519 super._processInstantiatedClassMember(cls, member, memberUsed); | 519 super._processInstantiatedClassMember(cls, member, memberUsed); |
520 } | 520 } |
521 | 521 |
522 @override | 522 @override |
523 _MemberUsage _getMemberUsage( | 523 _MemberUsage _getMemberUsage( |
524 MemberElement member, MemberUsedCallback memberUsed) { | 524 MemberElement member, MemberUsedCallback memberUsed) { |
525 assert(invariant(member, member.isDeclaration)); | 525 assert(member.isDeclaration, failedAt(member)); |
526 return super._getMemberUsage(member, memberUsed); | 526 return super._getMemberUsage(member, memberUsed); |
527 } | 527 } |
528 | 528 |
529 void registerStaticUse(StaticUse staticUse, MemberUsedCallback memberUsed) { | 529 void registerStaticUse(StaticUse staticUse, MemberUsedCallback memberUsed) { |
530 Element element = staticUse.element; | 530 Element element = staticUse.element; |
531 assert(invariant(element, element.isDeclaration, | 531 assert(element.isDeclaration, |
532 message: "Element ${element} is not the declaration.")); | 532 failedAt(element, "Element ${element} is not the declaration.")); |
533 super.registerStaticUse(staticUse, memberUsed); | 533 super.registerStaticUse(staticUse, memberUsed); |
534 } | 534 } |
535 | 535 |
536 /// Register the constant [use] with this world builder. Returns `true` if | 536 /// Register the constant [use] with this world builder. Returns `true` if |
537 /// the constant use was new to the world. | 537 /// the constant use was new to the world. |
538 @override | 538 @override |
539 bool registerConstantUse(ConstantUse use) { | 539 bool registerConstantUse(ConstantUse use) { |
540 if (use.kind == ConstantUseKind.DIRECT) { | 540 if (use.kind == ConstantUseKind.DIRECT) { |
541 _constants.addCompileTimeConstantForEmission(use.value); | 541 _constants.addCompileTimeConstantForEmission(use.value); |
542 } | 542 } |
(...skipping 30 matching lines...) Expand all Loading... |
573 throw new UnimplementedError('KernelCodegenWorldBuilder.forEachParameter'); | 573 throw new UnimplementedError('KernelCodegenWorldBuilder.forEachParameter'); |
574 } | 574 } |
575 | 575 |
576 @override | 576 @override |
577 void forEachInstanceField( | 577 void forEachInstanceField( |
578 ClassEntity cls, void f(ClassEntity declarer, FieldEntity field)) { | 578 ClassEntity cls, void f(ClassEntity declarer, FieldEntity field)) { |
579 throw new UnimplementedError( | 579 throw new UnimplementedError( |
580 'KernelCodegenWorldBuilder.forEachInstanceField'); | 580 'KernelCodegenWorldBuilder.forEachInstanceField'); |
581 } | 581 } |
582 } | 582 } |
OLD | NEW |