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 'dart:_async_await_error_codes' as async_error_codes; | 7 import 'dart:_async_await_error_codes' as async_error_codes; |
8 | 8 |
9 import 'dart:_js_embedded_names' show | 9 import 'dart:_js_embedded_names' show |
10 DEFERRED_LIBRARY_URIS, | 10 DEFERRED_LIBRARY_URIS, |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 int requiredArgumentCount = info.requiredParameterCount; | 1174 int requiredArgumentCount = info.requiredParameterCount; |
1175 int maxArgumentCount = requiredArgumentCount + | 1175 int maxArgumentCount = requiredArgumentCount + |
1176 info.optionalParameterCount; | 1176 info.optionalParameterCount; |
1177 if (info.areOptionalParametersNamed || | 1177 if (info.areOptionalParametersNamed || |
1178 requiredArgumentCount > argumentCount || | 1178 requiredArgumentCount > argumentCount || |
1179 maxArgumentCount < argumentCount) { | 1179 maxArgumentCount < argumentCount) { |
1180 return functionNoSuchMethod(function, positionalArguments, null); | 1180 return functionNoSuchMethod(function, positionalArguments, null); |
1181 } | 1181 } |
1182 arguments = new List.from(arguments); | 1182 arguments = new List.from(arguments); |
1183 for (int pos = argumentCount; pos < maxArgumentCount; pos++) { | 1183 for (int pos = argumentCount; pos < maxArgumentCount; pos++) { |
1184 arguments.add(info.defaultValue(pos)); | 1184 arguments.add(getMetadata(info.defaultValue(pos))); |
1185 } | 1185 } |
1186 } | 1186 } |
1187 // We bound 'this' to [function] because of how we compile | 1187 // We bound 'this' to [function] because of how we compile |
1188 // closures: escaped local variables are stored and accessed through | 1188 // closures: escaped local variables are stored and accessed through |
1189 // [function]. | 1189 // [function]. |
1190 return JS('var', '#.apply(#, #)', jsFunction, function, arguments); | 1190 return JS('var', '#.apply(#, #)', jsFunction, function, arguments); |
1191 } | 1191 } |
1192 | 1192 |
1193 static applyFunctionWithNamedArguments(Function function, | 1193 static applyFunctionWithNamedArguments(Function function, |
1194 List positionalArguments, | 1194 List positionalArguments, |
(...skipping 2708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3903 // This is a function that will return a helper function that does the | 3903 // This is a function that will return a helper function that does the |
3904 // iteration of the sync*. | 3904 // iteration of the sync*. |
3905 // | 3905 // |
3906 // Each invocation should give a body with fresh state. | 3906 // Each invocation should give a body with fresh state. |
3907 final dynamic /* js function */ _outerHelper; | 3907 final dynamic /* js function */ _outerHelper; |
3908 | 3908 |
3909 SyncStarIterable(this._outerHelper); | 3909 SyncStarIterable(this._outerHelper); |
3910 | 3910 |
3911 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper)); | 3911 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper)); |
3912 } | 3912 } |
OLD | NEW |