| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// This library defines runtime operations on objects used by the code | 5 /// This library defines runtime operations on objects used by the code |
| 6 /// generator. | 6 /// generator. |
| 7 part of dart._runtime; | 7 part of dart._runtime; |
| 8 | 8 |
| 9 class InvocationImpl extends Invocation { | 9 class InvocationImpl extends Invocation { |
| 10 final Symbol memberName; | 10 final Symbol memberName; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 '` with type arguments <' + $typeArgs + '> is not supported.'); | 239 '` with type arguments <' + $typeArgs + '> is not supported.'); |
| 240 } | 240 } |
| 241 return $f.apply($obj, $args); | 241 return $f.apply($obj, $args); |
| 242 } | 242 } |
| 243 | 243 |
| 244 // Apply type arguments | 244 // Apply type arguments |
| 245 if ($ftype instanceof $GenericFunctionType) { | 245 if ($ftype instanceof $GenericFunctionType) { |
| 246 let formalCount = $ftype.formalCount; | 246 let formalCount = $ftype.formalCount; |
| 247 | 247 |
| 248 if ($typeArgs == null) { | 248 if ($typeArgs == null) { |
| 249 // TODO(jmesserly): this should use instantiate to bounds logic. | 249 $typeArgs = $ftype.instantiateDefaultBounds(); |
| 250 // See https://github.com/dart-lang/sdk/issues/27256 | |
| 251 $typeArgs = Array(formalCount).fill($dynamic); | |
| 252 } else if ($typeArgs.length != formalCount) { | 250 } else if ($typeArgs.length != formalCount) { |
| 253 // TODO(jmesserly): is this the right error? | 251 // TODO(jmesserly): is this the right error? |
| 254 $throwStrongModeError( | 252 $throwStrongModeError( |
| 255 'incorrect number of arguments to generic function ' + | 253 'incorrect number of arguments to generic function ' + |
| 256 $typeName($ftype) + ', got <' + $typeArgs + '> expected ' + | 254 $typeName($ftype) + ', got <' + $typeArgs + '> expected ' + |
| 257 formalCount + '.'); | 255 formalCount + '.'); |
| 258 } | 256 } |
| 259 // Instantiate the function type. | |
| 260 $ftype = $ftype.instantiate($typeArgs); | 257 $ftype = $ftype.instantiate($typeArgs); |
| 261 } else if ($typeArgs != null) { | 258 } else if ($typeArgs != null) { |
| 262 $throwStrongModeError( | 259 $throwStrongModeError( |
| 263 'got type arguments to non-generic function ' + $typeName($ftype) + | 260 'got type arguments to non-generic function ' + $typeName($ftype) + |
| 264 ', got <' + $typeArgs + '> expected none.'); | 261 ', got <' + $typeArgs + '> expected none.'); |
| 265 } | 262 } |
| 266 | 263 |
| 267 if ($_checkApply($ftype, $args)) { | 264 if ($_checkApply($ftype, $args)) { |
| 268 if ($typeArgs != null) { | 265 if ($typeArgs != null) { |
| 269 return $f.apply($obj, $typeArgs).apply($obj, $args); | 266 return $f.apply($obj, $typeArgs).apply($obj, $args); |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 name = '+' + name; | 908 name = '+' + name; |
| 912 } | 909 } |
| 913 return name; | 910 return name; |
| 914 } | 911 } |
| 915 | 912 |
| 916 /// Emulates the implicit "loadLibrary" function provided by a deferred library. | 913 /// Emulates the implicit "loadLibrary" function provided by a deferred library. |
| 917 /// | 914 /// |
| 918 /// Libraries are not actually deferred in DDC, so this just returns a future | 915 /// Libraries are not actually deferred in DDC, so this just returns a future |
| 919 /// that completes immediately. | 916 /// that completes immediately. |
| 920 Future loadLibrary() => new Future.value(); | 917 Future loadLibrary() => new Future.value(); |
| OLD | NEW |