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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/constants.dart

Issue 172853007: Rename DummyRecieverConstant to DummyConstant (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 | sdk/lib/_internal/compiler/implementation/ir/ir_pickler.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) 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 R visitFunction(FunctionConstant constant); 8 R visitFunction(FunctionConstant constant);
9 R visitNull(NullConstant constant); 9 R visitNull(NullConstant constant);
10 R visitInt(IntConstant constant); 10 R visitInt(IntConstant constant);
11 R visitDouble(DoubleConstant constant); 11 R visitDouble(DoubleConstant constant);
12 R visitTrue(TrueConstant constant); 12 R visitTrue(TrueConstant constant);
13 R visitFalse(FalseConstant constant); 13 R visitFalse(FalseConstant constant);
14 R visitString(StringConstant constant); 14 R visitString(StringConstant constant);
15 R visitList(ListConstant constant); 15 R visitList(ListConstant constant);
16 R visitMap(MapConstant constant); 16 R visitMap(MapConstant constant);
17 R visitConstructed(ConstructedConstant constant); 17 R visitConstructed(ConstructedConstant constant);
18 R visitType(TypeConstant constant); 18 R visitType(TypeConstant constant);
19 R visitInterceptor(InterceptorConstant constant); 19 R visitInterceptor(InterceptorConstant constant);
20 R visitDummyReceiver(DummyReceiverConstant constant); 20 R visitDummy(DummyConstant constant);
21 } 21 }
22 22
23 abstract class Constant { 23 abstract class Constant {
24 const Constant(); 24 const Constant();
25 25
26 bool isNull() => false; 26 bool isNull() => false;
27 bool isBool() => false; 27 bool isBool() => false;
28 bool isTrue() => false; 28 bool isTrue() => false;
29 bool isFalse() => false; 29 bool isFalse() => false;
30 bool isInt() => false; 30 bool isInt() => false;
31 bool isDouble() => false; 31 bool isDouble() => false;
32 bool isNum() => false; 32 bool isNum() => false;
33 bool isString() => false; 33 bool isString() => false;
34 bool isList() => false; 34 bool isList() => false;
35 bool isMap() => false; 35 bool isMap() => false;
36 bool isConstructedObject() => false; 36 bool isConstructedObject() => false;
37 bool isFunction() => false; 37 bool isFunction() => false;
38 /** Returns true if the constant is null, a bool, a number or a string. */ 38 /** Returns true if the constant is null, a bool, a number or a string. */
39 bool isPrimitive() => false; 39 bool isPrimitive() => false;
40 /** Returns true if the constant is a list, a map or a constructed object. */ 40 /** Returns true if the constant is a list, a map or a constructed object. */
41 bool isObject() => false; 41 bool isObject() => false;
42 bool isType() => false; 42 bool isType() => false;
43 bool isSentinel() => false; 43 bool isSentinel() => false;
44 bool isInterceptor() => false; 44 bool isInterceptor() => false;
45 bool isDummyReceiver() => false; 45 bool isDummy() => false;
46 46
47 bool isNaN() => false; 47 bool isNaN() => false;
48 bool isMinusZero() => false; 48 bool isMinusZero() => false;
49 49
50 // TODO(johnniwinther): Replace with a 'type' getter. 50 // TODO(johnniwinther): Replace with a 'type' getter.
51 DartType computeType(Compiler compiler); 51 DartType computeType(Compiler compiler);
52 52
53 ti.TypeMask computeMask(Compiler compiler); 53 ti.TypeMask computeMask(Compiler compiler);
54 54
55 List<Constant> getDependencies(); 55 List<Constant> getDependencies();
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 532
533 ti.TypeMask computeMask(Compiler compiler) { 533 ti.TypeMask computeMask(Compiler compiler) {
534 return compiler.typesTask.nonNullType; 534 return compiler.typesTask.nonNullType;
535 } 535 }
536 536
537 String toString() { 537 String toString() {
538 return 'InterceptorConstant(${Error.safeToString(dispatchedType)})'; 538 return 'InterceptorConstant(${Error.safeToString(dispatchedType)})';
539 } 539 }
540 } 540 }
541 541
542 class DummyReceiverConstant extends Constant { 542 class DummyConstant extends Constant {
543 final ti.TypeMask typeMask; 543 final ti.TypeMask typeMask;
544 544
545 DummyReceiverConstant(this.typeMask); 545 DummyConstant(this.typeMask);
546 546
547 bool isDummyReceiver() => true; 547 bool isDummy() => true;
548 548
549 bool operator ==(other) { 549 bool operator ==(other) {
550 return other is DummyReceiverConstant 550 return other is DummyConstant
551 && typeMask == other.typeMask; 551 && typeMask == other.typeMask;
552 } 552 }
553 553
554 get hashCode => typeMask.hashCode; 554 get hashCode => typeMask.hashCode;
555 555
556 List<Constant> getDependencies() => const <Constant>[]; 556 List<Constant> getDependencies() => const <Constant>[];
557 557
558 accept(ConstantVisitor visitor) => visitor.visitDummyReceiver(this); 558 accept(ConstantVisitor visitor) => visitor.visitDummy(this);
559 559
560 DartType computeType(Compiler compiler) => compiler.types.dynamicType; 560 DartType computeType(Compiler compiler) => compiler.types.dynamicType;
561 561
562 ti.TypeMask computeMask(Compiler compiler) => typeMask; 562 ti.TypeMask computeMask(Compiler compiler) => typeMask;
563 563
564 String toString() { 564 String toString() {
565 return 'DummyReceiverConstant($typeMask)'; 565 return 'DummyConstant($typeMask)';
566 } 566 }
567 } 567 }
568 568
569 class ConstructedConstant extends ObjectConstant { 569 class ConstructedConstant extends ObjectConstant {
570 final List<Constant> fields; 570 final List<Constant> fields;
571 final int hashCode; 571 final int hashCode;
572 572
573 ConstructedConstant(DartType type, List<Constant> fields) 573 ConstructedConstant(DartType type, List<Constant> fields)
574 : this.fields = fields, 574 : this.fields = fields,
575 hashCode = computeHash(type, fields), 575 hashCode = computeHash(type, fields),
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 if (i > 0) sb.write(','); 632 if (i > 0) sb.write(',');
633 sb.write(Error.safeToString(field.name)); 633 sb.write(Error.safeToString(field.name));
634 sb.write('='); 634 sb.write('=');
635 sb.write(Error.safeToString(value)); 635 sb.write(Error.safeToString(value));
636 i++; 636 i++;
637 }); 637 });
638 sb.write('))'); 638 sb.write('))');
639 return sb.toString(); 639 return sb.toString();
640 } 640 }
641 } 641 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ir/ir_pickler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698