Files
sdk/pkg/linter/test_data/rules/prefer_expression_function_bodies.dart
T
pq 0742604758 clean up references to dart test
See: https://github.com/dart-lang/linter/issues/4754

Change-Id: Ib875e1640dd15f321362f2dba76b3d5d8524497c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/328183
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-09-27 21:54:09 +00:00

46 lines
814 B
Dart

// Copyright (c) 2017, 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.
int bad() { // LINT
return 1;
}
int good() {
int a = 2 + 3;
return a;
}
class A {
int left = 1, right = 1;
bool one = false;
int bad() { // LINT
return 1;
}
int good() { // OK
int a = 2 + 3;
return a;
}
int good2() { // OK
if (one) { // OK because it is not a block of a function or method
return 1;
}
return 0;
}
get badWidth { // LINT
return right - left;
}
int get goodWidth => right - left; // OK
set goodWidth(int width) => right = left + width; // OK
set goodWidth2(int width) { // OK
right = left + width;
}
}