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

Unified Diff: tests/compiler/dart2js/patch_test.dart

Issue 338103004: Use metadata for patching. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/compiler/dart2js/mock_compiler.dart ('k') | tests/utils/dummy_compiler_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/patch_test.dart
diff --git a/tests/compiler/dart2js/patch_test.dart b/tests/compiler/dart2js/patch_test.dart
index 238aa3e6bfbf9b8dc01a7581b6d65cb3eed19129..13ae806439517b8f8220860774379e776d5cdc41 100644
--- a/tests/compiler/dart2js/patch_test.dart
+++ b/tests/compiler/dart2js/patch_test.dart
@@ -107,7 +107,7 @@ Element ensure(compiler,
testPatchFunction() {
asyncTest(() => applyPatch(
"external test();",
- "patch test() { return 'string'; } ").then((compiler) {
+ "@patch test() { return 'string'; } ").then((compiler) {
ensure(compiler, "test", compiler.coreLibrary.find,
expectIsPatched: true, checkHasBody: true);
ensure(compiler, "test", compiler.coreLibrary.patch.find,
@@ -128,8 +128,8 @@ testPatchConstructor() {
}
""",
"""
- patch class Class {
- patch Class();
+ @patch class Class {
+ @patch Class();
}
""").then((compiler) {
var classOrigin = ensure(compiler, "Class", compiler.coreLibrary.find,
@@ -168,8 +168,8 @@ testPatchRedirectingConstructor() {
}
""",
r"""
- patch class Class {
- patch Class._(x, y) { print('$x,$y'); }
+ @patch class Class {
+ @patch Class._(x, y) { print('$x,$y'); }
}
""").then((compiler) {
var classOrigin = ensure(compiler, "Class", compiler.coreLibrary.find,
@@ -213,8 +213,8 @@ testPatchMember() {
}
""",
"""
- patch class Class {
- patch String toString() => 'string';
+ @patch class Class {
+ @patch String toString() => 'string';
}
""").then((compiler) {
var container = ensure(compiler, "Class", compiler.coreLibrary.find,
@@ -243,8 +243,8 @@ testPatchGetter() {
}
""",
"""
- patch class Class {
- patch int get field => 5;
+ @patch class Class {
+ @patch int get field => 5;
}
""").then((compiler) {
var container = ensure(compiler, "Class", compiler.coreLibrary.find,
@@ -278,7 +278,7 @@ testRegularMember() {
}
""",
"""
- patch class Class {
+ @patch class Class {
}
""").then((compiler) {
var container = ensure(compiler, "Class", compiler.coreLibrary.find,
@@ -306,7 +306,7 @@ testGhostMember() {
}
""",
"""
- patch class Class {
+ @patch class Class {
void ghost() {}
}
""").then((compiler) {
@@ -366,18 +366,18 @@ testPatchSignatureCheck() {
}
""",
"""
- 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}) {}
- patch void method9(int str) {}
- patch void method10([int str]) {}
- patch void method11({int str}) {}
+ @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}) {}
+ @patch void method9(int str) {}
+ @patch void method10([int str]) {}
+ @patch void method11({int str}) {}
}
""").then((compiler) {
var container = ensure(compiler, "Class", compiler.coreLibrary.find,
@@ -433,7 +433,7 @@ testExternalWithoutImplementationTopLevel() {
external void foo();
""",
"""
- // patch void foo() {}
+ // @patch void foo() {}
""").then((compiler) {
var function = ensure(compiler, "foo", compiler.coreLibrary.find);
compiler.resolver.resolve(function);
@@ -457,8 +457,8 @@ testExternalWithoutImplementationMember() {
}
""",
"""
- patch class Class {
- // patch void foo() {}
+ @patch class Class {
+ // @patch void foo() {}
}
""").then((compiler) {
var container = ensure(compiler, "Class", compiler.coreLibrary.find,
@@ -487,7 +487,7 @@ testIsSubclass() {
class A {}
""",
"""
- patch class A {}
+ @patch class A {}
""").then((compiler) {
ClassElement cls = ensure(compiler, "A", compiler.coreLibrary.find,
expectIsPatched: true);
@@ -504,7 +504,7 @@ testPatchNonExistingTopLevel() {
// class Class {}
""",
"""
- patch class Class {}
+ @patch class Class {}
""").then((compiler) {
Expect.isTrue(compiler.warnings.isEmpty,
"Unexpected warnings: ${compiler.warnings}");
@@ -521,8 +521,8 @@ testPatchNonExistingMember() {
class Class {}
""",
"""
- patch class Class {
- patch void foo() {}
+ @patch class Class {
+ @patch void foo() {}
}
""").then((compiler) {
var container = ensure(compiler, "Class", compiler.coreLibrary.find,
@@ -544,7 +544,7 @@ testPatchNonPatchablePatch() {
external get foo;
""",
"""
- patch var foo;
+ @patch var foo;
""").then((compiler) {
ensure(compiler, "foo", compiler.coreLibrary.find);
@@ -563,7 +563,7 @@ testPatchNonPatchableOrigin() {
external var foo;
""",
"""
- patch get foo => 0;
+ @patch get foo => 0;
""").then((compiler) {
ensure(compiler, "foo", compiler.coreLibrary.find);
@@ -586,7 +586,7 @@ testPatchNonExternalTopLevel() {
void foo() {}
""",
"""
- patch void foo() {}
+ @patch void foo() {}
""").then((compiler) {
print('testPatchNonExternalTopLevel.errors:${compiler.errors}');
print('testPatchNonExternalTopLevel.warnings:${compiler.warnings}');
@@ -608,8 +608,8 @@ testPatchNonExternalMember() {
}
""",
"""
- patch class Class {
- patch void foo() {}
+ @patch class Class {
+ @patch void foo() {}
}
""").then((compiler) {
var container = ensure(compiler, "Class", compiler.coreLibrary.find,
@@ -634,7 +634,7 @@ testPatchNonClass() {
external void Class() {}
""",
"""
- patch class Class {}
+ @patch class Class {}
""").then((compiler) {
print('testPatchNonClass.errors:${compiler.errors}');
print('testPatchNonClass.warnings:${compiler.warnings}');
@@ -654,7 +654,7 @@ testPatchNonGetter() {
external void foo() {}
""",
"""
- patch get foo => 0;
+ @patch get foo => 0;
""").then((compiler) {
print('testPatchNonClass.errors:${compiler.errors}');
print('testPatchNonClass.warnings:${compiler.warnings}');
@@ -674,7 +674,7 @@ testPatchNoGetter() {
external set foo(var value) {}
""",
"""
- patch get foo => 0;
+ @patch get foo => 0;
""").then((compiler) {
print('testPatchNonClass.errors:${compiler.errors}');
print('testPatchNonClass.warnings:${compiler.warnings}');
@@ -694,7 +694,7 @@ testPatchNonSetter() {
external void foo() {}
""",
"""
- patch set foo(var value) {}
+ @patch set foo(var value) {}
""").then((compiler) {
print('testPatchNonClass.errors:${compiler.errors}');
print('testPatchNonClass.warnings:${compiler.warnings}');
@@ -714,7 +714,7 @@ testPatchNoSetter() {
external get foo;
""",
"""
- patch set foo(var value) {}
+ @patch set foo(var value) {}
""").then((compiler) {
print('testPatchNonClass.errors:${compiler.errors}');
print('testPatchNonClass.warnings:${compiler.warnings}');
@@ -734,7 +734,7 @@ testPatchNonFunction() {
external get foo;
""",
"""
- patch void foo() {}
+ @patch void foo() {}
""").then((compiler) {
print('testPatchNonClass.errors:${compiler.errors}');
print('testPatchNonClass.warnings:${compiler.warnings}');
@@ -759,9 +759,9 @@ testPatchAndSelector() {
}
""",
"""
- patch class A {
+ @patch class A {
int method() => 0;
- patch void clear() {}
+ @patch void clear() {}
}
""").then((compiler) {
ClassElement cls = ensure(compiler, "A", compiler.coreLibrary.find,
@@ -839,7 +839,7 @@ void testAnalyzeAllInjectedMembers() {
void testTypecheckPatchedMembers() {
String originText = "external void method();";
String patchText = """
- patch void method() {
+ @patch void method() {
String s = 0;
}
""";
« no previous file with comments | « tests/compiler/dart2js/mock_compiler.dart ('k') | tests/utils/dummy_compiler_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698