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

Side by Side Diff: tests/compiler/dart2js_native/native_property_frog_test.dart

Issue 421483002: Remove old frog-style dummy bodies from dart2js native class tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Properties on hidden native classes. 5 // Properties on hidden native classes.
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import "dart:_js_helper"; 8 import "dart:_js_helper";
9 import 'dart:_foreign_helper' show JS; 9 import 'dart:_foreign_helper' show JS;
10 10
11 @Native("A") 11 @Native("A")
12 class A { 12 class A {
13 13
14 // Setters and getters should be similar to these methods: 14 // Setters and getters should be similar to these methods:
15 int getX() => JS('int', '#._x', this); 15 int getX() => JS('int', '#._x', this);
16 void setX(int value) { JS('void', '#._x = #', this, value); } 16 void setX(int value) { JS('void', '#._x = #', this, value); }
17 17
18 int get X() native; 18 int get X() native;
19 set X(int value) native; 19 set X(int value) native;
20 20
21 int get Y() native; 21 int get Y() native;
22 set Y(int value) native; 22 set Y(int value) native;
23 23
24 int get Z => JS('int', '#._z', this); 24 int get Z => JS('int', '#._z', this);
25 set Z(int value) { JS('void', '#._z = #', this, value); } 25 set Z(int value) { JS('void', '#._z = #', this, value); }
26 } 26 }
27 27
28 A makeA() native { return new A(); } 28 A makeA() native;
29 29
30 void setup() native """ 30 void setup() native """
31 function A() {} 31 function A() {}
32 32
33 Object.defineProperty(A.prototype, "X", { 33 Object.defineProperty(A.prototype, "X", {
34 get: function () { return this._x; }, 34 get: function () { return this._x; },
35 set: function (v) { this._x = v; } 35 set: function (v) { this._x = v; }
36 }); 36 });
37 37
38 makeA = function(){return new A;}; 38 makeA = function(){return new A;};
39 """; 39 """;
40 40
41 41
42 main() { 42 main() {
43 setup(); 43 setup();
44 44
45 var a = makeA(); 45 var a = makeA();
46 46
47 a.setX(5); 47 a.setX(5);
48 Expect.equals(5, a.getX()); 48 Expect.equals(5, a.getX());
49 49
50 a.X = 10; 50 a.X = 10;
51 a.Y = 20; 51 a.Y = 20;
52 a.Z = 30; 52 a.Z = 30;
53 53
54 Expect.equals(10, a.X); 54 Expect.equals(10, a.X);
55 Expect.equals(20, a.Y); 55 Expect.equals(20, a.Y);
56 Expect.equals(30, a.Z); 56 Expect.equals(30, a.Z);
57 } 57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698