mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 15:01:29 +00:00
Remove support for getters with parameters.
BUG= R=ahe@google.com Review URL: https://codereview.chromium.org//21013004 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25857 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
b7faf57835
commit
79274687c3
|
@ -1515,7 +1515,7 @@ class TypeResolver {
|
|||
visitor, node, typdef.typeVariables, arguments);
|
||||
if (hasTypeArgumentMismatch) {
|
||||
type = new BadTypedefType(typdef,
|
||||
new TypedefType.forUserProvidedBadType(typdef,
|
||||
new TypedefType.forUserProvidedBadType(typdef,
|
||||
arguments.toLink()));
|
||||
} else {
|
||||
if (arguments.isEmpty) {
|
||||
|
@ -3854,14 +3854,8 @@ class SignatureResolver extends CommonResolverVisitor<Element> {
|
|||
if (!identical(formalParameters.getEndToken().next.stringValue,
|
||||
// TODO(ahe): Remove the check for native keyword.
|
||||
'native')) {
|
||||
if (compiler.rejectDeprecatedFeatures &&
|
||||
// TODO(ahe): Remove isPlatformLibrary check.
|
||||
!element.getLibrary().isPlatformLibrary) {
|
||||
compiler.reportError(formalParameters,
|
||||
MessageKind.EXTRA_FORMALS);
|
||||
} else {
|
||||
compiler.onDeprecatedFeature(formalParameters, 'getter parameters');
|
||||
}
|
||||
compiler.reportError(formalParameters,
|
||||
MessageKind.EXTRA_FORMALS);
|
||||
}
|
||||
}
|
||||
LinkBuilder<Element> parametersBuilder =
|
||||
|
@ -3890,10 +3884,6 @@ class SignatureResolver extends CommonResolverVisitor<Element> {
|
|||
MessageKind.ILLEGAL_SETTER_FORMALS);
|
||||
}
|
||||
}
|
||||
if (element.isGetter() && (requiredParameterCount != 0
|
||||
|| visitor.optionalParameterCount != 0)) {
|
||||
compiler.reportError(formalParameters, MessageKind.EXTRA_FORMALS);
|
||||
}
|
||||
return new FunctionSignatureX(parameters,
|
||||
visitor.optionalParameters,
|
||||
requiredParameterCount,
|
||||
|
|
|
@ -54,7 +54,7 @@ main() {
|
|||
// "message" is the expected message as a [String]. This is a
|
||||
// short-term solution and should eventually changed to include
|
||||
// a symbolic reference to a MessageKind.
|
||||
"19<()>::${deprecatedMessage('getter parameters')}\n",
|
||||
"",
|
||||
messages.toString());
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,6 @@ deprecatedMessage(feature) {
|
|||
const Map<String, String> TEST_SOURCE =
|
||||
const <String, String>{ '': """
|
||||
class Foo {
|
||||
get x() => null;
|
||||
}
|
||||
|
||||
main() {
|
||||
|
|
|
@ -28,7 +28,7 @@ class A {
|
|||
}
|
||||
|
||||
class B extends A {
|
||||
get foo() => 42;
|
||||
get foo => 42;
|
||||
operator[](index) => 42;
|
||||
|
||||
returnString1() => super.foo--;
|
||||
|
|
28
tests/language/getter_parameters_test.dart
Normal file
28
tests/language/getter_parameters_test.dart
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Copyright (c) 2013, 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.
|
||||
//
|
||||
// Test that a getter has no parameters.
|
||||
|
||||
get f1 => null;
|
||||
get f2
|
||||
() /// 01: compile-time error
|
||||
=> null;
|
||||
get f3
|
||||
(arg) /// 02: compile-time error
|
||||
=> null;
|
||||
get f4
|
||||
([arg]) /// 03: compile-time error
|
||||
=> null;
|
||||
get f5
|
||||
({arg}) /// 04: compile-time error
|
||||
=> null;
|
||||
|
||||
main() {
|
||||
f1;
|
||||
f2;
|
||||
f3;
|
||||
f4;
|
||||
f5;
|
||||
}
|
||||
|
Loading…
Reference in a new issue