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 |