| 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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 if (fields.length != other.fields.length) return false; | 478 if (fields.length != other.fields.length) return false; |
| 479 for (int i = 0; i < fields.length; i++) { | 479 for (int i = 0; i < fields.length; i++) { |
| 480 if (fields[i] != other.fields[i]) return false; | 480 if (fields[i] != other.fields[i]) return false; |
| 481 } | 481 } |
| 482 return true; | 482 return true; |
| 483 } | 483 } |
| 484 | 484 |
| 485 List<Constant> getDependencies() => fields; | 485 List<Constant> getDependencies() => fields; |
| 486 | 486 |
| 487 accept(ConstantVisitor visitor) => visitor.visitConstructed(this); | 487 accept(ConstantVisitor visitor) => visitor.visitConstructed(this); |
| 488 |
| 489 Map<Element, Constant> get fieldElements { |
| 490 // TODO(ahe): Refactor constant system to store this information directly. |
| 491 ClassElement classElement = type.element; |
| 492 int count = 0; |
| 493 Map<Element, Constant> result = new Map<Element, Constant>(); |
| 494 classElement.implementation.forEachInstanceField((holder, field) { |
| 495 result[field] = fields[count++]; |
| 496 }, includeSuperAndInjectedMembers: true); |
| 497 return result; |
| 498 } |
| 488 } | 499 } |
| OLD | NEW |