| 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 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 DartObjectImpl elementResult = element.accept(this); | 1120 DartObjectImpl elementResult = element.accept(this); |
| 1121 if (elementResult == null) { | 1121 if (elementResult == null) { |
| 1122 errorOccurred = true; | 1122 errorOccurred = true; |
| 1123 } else { | 1123 } else { |
| 1124 elements.add(elementResult); | 1124 elements.add(elementResult); |
| 1125 } | 1125 } |
| 1126 } | 1126 } |
| 1127 if (errorOccurred) { | 1127 if (errorOccurred) { |
| 1128 return null; | 1128 return null; |
| 1129 } | 1129 } |
| 1130 return new DartObjectImpl(_typeProvider.listType, new ListState(new List.fro
m(elements))); | 1130 DartType elementType = _typeProvider.dynamicType; |
| 1131 if (node.typeArguments != null && node.typeArguments.arguments.length == 1)
{ |
| 1132 DartType type = node.typeArguments.arguments[0].type; |
| 1133 if (type != null) { |
| 1134 elementType = type; |
| 1135 } |
| 1136 } |
| 1137 InterfaceType listType = _typeProvider.listType.substitute4([elementType]); |
| 1138 return new DartObjectImpl(listType, new ListState(new List.from(elements))); |
| 1131 } | 1139 } |
| 1132 | 1140 |
| 1133 @override | 1141 @override |
| 1134 DartObjectImpl visitMapLiteral(MapLiteral node) { | 1142 DartObjectImpl visitMapLiteral(MapLiteral node) { |
| 1135 if (node.constKeyword == null) { | 1143 if (node.constKeyword == null) { |
| 1136 _errorReporter.reportErrorForNode(CompileTimeErrorCode.MISSING_CONST_IN_MA
P_LITERAL, node, []); | 1144 _errorReporter.reportErrorForNode(CompileTimeErrorCode.MISSING_CONST_IN_MA
P_LITERAL, node, []); |
| 1137 return null; | 1145 return null; |
| 1138 } | 1146 } |
| 1139 bool errorOccurred = false; | 1147 bool errorOccurred = false; |
| 1140 HashMap<DartObjectImpl, DartObjectImpl> map = new HashMap<DartObjectImpl, Da
rtObjectImpl>(); | 1148 HashMap<DartObjectImpl, DartObjectImpl> map = new HashMap<DartObjectImpl, Da
rtObjectImpl>(); |
| 1141 for (MapLiteralEntry entry in node.entries) { | 1149 for (MapLiteralEntry entry in node.entries) { |
| 1142 DartObjectImpl keyResult = entry.key.accept(this); | 1150 DartObjectImpl keyResult = entry.key.accept(this); |
| 1143 DartObjectImpl valueResult = entry.value.accept(this); | 1151 DartObjectImpl valueResult = entry.value.accept(this); |
| 1144 if (keyResult == null || valueResult == null) { | 1152 if (keyResult == null || valueResult == null) { |
| 1145 errorOccurred = true; | 1153 errorOccurred = true; |
| 1146 } else { | 1154 } else { |
| 1147 map[keyResult] = valueResult; | 1155 map[keyResult] = valueResult; |
| 1148 } | 1156 } |
| 1149 } | 1157 } |
| 1150 if (errorOccurred) { | 1158 if (errorOccurred) { |
| 1151 return null; | 1159 return null; |
| 1152 } | 1160 } |
| 1153 return new DartObjectImpl(_typeProvider.mapType, new MapState(map)); | 1161 DartType keyType = _typeProvider.dynamicType; |
| 1162 DartType valueType = _typeProvider.dynamicType; |
| 1163 if (node.typeArguments != null && node.typeArguments.arguments.length == 2)
{ |
| 1164 DartType keyTypeCandidate = node.typeArguments.arguments[0].type; |
| 1165 if (keyTypeCandidate != null) { |
| 1166 keyType = keyTypeCandidate; |
| 1167 } |
| 1168 DartType valueTypeCandidate = node.typeArguments.arguments[1].type; |
| 1169 if (valueTypeCandidate != null) { |
| 1170 valueType = valueTypeCandidate; |
| 1171 } |
| 1172 } |
| 1173 InterfaceType mapType = _typeProvider.mapType.substitute4( |
| 1174 [keyType, valueType]); |
| 1175 return new DartObjectImpl(mapType, new MapState(map)); |
| 1154 } | 1176 } |
| 1155 | 1177 |
| 1156 @override | 1178 @override |
| 1157 DartObjectImpl visitMethodInvocation(MethodInvocation node) { | 1179 DartObjectImpl visitMethodInvocation(MethodInvocation node) { |
| 1158 Element element = node.methodName.staticElement; | 1180 Element element = node.methodName.staticElement; |
| 1159 if (element is FunctionElement) { | 1181 if (element is FunctionElement) { |
| 1160 FunctionElement function = element; | 1182 FunctionElement function = element; |
| 1161 if (function.name == "identical") { | 1183 if (function.name == "identical") { |
| 1162 NodeList<Expression> arguments = node.argumentList.arguments; | 1184 NodeList<Expression> arguments = node.argumentList.arguments; |
| 1163 if (arguments.length == 2) { | 1185 if (arguments.length == 2) { |
| (...skipping 3428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4592 | 4614 |
| 4593 @override | 4615 @override |
| 4594 String get typeName => "Type"; | 4616 String get typeName => "Type"; |
| 4595 | 4617 |
| 4596 @override | 4618 @override |
| 4597 int get hashCode => _element == null ? 0 : _element.hashCode; | 4619 int get hashCode => _element == null ? 0 : _element.hashCode; |
| 4598 | 4620 |
| 4599 @override | 4621 @override |
| 4600 String toString() => _element == null ? "-unknown-" : _element.name; | 4622 String toString() => _element == null ? "-unknown-" : _element.name; |
| 4601 } | 4623 } |
| OLD | NEW |