-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use lazy static fields when overriding static getters or setters.
Fixes #522 R=jmesserly@google.com Review URL: https://codereview.chromium.org/1927353002 .
- Loading branch information
1 parent
8c745c6
commit d109467
Showing
5 changed files
with
87 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
pkg/dev_compiler/test/codegen/language/static_field_override1_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) 2016, 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. | ||
|
||
import 'package:expect/expect.dart'; | ||
|
||
class Foo { | ||
static int get x => 42; | ||
} | ||
|
||
class Bar extends Foo { | ||
static int x = 12; | ||
} | ||
|
||
void main() { | ||
Expect.equals(12, Bar.x); | ||
} |
18 changes: 18 additions & 0 deletions
18
pkg/dev_compiler/test/codegen/language/static_field_override2_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2016, 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. | ||
|
||
import 'package:expect/expect.dart'; | ||
|
||
class Foo { | ||
static int get x => 42; | ||
static void set x(value) {} | ||
} | ||
|
||
class Bar extends Foo { | ||
static int x = 12; | ||
} | ||
|
||
void main() { | ||
Expect.equals(12, Bar.x); | ||
} |
17 changes: 17 additions & 0 deletions
17
pkg/dev_compiler/test/codegen/language/static_field_override3_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) 2016, 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. | ||
|
||
import 'package:expect/expect.dart'; | ||
|
||
class Foo { | ||
static int x = 42; | ||
} | ||
|
||
class Bar extends Foo { | ||
static int x = 12; | ||
} | ||
|
||
void main() { | ||
Expect.equals(12, Bar.x); | ||
} |