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

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

Issue 12817003: Change getRange to sublist. Make getRange deprecated. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 9 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 | Annotate | Revision Log
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 class Error { 5 patch class Error {
6 /* patch */ static String _objectToString(Object object) { 6 /* patch */ static String _objectToString(Object object) {
7 return Object._toString(object); 7 return Object._toString(object);
8 } 8 }
9 } 9 }
10 10
11 patch class NoSuchMethodError { 11 patch class NoSuchMethodError {
12 // The compiler emits a call to _throwNew when it cannot resolve a static 12 // The compiler emits a call to _throwNew when it cannot resolve a static
13 // method at compile time. The receiver is actually the literal class of the 13 // method at compile time. The receiver is actually the literal class of the
14 // unresolved method. 14 // unresolved method.
15 static void _throwNew(Object receiver, 15 static void _throwNew(Object receiver,
16 String memberName, 16 String memberName,
17 int invocation_type, 17 int invocation_type,
18 List arguments, 18 List arguments,
19 List argumentNames, 19 List argumentNames,
20 List existingArgumentNames) { 20 List existingArgumentNames) {
21 int numNamedArguments = argumentNames == null ? 0 : argumentNames.length; 21 int numNamedArguments = argumentNames == null ? 0 : argumentNames.length;
22 int numPositionalArguments = arguments == null ? 0 : arguments.length; 22 int numPositionalArguments = arguments == null ? 0 : arguments.length;
23 numPositionalArguments -= numNamedArguments; 23 numPositionalArguments -= numNamedArguments;
24 List positionalArguments; 24 List positionalArguments;
25 if (numPositionalArguments == 0) { 25 if (numPositionalArguments == 0) {
26 positionalArguments = []; 26 positionalArguments = [];
27 } else { 27 } else {
28 positionalArguments = arguments.getRange(0, numPositionalArguments); 28 positionalArguments = arguments.sublist(0, numPositionalArguments);
29 } 29 }
30 Map<String, dynamic> namedArguments = new Map<String, dynamic>(); 30 Map<String, dynamic> namedArguments = new Map<String, dynamic>();
31 for (int i = 0; i < numNamedArguments; i++) { 31 for (int i = 0; i < numNamedArguments; i++) {
32 var arg_value = arguments[numPositionalArguments + i]; 32 var arg_value = arguments[numPositionalArguments + i];
33 namedArguments[argumentNames[i]] = arg_value; 33 namedArguments[argumentNames[i]] = arg_value;
34 } 34 }
35 throw new NoSuchMethodError._withType(receiver, 35 throw new NoSuchMethodError._withType(receiver,
36 memberName, 36 memberName,
37 invocation_type, 37 invocation_type,
38 positionalArguments, 38 positionalArguments,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 msg_buf.write( 143 msg_buf.write(
144 "NoSuchMethodError: incorrect number of arguments passed to " 144 "NoSuchMethodError: incorrect number of arguments passed to "
145 "method named '$_memberName'\n" 145 "method named '$_memberName'\n"
146 "Receiver: ${Error.safeToString(_receiver)}\n" 146 "Receiver: ${Error.safeToString(_receiver)}\n"
147 "Tried calling: $_memberName($actualParameters)\n" 147 "Tried calling: $_memberName($actualParameters)\n"
148 "Found: $_memberName($formalParameters)"); 148 "Found: $_memberName($formalParameters)");
149 } 149 }
150 return msg_buf.toString(); 150 return msg_buf.toString();
151 } 151 }
152 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698