| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.constant; | 8 library engine.constant; |
| 9 | 9 |
| 10 import 'java_core.dart'; | 10 import 'java_core.dart'; |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 */ | 305 */ |
| 306 void add(CompilationUnit unit) { | 306 void add(CompilationUnit unit) { |
| 307 unit.accept(_constantFinder); | 307 unit.accept(_constantFinder); |
| 308 } | 308 } |
| 309 | 309 |
| 310 /** | 310 /** |
| 311 * Compute values for all of the constant variables in the compilation units t
hat were added. | 311 * Compute values for all of the constant variables in the compilation units t
hat were added. |
| 312 */ | 312 */ |
| 313 void computeValues() { | 313 void computeValues() { |
| 314 _declarationMap = _constantFinder.variableMap; | 314 _declarationMap = _constantFinder.variableMap; |
| 315 for (MapIterator<VariableElement, VariableDeclaration> iter = SingleMapItera
tor.forMap(_declarationMap); iter.moveNext();) { | 315 for (MapEntry<VariableElement, VariableDeclaration> entry in getMapEntrySet(
_declarationMap)) { |
| 316 VariableElement element = iter.key; | 316 VariableElement element = entry.getKey(); |
| 317 ReferenceFinder referenceFinder = new ReferenceFinder(element, _referenceG
raph); | 317 ReferenceFinder referenceFinder = new ReferenceFinder(element, _referenceG
raph); |
| 318 _referenceGraph.addNode(element); | 318 _referenceGraph.addNode(element); |
| 319 iter.value.initializer.accept(referenceFinder); | 319 entry.getValue().initializer.accept(referenceFinder); |
| 320 } | 320 } |
| 321 while (!_referenceGraph.isEmpty) { | 321 while (!_referenceGraph.isEmpty) { |
| 322 VariableElement element = _referenceGraph.removeSink(); | 322 VariableElement element = _referenceGraph.removeSink(); |
| 323 while (element != null) { | 323 while (element != null) { |
| 324 _computeValueFor(element); | 324 _computeValueFor(element); |
| 325 element = _referenceGraph.removeSink(); | 325 element = _referenceGraph.removeSink(); |
| 326 } | 326 } |
| 327 if (!_referenceGraph.isEmpty) { | 327 if (!_referenceGraph.isEmpty) { |
| 328 List<VariableElement> variablesInCycle = _referenceGraph.findCycle(); | 328 List<VariableElement> variablesInCycle = _referenceGraph.findCycle(); |
| 329 if (variablesInCycle == null) { | 329 if (variablesInCycle == null) { |
| (...skipping 2592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2922 | 2922 |
| 2923 @override | 2923 @override |
| 2924 StringState convertToString() => StringState.UNKNOWN_VALUE; | 2924 StringState convertToString() => StringState.UNKNOWN_VALUE; |
| 2925 | 2925 |
| 2926 @override | 2926 @override |
| 2927 bool operator ==(Object object) { | 2927 bool operator ==(Object object) { |
| 2928 if (object is! GenericState) { | 2928 if (object is! GenericState) { |
| 2929 return false; | 2929 return false; |
| 2930 } | 2930 } |
| 2931 GenericState state = object as GenericState; | 2931 GenericState state = object as GenericState; |
| 2932 Set<String> otherFields = new Set<String>(); | 2932 Set<String> otherFields = new Set<String>.from(state._fieldMap.keys.toSet())
; |
| 2933 for (String fieldName in _fieldMap.keys.toSet()) { | 2933 for (String fieldName in _fieldMap.keys.toSet()) { |
| 2934 if (_fieldMap[fieldName] != state._fieldMap[fieldName]) { | 2934 if (_fieldMap[fieldName] != state._fieldMap[fieldName]) { |
| 2935 return false; | 2935 return false; |
| 2936 } | 2936 } |
| 2937 otherFields.remove(fieldName); | 2937 otherFields.remove(fieldName); |
| 2938 } | 2938 } |
| 2939 for (String fieldName in otherFields) { | 2939 for (String fieldName in otherFields) { |
| 2940 if (state._fieldMap[fieldName] != _fieldMap[fieldName]) { | 2940 if (state._fieldMap[fieldName] != _fieldMap[fieldName]) { |
| 2941 return false; | 2941 return false; |
| 2942 } | 2942 } |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3931 if (object is! MapState) { | 3931 if (object is! MapState) { |
| 3932 return false; | 3932 return false; |
| 3933 } | 3933 } |
| 3934 Map<DartObjectImpl, DartObjectImpl> otherElements = (object as MapState)._en
tries; | 3934 Map<DartObjectImpl, DartObjectImpl> otherElements = (object as MapState)._en
tries; |
| 3935 int count = _entries.length; | 3935 int count = _entries.length; |
| 3936 if (otherElements.length != count) { | 3936 if (otherElements.length != count) { |
| 3937 return false; | 3937 return false; |
| 3938 } else if (count == 0) { | 3938 } else if (count == 0) { |
| 3939 return true; | 3939 return true; |
| 3940 } | 3940 } |
| 3941 for (MapIterator<DartObjectImpl, DartObjectImpl> iter = SingleMapIterator.fo
rMap(_entries); iter.moveNext();) { | 3941 for (MapEntry<DartObjectImpl, DartObjectImpl> entry in getMapEntrySet(_entri
es)) { |
| 3942 DartObjectImpl key = iter.key; | 3942 DartObjectImpl key = entry.getKey(); |
| 3943 DartObjectImpl value = iter.value; | 3943 DartObjectImpl value = entry.getValue(); |
| 3944 DartObjectImpl otherValue = otherElements[key]; | 3944 DartObjectImpl otherValue = otherElements[key]; |
| 3945 if (value != otherValue) { | 3945 if (value != otherValue) { |
| 3946 return false; | 3946 return false; |
| 3947 } | 3947 } |
| 3948 } | 3948 } |
| 3949 return true; | 3949 return true; |
| 3950 } | 3950 } |
| 3951 | 3951 |
| 3952 @override | 3952 @override |
| 3953 String get typeName => "Map"; | 3953 String get typeName => "Map"; |
| 3954 | 3954 |
| 3955 @override | 3955 @override |
| 3956 Map<Object, Object> get value { | 3956 Map<Object, Object> get value { |
| 3957 Map<Object, Object> result = new Map<Object, Object>(); | 3957 Map<Object, Object> result = new Map<Object, Object>(); |
| 3958 for (MapIterator<DartObjectImpl, DartObjectImpl> iter = SingleMapIterator.fo
rMap(_entries); iter.moveNext();) { | 3958 for (MapEntry<DartObjectImpl, DartObjectImpl> entry in getMapEntrySet(_entri
es)) { |
| 3959 DartObjectImpl key = iter.key; | 3959 DartObjectImpl key = entry.getKey(); |
| 3960 DartObjectImpl value = iter.value; | 3960 DartObjectImpl value = entry.getValue(); |
| 3961 if (!key.hasExactValue || !value.hasExactValue) { | 3961 if (!key.hasExactValue || !value.hasExactValue) { |
| 3962 return null; | 3962 return null; |
| 3963 } | 3963 } |
| 3964 result[key.value] = value.value; | 3964 result[key.value] = value.value; |
| 3965 } | 3965 } |
| 3966 return result; | 3966 return result; |
| 3967 } | 3967 } |
| 3968 | 3968 |
| 3969 @override | 3969 @override |
| 3970 bool get hasExactValue { | 3970 bool get hasExactValue { |
| 3971 for (MapIterator<DartObjectImpl, DartObjectImpl> iter = SingleMapIterator.fo
rMap(_entries); iter.moveNext();) { | 3971 for (MapEntry<DartObjectImpl, DartObjectImpl> entry in getMapEntrySet(_entri
es)) { |
| 3972 if (!iter.key.hasExactValue || !iter.value.hasExactValue) { | 3972 if (!entry.getKey().hasExactValue || !entry.getValue().hasExactValue) { |
| 3973 return false; | 3973 return false; |
| 3974 } | 3974 } |
| 3975 } | 3975 } |
| 3976 return true; | 3976 return true; |
| 3977 } | 3977 } |
| 3978 | 3978 |
| 3979 @override | 3979 @override |
| 3980 int get hashCode { | 3980 int get hashCode { |
| 3981 int value = 0; | 3981 int value = 0; |
| 3982 for (DartObjectImpl key in _entries.keys.toSet()) { | 3982 for (DartObjectImpl key in _entries.keys.toSet()) { |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4329 | 4329 |
| 4330 @override | 4330 @override |
| 4331 String get typeName => "Type"; | 4331 String get typeName => "Type"; |
| 4332 | 4332 |
| 4333 @override | 4333 @override |
| 4334 int get hashCode => _element == null ? 0 : _element.hashCode; | 4334 int get hashCode => _element == null ? 0 : _element.hashCode; |
| 4335 | 4335 |
| 4336 @override | 4336 @override |
| 4337 String toString() => _element == null ? "-unknown-" : _element.name; | 4337 String toString() => _element == null ? "-unknown-" : _element.name; |
| 4338 } | 4338 } |
| OLD | NEW |