| 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 library dart2js.constant_system.js; | 5 library dart2js.constant_system.js; |
| 6 | 6 |
| 7 import '../compiler.dart' show Compiler; | 7 import '../compiler.dart' show Compiler; |
| 8 import '../constant_system_dart.dart'; | 8 import '../constant_system_dart.dart'; |
| 9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 } | 363 } |
| 364 | 364 |
| 365 bool hasProtoKey = (protoValue != null); | 365 bool hasProtoKey = (protoValue != null); |
| 366 DartType keysType; | 366 DartType keysType; |
| 367 if (sourceType.treatAsRaw) { | 367 if (sourceType.treatAsRaw) { |
| 368 keysType = commonElements.listType(); | 368 keysType = commonElements.listType(); |
| 369 } else { | 369 } else { |
| 370 keysType = commonElements.listType(sourceType.typeArguments.first); | 370 keysType = commonElements.listType(sourceType.typeArguments.first); |
| 371 } | 371 } |
| 372 ListConstantValue keysList = new ListConstantValue(keysType, keys); | 372 ListConstantValue keysList = new ListConstantValue(keysType, keys); |
| 373 String className = onlyStringKeys | 373 ClassElement classElement = onlyStringKeys |
| 374 ? (hasProtoKey | 374 ? (hasProtoKey |
| 375 ? JavaScriptMapConstant.DART_PROTO_CLASS | 375 ? backend.helpers.constantProtoMapClass |
| 376 : JavaScriptMapConstant.DART_STRING_CLASS) | 376 : backend.helpers.constantStringMapClass) |
| 377 : JavaScriptMapConstant.DART_GENERAL_CLASS; | 377 : backend.helpers.generalConstantMapClass; |
| 378 ClassElement classElement = backend.helpers.jsHelperLibrary.find(className); | |
| 379 classElement.ensureResolved(compiler.resolution); | 378 classElement.ensureResolved(compiler.resolution); |
| 380 List<DartType> typeArgument = sourceType.typeArguments; | 379 List<DartType> typeArgument = sourceType.typeArguments; |
| 381 InterfaceType type; | 380 InterfaceType type; |
| 382 if (sourceType.treatAsRaw) { | 381 if (sourceType.treatAsRaw) { |
| 383 type = classElement.rawType; | 382 type = classElement.rawType; |
| 384 } else { | 383 } else { |
| 385 type = new InterfaceType(classElement, typeArgument); | 384 type = new InterfaceType(classElement, typeArgument); |
| 386 } | 385 } |
| 387 return new JavaScriptMapConstant( | 386 return new JavaScriptMapConstant( |
| 388 type, keysList, values, protoValue, onlyStringKeys); | 387 type, keysList, values, protoValue, onlyStringKeys); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 result.add(keyList); | 439 result.add(keyList); |
| 441 } else { | 440 } else { |
| 442 // Add the keys individually to avoid generating an unused list constant | 441 // Add the keys individually to avoid generating an unused list constant |
| 443 // for the keys. | 442 // for the keys. |
| 444 result.addAll(keys); | 443 result.addAll(keys); |
| 445 } | 444 } |
| 446 result.addAll(values); | 445 result.addAll(values); |
| 447 return result; | 446 return result; |
| 448 } | 447 } |
| 449 } | 448 } |
| OLD | NEW |