Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: test/codegen/language/final_field_override_test.dart

Issue 1918033002: Remove virtualField helper, just emit getters/setters in codegen. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/codegen/expect/language-all.js ('k') | tool/input_sdk/private/ddc_runtime/classes.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Tests that a setter in a subclass does not shadow the getter in the
6 // superclass.
7 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
8 6
9 class A { 7 class A {
10 int _x = 42; 8 int _x = 42;
9 void set x(int val) {
10 _x = val;
11 }
11 int get x => _x; 12 int get x => _x;
12 } 13 }
13 14
14 class B extends A { 15 class B extends A {
15 void set x(int val) { 16 final x = 3;
16 _x = val; 17 // we can still get to the super property
17 } 18 int get y => _x;
18 } 19 }
19 20
20 void main() { 21 void main() {
21 var b = new B(); 22 var b = new B();
22 Expect.equals(42, b.x); 23 Expect.equals(3, b.x);
23 24
24 b.x = 21; 25 b.x = 21;
25 Expect.equals(21, b.x); 26 Expect.equals(3, b.x);
27 Expect.equals(21, b.y);
26 } 28 }
OLDNEW
« no previous file with comments | « test/codegen/expect/language-all.js ('k') | tool/input_sdk/private/ddc_runtime/classes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698