| 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 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); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 if (other is !FunctionConstant) return false; | 68 if (other is !FunctionConstant) return false; |
| 69 return identical(other.element, element); | 69 return identical(other.element, element); |
| 70 } | 70 } |
| 71 | 71 |
| 72 String toString() => element.toString(); | 72 String toString() => element.toString(); |
| 73 List<Constant> getDependencies() => const <Constant>[]; | 73 List<Constant> getDependencies() => const <Constant>[]; |
| 74 DartString toDartString() { | 74 DartString toDartString() { |
| 75 return new DartString.literal(element.name); | 75 return new DartString.literal(element.name); |
| 76 } | 76 } |
| 77 | 77 |
| 78 DartType computeType(Compiler compiler) { | 78 // TODO(johnniwinther): remove computeType. |
| 79 return compiler.functionClass.computeType(compiler); | 79 DartType computeType(Compiler compiler) => element.computeType(compiler); |
| 80 } | |
| 81 | 80 |
| 82 ti.TypeMask computeMask(Compiler compiler) { | 81 ti.TypeMask computeMask(Compiler compiler) { |
| 83 return compiler.typesTask.functionType; | 82 return compiler.typesTask.functionType; |
| 84 } | 83 } |
| 85 | 84 |
| 86 int get hashCode => (17 * element.hashCode) & 0x7fffffff; | 85 int get hashCode => (17 * element.hashCode) & 0x7fffffff; |
| 87 | 86 |
| 88 accept(ConstantVisitor visitor) => visitor.visitFunction(this); | 87 accept(ConstantVisitor visitor) => visitor.visitFunction(this); |
| 89 } | 88 } |
| 90 | 89 |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 if (i > 0) sb.write(','); | 632 if (i > 0) sb.write(','); |
| 634 sb.write(Error.safeToString(field.name)); | 633 sb.write(Error.safeToString(field.name)); |
| 635 sb.write('='); | 634 sb.write('='); |
| 636 sb.write(Error.safeToString(value)); | 635 sb.write(Error.safeToString(value)); |
| 637 i++; | 636 i++; |
| 638 }); | 637 }); |
| 639 sb.write('))'); | 638 sb.write('))'); |
| 640 return sb.toString(); | 639 return sb.toString(); |
| 641 } | 640 } |
| 642 } | 641 } |
| OLD | NEW |