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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
368 // object and copy over the members. | 368 // object and copy over the members. |
369 jsAst.Statement finishClasses = js.statement('''{ | 369 jsAst.Statement finishClasses = js.statement('''{ |
370 function finishClasses(processedClasses) { | 370 function finishClasses(processedClasses) { |
371 if (#debugFastObjects) | 371 if (#debugFastObjects) |
372 print("Number of classes: " + | 372 print("Number of classes: " + |
373 Object.getOwnPropertyNames(processedClasses.collected).length); | 373 Object.getOwnPropertyNames(processedClasses.collected).length); |
374 | 374 |
375 var allClasses = #allClasses; | 375 var allClasses = #allClasses; |
376 | 376 |
377 if (#inCspMode) { | 377 if (#inCspMode) { |
378 var constructors = dart_precompiled(processedClasses.collected); | 378 var constructors = ${oldEmitter.initName} |
floitsch
2015/03/02 14:33:13
use embedded-global access.
(again: if you saw thi
sigurdm
2015/03/03 09:33:50
Done.
| |
379 .${oldEmitter.precompiledName}(processedClasses.collected); | |
379 } | 380 } |
380 | 381 |
381 if (#notInCspMode) { | 382 if (#notInCspMode) { |
382 processedClasses.combinedConstructorFunction += | 383 processedClasses.combinedConstructorFunction += |
383 "return [\\n" + processedClasses.constructorsList.join(",\\n ") + | 384 "return [\\n" + processedClasses.constructorsList.join(",\\n ") + |
384 "\\n]"; | 385 "\\n]"; |
385 var constructors = | 386 var constructors = |
386 new Function("\$collectedClasses", | 387 new Function("\$collectedClasses", |
387 processedClasses.combinedConstructorFunction) | 388 processedClasses.combinedConstructorFunction) |
388 (processedClasses.collected); | 389 (processedClasses.collected); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
484 (function() { | 485 (function() { |
485 var result = $array[$index]; | 486 var result = $array[$index]; |
486 if ($check) { | 487 if ($check) { |
487 throw new Error( | 488 throw new Error( |
488 name + ": expected value of type \'$type\' at index " + ($index) + | 489 name + ": expected value of type \'$type\' at index " + ($index) + |
489 " but got " + (typeof result)); | 490 " but got " + (typeof result)); |
490 } | 491 } |
491 return result; | 492 return result; |
492 })()'''; | 493 })()'''; |
493 } | 494 } |
OLD | NEW |