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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 2230383003: Implement @patch annotation for patch class members (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: wip Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/vmservice_patch.dart ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl_test.cc
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index b7348e44e55199d0cec8f5300e4ae409abcbac75..d8a92992aa66d50172110c6f61f992a5d4bbad92 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -6842,39 +6842,39 @@ TEST_CASE(ParsePatchLibrary) {
"external void set topLevelSetter(int value);\n";
const char* kPatchChars =
- "patch class A {\n"
+ "@patch class A {\n"
" var _g;\n"
" A() : fvalue = 13;\n"
" get _field => _g;\n"
- " /*patch*/ void method(var value) {\n"
+ " @patch void method(var value) {\n"
" int closeYourEyes(var eggs) { return eggs * -1; }\n"
" value = callFunc(closeYourEyes, value);\n"
" _g = value * 5;\n"
" }\n"
"}\n"
- "patch class B {\n"
+ "@patch class B {\n"
" B._internal(x) : val = x;\n"
- " /*patch*/ factory B.named(x) { return new B._internal(x); }\n"
- " /*patch*/ factory B(v) native \"const_B_factory\";\n"
+ " @patch factory B.named(x) { return new B._internal(x); }\n"
+ " @patch factory B(v) native \"const_B_factory\";\n"
"}\n"
"var _topLevelValue = -1;\n"
- "patch int topLevel(var value) => value * value;\n"
- "patch int set topLevelSetter(value) { _topLevelValue = value; }\n"
- "patch int get topLevelGetter => 2 * _topLevelValue;\n"
+ "@patch int topLevel(var value) => value * value;\n"
+ "@patch int set topLevelSetter(value) { _topLevelValue = value; }\n"
+ "@patch int get topLevelGetter => 2 * _topLevelValue;\n"
// Allow top level methods named patch.
"patch(x) => x*3;\n"
; // NOLINT
const char* kPatchClassOnlyChars =
- "patch class C {\n"
- " /*patch*/ int method() {\n"
+ "@patch class C {\n"
+ " @patch int method() {\n"
" return 42;\n"
" }\n"
"}\n"
; // NOLINT
const char* kPatchNoClassChars =
- "patch topLevel2(x) => x * 2;\n";
+ "@patch topLevel2(x) => x * 2;\n";
const char* kScriptChars =
"import 'theLibrary';\n"
@@ -10059,9 +10059,9 @@ TEST_CASE(Dart_LoadLibraryPatch_1) {
"foomoo() { A.moo(); }\n";
const char* kScriptChars2 =
- "patch class A {\n"
- " /* patch */ int zoo() { return 1; }\n"
- " /* patch */ static int moo() { return 1; }\n"
+ "@patch class A {\n"
+ " @patch int zoo() { return 1; }\n"
+ " @patch static int moo() { return 1; }\n"
"}\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars1, NULL);
@@ -10099,9 +10099,9 @@ TEST_CASE(Dart_LoadLibraryPatch_Error1) {
"foozoo() { new A().zoo(); }\n";
const char* kScriptChars2 =
- "patch class A {\n"
- " /* patch */ int zoo() { return 1; }\n"
- " /* patch */ int fld1;\n"
+ "@patch class A {\n"
+ " @patch int zoo() { return 1; }\n"
+ " @patch int fld1;\n"
"}\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars1, NULL);
@@ -10136,8 +10136,8 @@ TEST_CASE(Dart_LoadLibraryPatch_Error2) {
"foozoo() { new A().zoo(); }\n";
const char* kScriptChars2 =
- "patch class A {\n"
- " /* patch */ int zoo() { return 1; }\n"
+ "@patch class A {\n"
+ " @patch int zoo() { return 1; }\n"
"}\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars1, NULL);
@@ -10173,8 +10173,8 @@ TEST_CASE(Dart_LoadLibraryPatch_Error3) {
"foozoo() { new A().zoo(); }\n";
const char* kScriptChars2 =
- "patch class A {\n"
- " /* patch */ int zoo() { return 1; }\n"
+ "@patch class A {\n"
+ " @patch int zoo() { return 1; }\n"
"}\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars1, NULL);
« no previous file with comments | « runtime/lib/vmservice_patch.dart ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698