| Index: tests/compiler/dart2js/patch_test.dart
|
| diff --git a/tests/compiler/dart2js/patch_test.dart b/tests/compiler/dart2js/patch_test.dart
|
| index bdefca5e5394e65af27c295005aab69b73833725..b0bc1096a44fae19eb1e6ee3e97d06be4bdad5ad 100644
|
| --- a/tests/compiler/dart2js/patch_test.dart
|
| +++ b/tests/compiler/dart2js/patch_test.dart
|
| @@ -109,6 +109,11 @@ testPatchFunction() {
|
| "patch test() { return 'string'; } ");
|
| ensure(compiler, "test", compiler.coreLibrary.find, isPatched: true);
|
| ensure(compiler, "test", compiler.coreLibrary.patch.find, isPatch: true);
|
| +
|
| + Expect.isTrue(compiler.warnings.isEmpty(),
|
| + "Unexpected warnings: ${compiler.warnings}");
|
| + Expect.isTrue(compiler.errors.isEmpty(),
|
| + "Unexpected errors: ${compiler.errors}");
|
| }
|
|
|
| testPatchMember() {
|
| @@ -126,13 +131,18 @@ testPatchMember() {
|
| var container = ensure(compiler, "Class", compiler.coreLibrary.find,
|
| isMethod: false, isPatched: true);
|
| container.parseNode(compiler);
|
| - ensure(compiler, "Class", compiler.coreLibrary.patch.find,
|
| + ensure(compiler, "Class", compiler.coreLibrary.patch.find,
|
| isMethod: false, isPatch: true);
|
|
|
| - ensure(compiler, "toString", container.lookupLocalMember,
|
| + ensure(compiler, "toString", container.lookupLocalMember,
|
| isPatched: true);
|
| - ensure(compiler, "toString", container.patch.lookupLocalMember,
|
| + ensure(compiler, "toString", container.patch.lookupLocalMember,
|
| isPatch: true);
|
| +
|
| + Expect.isTrue(compiler.warnings.isEmpty(),
|
| + "Unexpected warnings: ${compiler.warnings}");
|
| + Expect.isTrue(compiler.errors.isEmpty(),
|
| + "Unexpected errors: ${compiler.errors}");
|
| }
|
|
|
| testPatchGetter() {
|
| @@ -160,6 +170,11 @@ testPatchGetter() {
|
| container.patch.lookupLocalMember,
|
| isGetter: true,
|
| isPatch: true);
|
| +
|
| + Expect.isTrue(compiler.warnings.isEmpty(),
|
| + "Unexpected warnings: ${compiler.warnings}");
|
| + Expect.isTrue(compiler.errors.isEmpty(),
|
| + "Unexpected errors: ${compiler.errors}");
|
| }
|
|
|
| testRegularMember() {
|
| @@ -176,11 +191,16 @@ testRegularMember() {
|
| var container = ensure(compiler, "Class", compiler.coreLibrary.find,
|
| isMethod: false, isPatched: true);
|
| container.parseNode(compiler);
|
| - ensure(compiler, "Class", compiler.coreLibrary.patch.find,
|
| + ensure(compiler, "Class", compiler.coreLibrary.patch.find,
|
| isMethod: false, isPatch: true);
|
|
|
| ensure(compiler, "regular", container.lookupLocalMember);
|
| ensure(compiler, "regular", container.patch.lookupLocalMember);
|
| +
|
| + Expect.isTrue(compiler.warnings.isEmpty(),
|
| + "Unexpected warnings: ${compiler.warnings}");
|
| + Expect.isTrue(compiler.errors.isEmpty(),
|
| + "Unexpected errors: ${compiler.errors}");
|
| }
|
|
|
| testGhostMember() {
|
| @@ -194,14 +214,19 @@ testGhostMember() {
|
| void ghost() {}
|
| }
|
| """);
|
| - var container = ensure(compiler, "Class", compiler.coreLibrary.find,
|
| + var container = ensure(compiler, "Class", compiler.coreLibrary.find,
|
| isMethod: false, isPatched: true);
|
| container.parseNode(compiler);
|
| - ensure(compiler, "Class", compiler.coreLibrary.patch.find,
|
| + ensure(compiler, "Class", compiler.coreLibrary.patch.find,
|
| isMethod: false, isPatch: true);
|
|
|
| ensure(compiler, "ghost", container.lookupLocalMember, isFound: false);
|
| ensure(compiler, "ghost", container.patch.lookupLocalMember);
|
| +
|
| + Expect.isTrue(compiler.warnings.isEmpty(),
|
| + "Unexpected warnings: ${compiler.warnings}");
|
| + Expect.isTrue(compiler.errors.isEmpty(),
|
| + "Unexpected errors: ${compiler.errors}");
|
| }
|
|
|
| testInjectFunction() {
|
| @@ -215,6 +240,121 @@ testInjectFunction() {
|
| ensure(compiler,
|
| "_function",
|
| compiler.coreLibrary.patch.find);
|
| +
|
| + Expect.isTrue(compiler.warnings.isEmpty(),
|
| + "Unexpected warnings: ${compiler.warnings}");
|
| + Expect.isTrue(compiler.errors.isEmpty(),
|
| + "Unexpected errors: ${compiler.errors}");
|
| +}
|
| +
|
| +testPatchSignatureCheck() {
|
| + var compiler = applyPatch(
|
| + """
|
| + class Class {
|
| + external String method1();
|
| + external void method2(String str);
|
| + external void method3(String s1);
|
| + external void method4([String str]);
|
| + external void method5({String str});
|
| + external void method6({String str});
|
| + external void method7([String s1]);
|
| + external void method8({String s1});
|
| + }
|
| + """,
|
| + """
|
| + patch class Class {
|
| + patch int method1() => 0;
|
| + patch void method2() {}
|
| + patch void method3(String s2) {}
|
| + patch void method4([String str, int i]) {}
|
| + patch void method5() {}
|
| + patch void method6([String str]) {}
|
| + patch void method7([String s2]) {}
|
| + patch void method8({String s2}) {}
|
| + }
|
| + """);
|
| + var container = ensure(compiler, "Class", compiler.coreLibrary.find,
|
| + isMethod: false, isPatched: true);
|
| + container.ensureResolved(compiler);
|
| + container.parseNode(compiler);
|
| +
|
| + compiler.resolver.resolveMethodElement(
|
| + ensure(compiler, "method1", container.lookupLocalMember,
|
| + isPatched: true));
|
| + Expect.isTrue(compiler.warnings.isEmpty(),
|
| + "Unexpected warnings: ${compiler.warnings}");
|
| + Expect.isFalse(compiler.errors.isEmpty());
|
| + print('method1:${compiler.errors}');
|
| +
|
| + compiler.warnings.clear();
|
| + compiler.errors.clear();
|
| + compiler.resolver.resolveMethodElement(
|
| + ensure(compiler, "method2", container.lookupLocalMember,
|
| + isPatched: true));
|
| + Expect.isTrue(compiler.warnings.isEmpty(),
|
| + "Unexpected warnings: ${compiler.warnings}");
|
| + Expect.isFalse(compiler.errors.isEmpty());
|
| + print('method2:${compiler.errors}');
|
| +
|
| + compiler.warnings.clear();
|
| + compiler.errors.clear();
|
| + compiler.resolver.resolveMethodElement(
|
| + ensure(compiler, "method3", container.lookupLocalMember,
|
| + isPatched: true));
|
| + Expect.isTrue(compiler.warnings.isEmpty(),
|
| + "Unexpected warnings: ${compiler.warnings}");
|
| + Expect.isFalse(compiler.errors.isEmpty());
|
| + print('method3:${compiler.errors}');
|
| +
|
| + compiler.warnings.clear();
|
| + compiler.errors.clear();
|
| + compiler.resolver.resolveMethodElement(
|
| + ensure(compiler, "method4", container.lookupLocalMember,
|
| + isPatched: true));
|
| + Expect.isTrue(compiler.warnings.isEmpty(),
|
| + "Unexpected warnings: ${compiler.warnings}");
|
| + Expect.isFalse(compiler.errors.isEmpty());
|
| + print('method4:${compiler.errors}');
|
| +
|
| + compiler.warnings.clear();
|
| + compiler.errors.clear();
|
| + compiler.resolver.resolveMethodElement(
|
| + ensure(compiler, "method5", container.lookupLocalMember,
|
| + isPatched: true));
|
| + Expect.isTrue(compiler.warnings.isEmpty(),
|
| + "Unexpected warnings: ${compiler.warnings}");
|
| + Expect.isFalse(compiler.errors.isEmpty());
|
| + print('method5:${compiler.errors}');
|
| +
|
| + compiler.warnings.clear();
|
| + compiler.errors.clear();
|
| + compiler.resolver.resolveMethodElement(
|
| + ensure(compiler, "method6", container.lookupLocalMember,
|
| + isPatched: true));
|
| + Expect.isTrue(compiler.warnings.isEmpty(),
|
| + "Unexpected warnings: ${compiler.warnings}");
|
| + Expect.isFalse(compiler.errors.isEmpty());
|
| + print('method6:${compiler.errors}');
|
| +
|
| + compiler.warnings.clear();
|
| + compiler.errors.clear();
|
| + compiler.resolver.resolveMethodElement(
|
| + ensure(compiler, "method7", container.lookupLocalMember,
|
| + isPatched: true));
|
| + Expect.isTrue(compiler.warnings.isEmpty(),
|
| + "Unexpected warnings: ${compiler.warnings}");
|
| + Expect.isFalse(compiler.errors.isEmpty());
|
| + print('method7:${compiler.errors}');
|
| +
|
| + compiler.warnings.clear();
|
| + compiler.errors.clear();
|
| + compiler.resolver.resolveMethodElement(
|
| + ensure(compiler, "method8", container.lookupLocalMember,
|
| + isPatched: true));
|
| + Expect.isTrue(compiler.warnings.isEmpty(),
|
| + "Unexpected warnings: ${compiler.warnings}");
|
| + Expect.isFalse(compiler.errors.isEmpty());
|
| + print('method8:${compiler.errors}');
|
| }
|
|
|
| main() {
|
| @@ -224,4 +364,5 @@ main() {
|
| testRegularMember();
|
| testGhostMember();
|
| testInjectFunction();
|
| + testPatchSignatureCheck();
|
| }
|
|
|