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 library _js_helper; | 5 library _js_helper; |
6 | 6 |
7 import 'shared/embedded_names.dart' show | 7 import 'shared/embedded_names.dart' show |
8 ALL_CLASSES, | 8 ALL_CLASSES, |
9 GET_ISOLATE_TAG, | 9 GET_ISOLATE_TAG, |
10 INTERCEPTED_NAMES, | 10 INTERCEPTED_NAMES, |
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 | 1960 |
1961 // function tmp() {}; | 1961 // function tmp() {}; |
1962 // tmp.prototype = BC.prototype; | 1962 // tmp.prototype = BC.prototype; |
1963 // var proto = new tmp; | 1963 // var proto = new tmp; |
1964 // for each computed prototype property: | 1964 // for each computed prototype property: |
1965 // proto[property] = ...; | 1965 // proto[property] = ...; |
1966 // proto._init = BC; | 1966 // proto._init = BC; |
1967 // var dynClosureConstructor = | 1967 // var dynClosureConstructor = |
1968 // new Function('self', 'target', 'receiver', 'name', | 1968 // new Function('self', 'target', 'receiver', 'name', |
1969 // 'this._init(self, target, receiver, name)'); | 1969 // 'this._init(self, target, receiver, name)'); |
1970 // proto.constructor = dynClosureConstructor; // Necessary? | 1970 // proto.constructor = dynClosureConstructor; |
1971 // dynClosureConstructor.prototype = proto; | 1971 // dynClosureConstructor.prototype = proto; |
1972 // return dynClosureConstructor; | 1972 // return dynClosureConstructor; |
1973 | 1973 |
1974 // We need to create a new subclass of either TearOffClosure or | 1974 // We need to create a new subclass of either TearOffClosure or |
1975 // BoundClosure. For this, we need to create an object whose prototype is | 1975 // BoundClosure. For this, we need to create an object whose prototype is |
1976 // the prototype is either TearOffClosure.prototype or | 1976 // the prototype is either TearOffClosure.prototype or |
1977 // BoundClosure.prototype, respectively in pseudo JavaScript code. The | 1977 // BoundClosure.prototype, respectively in pseudo JavaScript code. The |
1978 // simplest way to access the JavaScript construction function of a Dart | 1978 // simplest way to access the JavaScript construction function of a Dart |
1979 // class is to create an instance and access its constructor property. The | 1979 // class is to create an instance and access its constructor property. The |
1980 // newly created instance could in theory be used directly as the | 1980 // newly created instance could in theory be used directly as the |
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3414 throw new MainError("No top-level function named 'main'."); | 3414 throw new MainError("No top-level function named 'main'."); |
3415 } | 3415 } |
3416 | 3416 |
3417 void badMain() { | 3417 void badMain() { |
3418 throw new MainError("'main' is not a function."); | 3418 throw new MainError("'main' is not a function."); |
3419 } | 3419 } |
3420 | 3420 |
3421 void mainHasTooManyParameters() { | 3421 void mainHasTooManyParameters() { |
3422 throw new MainError("'main' expects too many parameters."); | 3422 throw new MainError("'main' expects too many parameters."); |
3423 } | 3423 } |
OLD | NEW |