Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: runtime/lib/function_patch.dart

Issue 2941643002: Check for a passed-in type argument vector in the prolog of generic functions. (Closed)
Patch Set: address review comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/lib/internal_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 @patch 5 @patch
6 class Function { 6 class Function {
7 // TODO(regis): Pass type arguments to generic functions. Wait for API spec.
7 static _apply(List arguments, List names) native "Function_apply"; 8 static _apply(List arguments, List names) native "Function_apply";
8 9
9 @patch 10 @patch
10 static apply(Function function, List positionalArguments, 11 static apply(Function function, List positionalArguments,
11 [Map<Symbol, dynamic> namedArguments]) { 12 [Map<Symbol, dynamic> namedArguments]) {
12 int numPositionalArguments = 1 + // Function is first implicit argument. 13 int numPositionalArguments = 1 + // Function is first implicit argument.
13 (positionalArguments != null ? positionalArguments.length : 0); 14 (positionalArguments != null ? positionalArguments.length : 0);
14 int numNamedArguments = namedArguments != null ? namedArguments.length : 0; 15 int numNamedArguments = namedArguments != null ? namedArguments.length : 0;
15 int numArguments = numPositionalArguments + numNamedArguments; 16 int numArguments = numPositionalArguments + numNamedArguments;
16 List arguments = new List(numArguments); 17 List arguments = new List(numArguments);
17 arguments[0] = function; 18 arguments[0] = function;
18 arguments.setRange(1, numPositionalArguments, positionalArguments); 19 arguments.setRange(1, numPositionalArguments, positionalArguments);
19 List names = new List(numNamedArguments); 20 List names = new List(numNamedArguments);
20 int argumentIndex = numPositionalArguments; 21 int argumentIndex = numPositionalArguments;
21 int nameIndex = 0; 22 int nameIndex = 0;
22 if (numNamedArguments > 0) { 23 if (numNamedArguments > 0) {
23 namedArguments.forEach((name, value) { 24 namedArguments.forEach((name, value) {
24 arguments[argumentIndex++] = value; 25 arguments[argumentIndex++] = value;
25 names[nameIndex++] = internal.Symbol.getName(name); 26 names[nameIndex++] = internal.Symbol.getName(name);
26 }); 27 });
27 } 28 }
28 return _apply(arguments, names); 29 return _apply(arguments, names);
29 } 30 }
30 } 31 }
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/internal_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698