cb27634842
lib instead. Review URL: https://codereview.chromium.org//11712002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16583 260f80e4-7a28-3924-810f-c04153c831b5
41 lines
1.6 KiB
Dart
41 lines
1.6 KiB
Dart
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
patch class Error {
|
|
/* patch */ static String _objectToString(Object object) {
|
|
return Object._toString(object);
|
|
}
|
|
}
|
|
|
|
patch class NoSuchMethodError {
|
|
// The compiler emits a call to _throwNew when it cannot resolve a static
|
|
// method at compile time. The receiver is actually the literal class of the
|
|
// unresolved method.
|
|
static void _throwNew(Object receiver,
|
|
String memberName,
|
|
List arguments,
|
|
List argumentNames,
|
|
List existingArgumentNames) {
|
|
int numNamedArguments = argumentNames == null ? 0 : argumentNames.length;
|
|
int numPositionalArguments = arguments == null ? 0 : arguments.length;
|
|
numPositionalArguments -= numNamedArguments;
|
|
List positionalArguments;
|
|
if (numPositionalArguments == 0) {
|
|
positionalArguments = [];
|
|
} else {
|
|
positionalArguments = arguments.getRange(0, numPositionalArguments);
|
|
}
|
|
Map<String, dynamic> namedArguments = new Map<String, dynamic>();
|
|
for (int i = 0; i < numNamedArguments; i++) {
|
|
var arg_value = arguments[numPositionalArguments + i];
|
|
namedArguments[argumentNames[i]] = arg_value;
|
|
}
|
|
throw new NoSuchMethodError(receiver,
|
|
memberName,
|
|
positionalArguments,
|
|
namedArguments,
|
|
existingArgumentNames);
|
|
}
|
|
}
|