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

Unified Diff: runtime/vm/kernel_reader.cc

Issue 2782913003: Revert "Remove definitions from Kernel canonical names." (Closed)
Patch Set: Created 3 years, 9 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/kernel_binary.cc ('k') | runtime/vm/kernel_to_il.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel_reader.cc
diff --git a/runtime/vm/kernel_reader.cc b/runtime/vm/kernel_reader.cc
index 231300e595be74842e241850bdf2144a308c403b..d8b7507b6ce6fd1fbf066234a042db9d44169b65 100644
--- a/runtime/vm/kernel_reader.cc
+++ b/runtime/vm/kernel_reader.cc
@@ -134,8 +134,10 @@ Object& KernelReader::ReadProgram() {
}
if (ClassFinalizer::ProcessPendingClasses(/*from_kernel=*/true)) {
- CanonicalName* main = program_->main_method();
- dart::Library& library = LookupLibrary(main->EnclosingName());
+ Procedure* main = program_->main_method();
+ Library* kernel_main_library = Library::Cast(main->parent());
+ dart::Library& library =
+ LookupLibrary(kernel_main_library->canonical_name());
// Sanity check that we can find the main entrypoint.
Object& main_obj = Object::Handle(
@@ -358,8 +360,7 @@ dart::Class& KernelReader::ReadClass(const dart::Library& library,
ActiveFunctionScope active_function_scope(&active_class_,
kernel_constructor->function());
- const dart::String& name =
- H.DartConstructorName(kernel_constructor->canonical_name());
+ const dart::String& name = H.DartConstructorName(kernel_constructor);
Function& function = dart::Function::ZoneHandle(
Z, dart::Function::New(name, RawFunction::kConstructor,
false, // is_static
@@ -413,8 +414,7 @@ void KernelReader::ReadProcedure(const dart::Library& library,
ActiveFunctionScope active_function_scope(&active_class_,
kernel_procedure->function());
- const dart::String& name =
- H.DartProcedureName(kernel_procedure->canonical_name());
+ const dart::String& name = H.DartProcedureName(kernel_procedure);
bool is_method = kernel_klass != NULL && !kernel_procedure->IsStatic();
bool is_abstract = kernel_procedure->IsAbstract();
bool is_external = kernel_procedure->IsExternal();
@@ -428,18 +428,16 @@ void KernelReader::ReadProcedure(const dart::Library& library,
if (!annotation->IsConstructorInvocation()) continue;
ConstructorInvocation* invocation =
ConstructorInvocation::Cast(annotation);
- CanonicalName* annotation_class = invocation->target()->EnclosingName();
- ASSERT(annotation_class->IsClass());
+ Class* annotation_class = Class::Cast(invocation->target()->parent());
String* class_name = annotation_class->name();
// Just compare by name, do not generate the annotation class.
int length = sizeof("ExternalName") - 1;
if (class_name->size() != length) continue;
if (memcmp(class_name->buffer(), "ExternalName", length) != 0) continue;
- ASSERT(annotation_class->parent()->IsLibrary());
String* library_name = annotation_class->parent()->name();
- length = sizeof("dart:_internal") - 1;
+ length = sizeof("dart._internal") - 1;
if (library_name->size() != length) continue;
- if (memcmp(library_name->buffer(), "dart:_internal", length) != 0) {
+ if (memcmp(library_name->buffer(), "dart._internal", length) != 0) {
continue;
}
@@ -495,9 +493,8 @@ void KernelReader::ReadProcedure(const dart::Library& library,
if (kernel_klass == NULL) {
library.AddObject(function, name);
- ASSERT(!Object::Handle(
- Z, library.LookupObjectAllowPrivate(
- H.DartProcedureName(kernel_procedure->canonical_name())))
+ ASSERT(!Object::Handle(Z, library.LookupObjectAllowPrivate(
+ H.DartProcedureName(kernel_procedure)))
.IsNull());
}
if (FLAG_enable_mirrors) {
@@ -632,8 +629,7 @@ void KernelReader::GenerateFieldAccessors(const dart::Class& klass,
}
}
- const dart::String& getter_name =
- H.DartGetterName(kernel_field->canonical_name());
+ const dart::String& getter_name = H.DartGetterName(kernel_field->name());
const Object& script_class =
ClassForScriptAt(klass, kernel_field->source_uri_index());
Function& getter = Function::ZoneHandle(
@@ -663,8 +659,7 @@ void KernelReader::GenerateFieldAccessors(const dart::Class& klass,
if (!kernel_field->IsStatic() && !kernel_field->IsFinal()) {
// Only static fields can be const.
ASSERT(!kernel_field->IsConst());
- const dart::String& setter_name =
- H.DartSetterName(kernel_field->canonical_name());
+ const dart::String& setter_name = H.DartSetterName(kernel_field->name());
Function& setter = Function::ZoneHandle(
Z, Function::New(setter_name, RawFunction::kImplicitSetter,
false, // is_static
« no previous file with comments | « runtime/vm/kernel_binary.cc ('k') | runtime/vm/kernel_to_il.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698