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