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 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1948 | 1948 |
1949 // function tmp() {}; | 1949 // function tmp() {}; |
1950 // tmp.prototype = BC.prototype; | 1950 // tmp.prototype = BC.prototype; |
1951 // var proto = new tmp; | 1951 // var proto = new tmp; |
1952 // for each computed prototype property: | 1952 // for each computed prototype property: |
1953 // proto[property] = ...; | 1953 // proto[property] = ...; |
1954 // proto._init = BC; | 1954 // proto._init = BC; |
1955 // var dynClosureConstructor = | 1955 // var dynClosureConstructor = |
1956 // new Function('self', 'target', 'receiver', 'name', | 1956 // new Function('self', 'target', 'receiver', 'name', |
1957 // 'this._init(self, target, receiver, name)'); | 1957 // 'this._init(self, target, receiver, name)'); |
1958 // proto.constructor = dynClosureConstructor; // Necessary? | 1958 // proto.constructor = dynClosureConstructor; |
1959 // dynClosureConstructor.prototype = proto; | 1959 // dynClosureConstructor.prototype = proto; |
1960 // return dynClosureConstructor; | 1960 // return dynClosureConstructor; |
1961 | 1961 |
1962 // We need to create a new subclass of either TearOffClosure or | 1962 // We need to create a new subclass of either TearOffClosure or |
1963 // BoundClosure. For this, we need to create an object whose prototype is | 1963 // BoundClosure. For this, we need to create an object whose prototype is |
1964 // the prototype is either TearOffClosure.prototype or | 1964 // the prototype is either TearOffClosure.prototype or |
1965 // BoundClosure.prototype, respectively in pseudo JavaScript code. The | 1965 // BoundClosure.prototype, respectively in pseudo JavaScript code. The |
1966 // simplest way to access the JavaScript construction function of a Dart | 1966 // simplest way to access the JavaScript construction function of a Dart |
1967 // class is to create an instance and access its constructor property. The | 1967 // class is to create an instance and access its constructor property. The |
1968 // newly created instance could in theory be used directly as the | 1968 // newly created instance could in theory be used directly as the |
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3402 throw new MainError("No top-level function named 'main'."); | 3402 throw new MainError("No top-level function named 'main'."); |
3403 } | 3403 } |
3404 | 3404 |
3405 void badMain() { | 3405 void badMain() { |
3406 throw new MainError("'main' is not a function."); | 3406 throw new MainError("'main' is not a function."); |
3407 } | 3407 } |
3408 | 3408 |
3409 void mainHasTooManyParameters() { | 3409 void mainHasTooManyParameters() { |
3410 throw new MainError("'main' expects too many parameters."); | 3410 throw new MainError("'main' expects too many parameters."); |
3411 } | 3411 } |
OLD | NEW |