Mark NoSuchMethodError constructor as deprecated.

Move implementation details into patch files, it does not belong in the interface.
Actually implement NoSuchMethod.withInvocation in dart2js.

Change-Id: I37049c258067b962d18eff42196e37aa127f0dea
Reviewed-on: https://dart-review.googlesource.com/55166
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
This commit is contained in:
Lasse R.H. Nielsen 2018-05-16 09:09:08 +00:00 committed by commit-bot@chromium.org
parent 9b8776763c
commit bf77f064c1
5 changed files with 30 additions and 16 deletions

View file

@ -8,6 +8,9 @@
### Core library changes
* `dart:core`
* Deprecated the `NoSuchMethodError` constructor.
### Dart VM
### Tool Changes

View file

@ -602,6 +602,12 @@ class _CompileTimeError extends Error {
@patch
class NoSuchMethodError {
final Object _receiver;
final Symbol _memberName;
final List _arguments;
final Map<Symbol, dynamic> _namedArguments;
final List _existingArgumentNames;
@patch
NoSuchMethodError(Object receiver, Symbol memberName,
List positionalArguments, Map<Symbol, dynamic> namedArguments,

View file

@ -175,6 +175,13 @@ class AbstractClassInstantiationError {
@patch
class NoSuchMethodError {
// Deprecated members to be removed.
final Object _receiver;
final Symbol _memberName;
final List _arguments;
final Map<Symbol, dynamic> _namedArguments;
final List _existingArgumentNames;
// TODO(regis): Move _receiver declaration here:
// final Object _receiver;
final _InvocationMirror _invocation;

View file

@ -590,10 +590,16 @@ class StringBuffer {
@patch
class NoSuchMethodError {
final Object _receiver;
final Symbol _memberName;
final List _arguments;
final Map<Symbol, dynamic> _namedArguments;
final List _existingArgumentNames;
@patch
NoSuchMethodError.withInvocation(Object receiver, Invocation invocation) {
// UNIMPLEMENTED
}
NoSuchMethodError.withInvocation(Object receiver, Invocation invocation)
: this(receiver, invocation.memberName, invocation.positionalArguments,
invocation.namedArguments);
@patch
NoSuchMethodError(Object receiver, Symbol memberName,

View file

@ -430,13 +430,6 @@ class AbstractClassInstantiationError extends Error {
* Error thrown by the default implementation of [:noSuchMethod:] on [Object].
*/
class NoSuchMethodError extends Error {
// Deprecated members to be removed.
final Object _receiver;
final Symbol _memberName;
final List _arguments;
final Map<Symbol, dynamic> _namedArguments;
final List _existingArgumentNames;
/**
* Create a [NoSuchMethodError] corresponding to a failed method call.
*
@ -446,7 +439,6 @@ class NoSuchMethodError extends Error {
* The [invocation] represents the method call that failed. It
* should not be `null`.
*/
@Deprecated("Dart 2.0. Will be renamed to become default constructor")
external NoSuchMethodError.withInvocation(
Object receiver, Invocation invocation);
@ -469,14 +461,14 @@ class NoSuchMethodError extends Error {
* The [namedArguments] is a map from [Symbol]s to the values of named
* arguments that the method was called with.
*
* The optional [existingArgumentNames] is the expected parameters of a
* method with the same name on the receiver, if available. This is
* the signature of the method that would have been called if the parameters
* had matched.
* This constructor does not handle type arguments.
* To include type variables, create an [Invocation] and use
* [NoSuchMethodError.withInvocation].
*/
@Deprecated("Use NoSuchMethod.withInvocation instead")
external NoSuchMethodError(Object receiver, Symbol memberName,
List positionalArguments, Map<Symbol, dynamic> namedArguments,
[List existingArgumentNames = null]);
[@deprecated List existingArgumentNames = null]);
external String toString();
}