| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 class Bar { |
| 6 Bar(val); |
| 7 } |
| 8 |
| 5 class Foo { | 9 class Foo { |
| 6 var x; | 10 var x; |
| 7 f() {} | 11 f() {} |
| 8 | 12 |
| 13 Foo() : x = 0; |
| 14 |
| 9 external var x01; /// 01: compile-time error | 15 external var x01; /// 01: compile-time error |
| 10 external int x02; /// 02: compile-time error | 16 external int x02; /// 02: compile-time error |
| 11 | 17 |
| 12 external f10(); /// 10: runtime error | 18 external f10(); /// 10: runtime error |
| 13 external f11() { } /// 11: compile-time error | 19 external f11() { } /// 11: compile-time error |
| 14 external f12() => 1; /// 12: compile-time error | 20 external f12() => 1; /// 12: compile-time error |
| 15 external static f13(); /// 13: runtime error | 21 external static f13(); /// 13: runtime error |
| 16 static external f14(); /// 14: compile-time error | 22 static external f14(); /// 14: compile-time error |
| 17 int external f16(); /// 16: compile-time error | 23 int external f16(); /// 16: compile-time error |
| 18 | 24 |
| 19 external Foo.n20(); /// 20: runtime error | 25 external Foo.n20(val); /// 20: runtime error |
| 20 external Foo.n21() : x(1); /// 21: compile-time error | 26 external Foo.n21(val) : x = 1; /// 21: compile-time error |
| 21 external Foo.n22() { x = 1; } /// 22: compile-time error | 27 external Foo.n22(val) { x = 1; } /// 22: compile-time error |
| 22 external factory Foo.n23() => new Foo(); /// 23: compile-time error | 28 external factory Foo.n23(val) => new Foo(); /// 23: compile-time error |
| 29 external Foo.n24(this.x); /// 24: compile-time error |
| 30 external factory Foo.n25(val) = Bar; /// 25: compile-time error |
| 23 } | 31 } |
| 24 | 32 |
| 25 external int t06(int i) { } /// 30: compile-time error | 33 external int t06(int i) { } /// 30: compile-time error |
| 26 external int t07(int i) => i + 1; /// 31: compile-time error | 34 external int t07(int i) => i + 1; /// 31: compile-time error |
| 27 | 35 |
| 28 main() { | 36 main() { |
| 29 | 37 |
| 38 // Ensure Foo class is compiled. |
| 39 var foo = new Foo(); |
| 40 |
| 30 // Try calling an unpatched external function. | 41 // Try calling an unpatched external function. |
| 31 var foo = new Foo(); | 42 new Foo().f10(); /// 10: continued |
| 32 try { /// 10: continued | |
| 33 foo.f05(); /// 10: continued | |
| 34 } on String catch (exc) { /// 10: continued | |
| 35 if (exc == "External implementation missing.") { /// 10: continued | |
| 36 throw exc; /// 10: continued | |
| 37 } /// 10: continued | |
| 38 } /// 10: continued | |
| 39 | |
| 40 new Foo().f11(); /// 11: continued | 43 new Foo().f11(); /// 11: continued |
| 41 new Foo().f12(); /// 12: continued | 44 new Foo().f12(); /// 12: continued |
| 42 | 45 Foo.f13(); /// 13: continued |
| 43 try { /// 13: continued | 46 Foo.f14(); /// 14: continued |
| 44 Foo.f13(); /// 13: continued | 47 new Foo().f16(); /// 16: continued |
| 45 } on String catch (exc) { /// 13: continued | |
| 46 if (exc == "External implementation missing.") { /// 13: continued | |
| 47 throw exc; /// 13: continued | |
| 48 } /// 13: continued | |
| 49 } /// 13: continued | |
| 50 | 48 |
| 51 // Try calling an unpatched external constructor. | 49 // Try calling an unpatched external constructor. |
| 52 try { /// 20: continued | 50 new Foo.n20(1); /// 20: continued |
| 53 var foo = new Foo.n09(); /// 20: continued | 51 new Foo.n21(1); /// 21: continued |
| 54 } on String catch (exc) { /// 20: continued | 52 new Foo.n22(1); /// 22: continued |
| 55 if (exc == "External implementation missing.") { /// 20: continued | 53 new Foo.n23(1); /// 23: continued |
| 56 throw exc; /// 20: continued | 54 new Foo.n24(1); /// 24: continued |
| 57 } /// 20: continued | 55 new Foo.n25(1); /// 25: continued |
| 58 } /// 20: continued | |
| 59 | |
| 60 new Foo.n21(); /// 21: continued | |
| 61 new Foo.n22(); /// 22: continued | |
| 62 new Foo.n23(); /// 23: continued | |
| 63 | 56 |
| 64 t06(1); /// 30: continued | 57 t06(1); /// 30: continued |
| 65 t07(1); /// 31: continued | 58 t07(1); /// 31: continued |
| 66 } | 59 } |
| OLD | NEW |