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

Unified Diff: runtime/vm/parser.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/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 0543a078544629655bba5a78dd9f64936625b152..6c64bad199efbb403453bb55897d75a67cb90cfe 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -4034,6 +4034,12 @@ void Parser::ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method) {
if (library_.is_dart_scheme() && library_.IsPrivate(*method->name)) {
func.set_is_reflectable(false);
}
+ if (is_patch_source() && IsPatchAnnotation(method->metadata_pos)) {
+ // Currently, we just ignore the patch annotation. If the function
+ // name already exists in the patched class, this function will replace
+ // the one in the patched class.
+ method->metadata_pos = TokenPosition::kNoSource;
+ }
if (FLAG_enable_mirrors && (method->metadata_pos.IsReal())) {
library_.AddFunctionMetadata(func, method->metadata_pos);
}
@@ -4134,6 +4140,11 @@ void Parser::ParseFieldDefinition(ClassDesc* members, MemberDesc* field) {
class_field.set_has_initializer(has_initializer);
members->AddField(class_field);
field->field_ = &class_field;
+ if (is_patch_source() && IsPatchAnnotation(field->metadata_pos)) {
+ // Currently, we just ignore the patch annotation on fields.
+ // All fields in the patch class are added to the patched class.
+ field->metadata_pos = TokenPosition::kNoSource;
+ }
if (FLAG_enable_mirrors && (field->metadata_pos.IsReal())) {
library_.AddFieldMetadata(class_field, field->metadata_pos);
}
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698