| 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 js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 const JAVA_SCRIPT_CONSTANT_SYSTEM = const JavaScriptConstantSystem(); | 7 const JAVA_SCRIPT_CONSTANT_SYSTEM = const JavaScriptConstantSystem(); |
| 8 | 8 |
| 9 class JavaScriptBitNotOperation extends BitNotOperation { | 9 class JavaScriptBitNotOperation extends BitNotOperation { |
| 10 const JavaScriptBitNotOperation(); | 10 const JavaScriptBitNotOperation(); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 protoValue = null; | 260 protoValue = null; |
| 261 break; | 261 break; |
| 262 } | 262 } |
| 263 } | 263 } |
| 264 | 264 |
| 265 bool hasProtoKey = (protoValue != null); | 265 bool hasProtoKey = (protoValue != null); |
| 266 DartType keysType; | 266 DartType keysType; |
| 267 if (sourceType.treatAsRaw) { | 267 if (sourceType.treatAsRaw) { |
| 268 keysType = compiler.listClass.rawType; | 268 keysType = compiler.listClass.rawType; |
| 269 } else { | 269 } else { |
| 270 Link<DartType> arguments = | 270 List<DartType> arguments = <DartType>[sourceType.typeArguments.first]; |
| 271 new Link<DartType>.fromList([sourceType.typeArguments.head]); | |
| 272 keysType = new InterfaceType(compiler.listClass, arguments); | 271 keysType = new InterfaceType(compiler.listClass, arguments); |
| 273 } | 272 } |
| 274 ListConstant keysList = new ListConstant(keysType, keys); | 273 ListConstant keysList = new ListConstant(keysType, keys); |
| 275 String className = onlyStringKeys | 274 String className = onlyStringKeys |
| 276 ? (hasProtoKey ? JavaScriptMapConstant.DART_PROTO_CLASS | 275 ? (hasProtoKey ? JavaScriptMapConstant.DART_PROTO_CLASS |
| 277 : JavaScriptMapConstant.DART_STRING_CLASS) | 276 : JavaScriptMapConstant.DART_STRING_CLASS) |
| 278 : JavaScriptMapConstant.DART_GENERAL_CLASS; | 277 : JavaScriptMapConstant.DART_GENERAL_CLASS; |
| 279 ClassElement classElement = backend.jsHelperLibrary.find(className); | 278 ClassElement classElement = backend.jsHelperLibrary.find(className); |
| 280 classElement.ensureResolved(compiler); | 279 classElement.ensureResolved(compiler); |
| 281 Link<DartType> typeArgument = sourceType.typeArguments; | 280 List<DartType> typeArgument = sourceType.typeArguments; |
| 282 InterfaceType type; | 281 InterfaceType type; |
| 283 if (sourceType.treatAsRaw) { | 282 if (sourceType.treatAsRaw) { |
| 284 type = classElement.rawType; | 283 type = classElement.rawType; |
| 285 } else { | 284 } else { |
| 286 type = new InterfaceType(classElement, typeArgument); | 285 type = new InterfaceType(classElement, typeArgument); |
| 287 } | 286 } |
| 288 return new JavaScriptMapConstant( | 287 return new JavaScriptMapConstant( |
| 289 type, keysList, values, protoValue, onlyStringKeys); | 288 type, keysList, values, protoValue, onlyStringKeys); |
| 290 | 289 |
| 291 } | 290 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 result.add(keyList); | 332 result.add(keyList); |
| 334 } else { | 333 } else { |
| 335 // Add the keys individually to avoid generating an unused list constant | 334 // Add the keys individually to avoid generating an unused list constant |
| 336 // for the keys. | 335 // for the keys. |
| 337 result.addAll(keys); | 336 result.addAll(keys); |
| 338 } | 337 } |
| 339 result.addAll(values); | 338 result.addAll(values); |
| 340 return result; | 339 return result; |
| 341 } | 340 } |
| 342 } | 341 } |
| OLD | NEW |