-
Notifications
You must be signed in to change notification settings - Fork 1.7k
dart:mirrors fails to find metadata on dependencies #33774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Output with 6dfc4ef revision
So only annotation on dependencies is still missing. |
I found that dependencies annotations are not implemented. diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.cc b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
index ac65dec..5fac295 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.cc
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.cc
@@ -1304,7 +1304,10 @@ void LibraryDependencyHelper::ReadUntilExcluding(Field field) {
}
/* Falls through */
case kAnnotations: {
- helper_->SkipListOfExpressions();
+ annotation_count_ = helper_->ReadListLength(); // read list length.
+ for (intptr_t i = 0; i < annotation_count_; ++i) {
+ helper_->SkipExpression(); // read ith expression.
+ }
if (++next_read_ == field) return;
}
/* Falls through */
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.h b/runtime/vm/compiler/frontend/kernel_translation_helper.h
index 342a8de..ee81079 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.h
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.h
@@ -729,7 +729,7 @@ class LibraryDependencyHelper {
};
explicit LibraryDependencyHelper(KernelReaderHelper* helper)
- : helper_(helper), next_read_(kFileOffset) {}
+ : annotation_count_(0), helper_(helper), next_read_(kFileOffset) {}
void ReadUntilIncluding(Field field) {
ReadUntilExcluding(static_cast<Field>(static_cast<int>(field) + 1));
@@ -740,6 +740,7 @@ class LibraryDependencyHelper {
uint8_t flags_;
StringIndex name_index_;
NameIndex target_library_canonical_name_;
+ intptr_t annotation_count_;
private:
KernelReaderHelper* helper_; |
I guess that |
I'm close to the solution, but I'm only starting to understand C++ source. diff --git a/runtime/vm/kernel_loader.cc b/runtime/vm/kernel_loader.cc
index 114ae9a..920740f 100644
--- a/runtime/vm/kernel_loader.cc
+++ b/runtime/vm/kernel_loader.cc
@@ -869,6 +869,7 @@ void KernelLoader::LoadLibraryImportsAndExports(Library* library) {
const intptr_t deps_count = builder_.ReadListLength();
for (intptr_t dep = 0; dep < deps_count; ++dep) {
LibraryDependencyHelper dependency_helper(&builder_);
+ intptr_t library_dependency_kernel_offset = builder_.ReaderOffset();
dependency_helper.ReadUntilExcluding(LibraryDependencyHelper::kCombinators);
// Ignore the dependency if the target library is invalid.
@@ -937,6 +938,14 @@ void KernelLoader::LoadLibraryImportsAndExports(Library* library) {
}
}
}
+
+ if (FLAG_enable_mirrors && (dependency_helper.annotation_count_ > 0)) {
+ AlternativeReadingScope alt(&builder_.reader_, library_dependency_kernel_offset);
+ LibraryDependencyHelper dependency_helper(&builder_);
+ dependency_helper.ReadUntilExcluding(LibraryDependencyHelper::kAnnotations);
+ Object& metadata = Object::ZoneHandle(Z, builder_.BuildAnnotations());
+ target_library.AddLibraryMetadata(metadata, builder_.ReadPosition());
+ }
}
} |
@alexmarkov, @rmacnak-google |
Thanks |
Dart VM version: 2.0.0-dev.67.0 (Tue Jul 3 18:17:07 2018 +0200) on "macos_x64"
Output with Dart 1.24.3
Output with Dart 2.0.0-dev.67.0
The text was updated successfully, but these errors were encountered: