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 | 7 import '../compiler.dart' show |
8 Compiler; | 8 Compiler; |
9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 if (sourceType.treatAsRaw) { | 320 if (sourceType.treatAsRaw) { |
321 keysType = coreTypes.listType(); | 321 keysType = coreTypes.listType(); |
322 } else { | 322 } else { |
323 keysType = coreTypes.listType(sourceType.typeArguments.first); | 323 keysType = coreTypes.listType(sourceType.typeArguments.first); |
324 } | 324 } |
325 ListConstantValue keysList = new ListConstantValue(keysType, keys); | 325 ListConstantValue keysList = new ListConstantValue(keysType, keys); |
326 String className = onlyStringKeys | 326 String className = onlyStringKeys |
327 ? (hasProtoKey ? JavaScriptMapConstant.DART_PROTO_CLASS | 327 ? (hasProtoKey ? JavaScriptMapConstant.DART_PROTO_CLASS |
328 : JavaScriptMapConstant.DART_STRING_CLASS) | 328 : JavaScriptMapConstant.DART_STRING_CLASS) |
329 : JavaScriptMapConstant.DART_GENERAL_CLASS; | 329 : JavaScriptMapConstant.DART_GENERAL_CLASS; |
330 ClassElement classElement = backend.jsHelperLibrary.find(className); | 330 ClassElement classElement = backend.helpers.jsHelperLibrary.find(className); |
331 classElement.ensureResolved(compiler.resolution); | 331 classElement.ensureResolved(compiler.resolution); |
332 List<DartType> typeArgument = sourceType.typeArguments; | 332 List<DartType> typeArgument = sourceType.typeArguments; |
333 InterfaceType type; | 333 InterfaceType type; |
334 if (sourceType.treatAsRaw) { | 334 if (sourceType.treatAsRaw) { |
335 type = classElement.rawType; | 335 type = classElement.rawType; |
336 } else { | 336 } else { |
337 type = new InterfaceType(classElement, typeArgument); | 337 type = new InterfaceType(classElement, typeArgument); |
338 } | 338 } |
339 return new JavaScriptMapConstant( | 339 return new JavaScriptMapConstant( |
340 type, keysList, values, protoValue, onlyStringKeys); | 340 type, keysList, values, protoValue, onlyStringKeys); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 result.add(keyList); | 380 result.add(keyList); |
381 } else { | 381 } else { |
382 // Add the keys individually to avoid generating an unused list constant | 382 // Add the keys individually to avoid generating an unused list constant |
383 // for the keys. | 383 // for the keys. |
384 result.addAll(keys); | 384 result.addAll(keys); |
385 } | 385 } |
386 result.addAll(values); | 386 result.addAll(values); |
387 return result; | 387 return result; |
388 } | 388 } |
389 } | 389 } |
OLD | NEW |