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.full_emitter; | 5 part of dart2js.js_emitter.full_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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 // handler on [mixinPrototype] and then resumes handling on | 492 // handler on [mixinPrototype] and then resumes handling on |
493 // [targetPrototype]. If [targetPrototype] already has a handler | 493 // [targetPrototype]. If [targetPrototype] already has a handler |
494 // installed, the handler is preserved in the generated closure and | 494 // installed, the handler is preserved in the generated closure and |
495 // thus can be safely overwritten. | 495 // thus can be safely overwritten. |
496 function mixinDeferredActionHelper(mixinPrototype, targetPrototype) { | 496 function mixinDeferredActionHelper(mixinPrototype, targetPrototype) { |
497 var chain; | 497 var chain; |
498 if (targetPrototype.hasOwnProperty(#deferredActionString)) { | 498 if (targetPrototype.hasOwnProperty(#deferredActionString)) { |
499 chain = targetPrototype.#deferredAction; | 499 chain = targetPrototype.#deferredAction; |
500 } | 500 } |
501 return function foo() { | 501 return function foo() { |
| 502 if (!supportsDirectProtoAccess) return; |
502 var prototype = this; | 503 var prototype = this; |
503 // Find the actual prototype that this handler is installed on. | 504 // Find the actual prototype that this handler is installed on. |
504 while (!prototype.hasOwnProperty(#deferredActionString)) { | 505 while (!prototype.hasOwnProperty(#deferredActionString)) { |
505 prototype = prototype.__proto__; | 506 prototype = prototype.__proto__; |
506 } | 507 } |
507 if (chain) { | 508 if (chain) { |
508 prototype.#deferredAction = chain; | 509 prototype.#deferredAction = chain; |
509 } else { | 510 } else { |
510 delete prototype.#deferredAction; | 511 delete prototype.#deferredAction; |
511 convertToFastObject(prototype); | 512 convertToFastObject(prototype); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 (function() { | 855 (function() { |
855 var result = $array[$index]; | 856 var result = $array[$index]; |
856 if ($check) { | 857 if ($check) { |
857 throw new Error( | 858 throw new Error( |
858 name + ": expected value of type \'$type\' at index " + ($index) + | 859 name + ": expected value of type \'$type\' at index " + ($index) + |
859 " but got " + (typeof result)); | 860 " but got " + (typeof result)); |
860 } | 861 } |
861 return result; | 862 return result; |
862 })()'''; | 863 })()'''; |
863 } | 864 } |
OLD | NEW |