OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dart2js; | 5 part of dart2js; |
6 | 6 |
7 abstract class ConstantVisitor<R> { | 7 abstract class ConstantVisitor<R> { |
8 const ConstantVisitor(); | 8 const ConstantVisitor(); |
9 | 9 |
10 R visitFunction(FunctionConstant constant); | 10 R visitFunction(FunctionConstant constant); |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 return other is InterceptorConstant | 537 return other is InterceptorConstant |
538 && dispatchedType == other.dispatchedType; | 538 && dispatchedType == other.dispatchedType; |
539 } | 539 } |
540 | 540 |
541 int get hashCode => dispatchedType.hashCode * 43; | 541 int get hashCode => dispatchedType.hashCode * 43; |
542 | 542 |
543 List<Constant> getDependencies() => const <Constant>[]; | 543 List<Constant> getDependencies() => const <Constant>[]; |
544 | 544 |
545 accept(ConstantVisitor visitor) => visitor.visitInterceptor(this); | 545 accept(ConstantVisitor visitor) => visitor.visitInterceptor(this); |
546 | 546 |
547 DartType computeType(Compiler compiler) => compiler.types.dynamicType; | 547 DartType computeType(Compiler compiler) => const DynamicType(); |
548 | 548 |
549 ti.TypeMask computeMask(Compiler compiler) { | 549 ti.TypeMask computeMask(Compiler compiler) { |
550 return compiler.typesTask.nonNullType; | 550 return compiler.typesTask.nonNullType; |
551 } | 551 } |
552 | 552 |
553 String toString() { | 553 String toString() { |
554 return 'InterceptorConstant(${dispatchedType.getStringAsDeclared("o")})'; | 554 return 'InterceptorConstant(${dispatchedType.getStringAsDeclared("o")})'; |
555 } | 555 } |
556 } | 556 } |
557 | 557 |
558 class DummyConstant extends Constant { | 558 class DummyConstant extends Constant { |
559 final ti.TypeMask typeMask; | 559 final ti.TypeMask typeMask; |
560 | 560 |
561 DummyConstant(this.typeMask); | 561 DummyConstant(this.typeMask); |
562 | 562 |
563 bool get isDummy => true; | 563 bool get isDummy => true; |
564 | 564 |
565 bool operator ==(other) { | 565 bool operator ==(other) { |
566 return other is DummyConstant | 566 return other is DummyConstant |
567 && typeMask == other.typeMask; | 567 && typeMask == other.typeMask; |
568 } | 568 } |
569 | 569 |
570 get hashCode => typeMask.hashCode; | 570 get hashCode => typeMask.hashCode; |
571 | 571 |
572 List<Constant> getDependencies() => const <Constant>[]; | 572 List<Constant> getDependencies() => const <Constant>[]; |
573 | 573 |
574 accept(ConstantVisitor visitor) => visitor.visitDummy(this); | 574 accept(ConstantVisitor visitor) => visitor.visitDummy(this); |
575 | 575 |
576 DartType computeType(Compiler compiler) => compiler.types.dynamicType; | 576 DartType computeType(Compiler compiler) => const DynamicType(); |
577 | 577 |
578 ti.TypeMask computeMask(Compiler compiler) => typeMask; | 578 ti.TypeMask computeMask(Compiler compiler) => typeMask; |
579 | 579 |
580 String toString() { | 580 String toString() { |
581 return 'DummyConstant($typeMask)'; | 581 return 'DummyConstant($typeMask)'; |
582 } | 582 } |
583 } | 583 } |
584 | 584 |
585 class ConstructedConstant extends ObjectConstant { | 585 class ConstructedConstant extends ObjectConstant { |
586 final List<Constant> fields; | 586 final List<Constant> fields; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 DartType computeType(Compiler compiler) => referenced.computeType(compiler); | 681 DartType computeType(Compiler compiler) => referenced.computeType(compiler); |
682 | 682 |
683 ti.TypeMask computeMask(Compiler compiler) { | 683 ti.TypeMask computeMask(Compiler compiler) { |
684 return referenced.computeMask(compiler); | 684 return referenced.computeMask(compiler); |
685 } | 685 } |
686 | 686 |
687 String toString() { | 687 String toString() { |
688 return 'DeferredConstant($referenced)'; | 688 return 'DeferredConstant($referenced)'; |
689 } | 689 } |
690 } | 690 } |
OLD | NEW |