| OLD | NEW |
| 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 { |
| 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 |
| 14 // unresolved method. |
| 15 static void _throwNew(Object receiver, |
| 16 String memberName, |
| 17 List arguments, |
| 18 List argumentNames, |
| 19 List existingArgumentNames) { |
| 20 int numNamedArguments = argumentNames == null ? 0 : argumentNames.length; |
| 21 int numPositionalArguments = arguments == null ? 0 : arguments.length; |
| 22 numPositionalArguments -= numNamedArguments; |
| 23 List positionalArguments; |
| 24 if (numPositionalArguments == 0) { |
| 25 positionalArguments = []; |
| 26 } else { |
| 27 positionalArguments = arguments.getRange(0, numPositionalArguments); |
| 28 } |
| 29 Map<String, dynamic> namedArguments = new Map<String, dynamic>(); |
| 30 for (int i = 0; i < numNamedArguments; i++) { |
| 31 var arg_value = arguments[numPositionalArguments + i]; |
| 32 namedArguments[argumentNames[i]] = arg_value; |
| 33 } |
| 34 throw new NoSuchMethodError(receiver, |
| 35 memberName, |
| 36 positionalArguments, |
| 37 namedArguments, |
| 38 existingArgumentNames); |
| 39 } |
| 40 } |
| OLD | NEW |