blob: c144e855dd5fd3fa239feca71d5f27c222c8296c [file] [log] [blame]
// Copyright (c) 2015, 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 w/ `dart test -N unnecessary_getters`
class BoxBad {
var _contents;
get contents => _contents; //__LINT [9:8]
}
class BoxGood {
final contents = [];
}
class Bad {
var _x;
get x //__LINT
{
return _x;
}
}
class Ok {
var _stuff;
get stuff => _stuff;
set stuff(stuff) {
_stuff = stuff;
}
}
class OkToo {
var _x;
get x {
print(x);
return _x;
}
}
class _SuperClass {
int _field = 0;
}
class PublicClass extends _SuperClass {
int get field => _field; //OK
}
class Q {
int _q; //OK
int get q => _q;
}
q() {
print(new Q()._q);
}