| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 // TODO(ahe): Share these with js_helper.dart. | 7 // TODO(ahe): Share these with js_helper.dart. |
| 8 const FUNCTION_INDEX = 0; | 8 const FUNCTION_INDEX = 0; |
| 9 const NAME_INDEX = 1; | 9 const NAME_INDEX = 1; |
| 10 const CALL_NAME_INDEX = 2; | 10 const CALL_NAME_INDEX = 2; |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 new Function("\$collectedClasses", | 445 new Function("\$collectedClasses", |
| 446 processedClasses.combinedConstructorFunction) | 446 processedClasses.combinedConstructorFunction) |
| 447 (processedClasses.collected); | 447 (processedClasses.collected); |
| 448 processedClasses.combinedConstructorFunction = null; | 448 processedClasses.combinedConstructorFunction = null; |
| 449 } | 449 } |
| 450 | 450 |
| 451 for (var i = 0; i < constructors.length; i++) { | 451 for (var i = 0; i < constructors.length; i++) { |
| 452 var constructor = constructors[i]; | 452 var constructor = constructors[i]; |
| 453 var cls = constructor.name; | 453 var cls = constructor.name; |
| 454 var desc = processedClasses.collected[cls]; | 454 var desc = processedClasses.collected[cls]; |
| 455 var globalObject = \$; | 455 var globalObject = desc[0]; |
| 456 if (desc instanceof Array) { | 456 desc = desc[1]; |
| 457 globalObject = desc[0] || \$; | |
| 458 desc = desc[1]; | |
| 459 } | |
| 460 if (#isTreeShakingDisabled) | 457 if (#isTreeShakingDisabled) |
| 461 constructor["${namer.metadataField}"] = desc; | 458 constructor["${namer.metadataField}"] = desc; |
| 462 allClasses[cls] = constructor; | 459 allClasses[cls] = constructor; |
| 463 globalObject[cls] = constructor; | 460 globalObject[cls] = constructor; |
| 464 } | 461 } |
| 465 constructors = null; | 462 constructors = null; |
| 466 | 463 |
| 467 #finishClassFunction; | 464 #finishClassFunction; |
| 468 | 465 |
| 469 #trivialNsmHandlers; | 466 #trivialNsmHandlers; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 (function() { | 542 (function() { |
| 546 var result = $array[$index]; | 543 var result = $array[$index]; |
| 547 if ($check) { | 544 if ($check) { |
| 548 throw new Error( | 545 throw new Error( |
| 549 name + ": expected value of type \'$type\' at index " + ($index) + | 546 name + ": expected value of type \'$type\' at index " + ($index) + |
| 550 " but got " + (typeof result)); | 547 " but got " + (typeof result)); |
| 551 } | 548 } |
| 552 return result; | 549 return result; |
| 553 })()'''; | 550 })()'''; |
| 554 } | 551 } |
| OLD | NEW |