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

Unified Diff: runtime/vm/parser.cc

Issue 27006003: Cleanups, refactoring in anticipation of new string interpolation nodes. Removed unnecessary code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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
« runtime/vm/object.cc ('K') | « runtime/vm/object.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
===================================================================
--- runtime/vm/parser.cc (revision 28616)
+++ runtime/vm/parser.cc (working copy)
@@ -1716,27 +1716,6 @@
}
-// Lookup class in the core lib which also contains various VM
-// helper methods and classes. Allow look up of private classes.
-static RawClass* LookupCoreClass(const String& class_name) {
- const Library& core_lib = Library::Handle(Library::CoreLibrary());
- String& name = String::Handle(class_name.raw());
- if (class_name.CharAt(0) == Scanner::kPrivateIdentifierStart) {
- // Private identifiers are mangled on a per script basis.
- name = String::Concat(name, String::Handle(core_lib.private_key()));
- name = Symbols::New(name);
- }
- return core_lib.LookupClass(name);
-}
-
-
-static const String& PrivateCoreLibName(const String& str) {
- const Library& core_lib = Library::Handle(Library::CoreLibrary());
- const String& private_name = String::ZoneHandle(core_lib.PrivateName(str));
- return private_name;
-}
-
-
StaticCallNode* Parser::BuildInvocationMirrorAllocation(
intptr_t call_pos,
const String& function_name,
@@ -1774,11 +1753,11 @@
arguments->Add(args_array);
// Lookup the static InvocationMirror._allocateInvocationMirror method.
const Class& mirror_class =
- Class::Handle(LookupCoreClass(Symbols::InvocationMirror()));
+ Class::Handle(Library::LookupCoreClass(Symbols::InvocationMirror()));
ASSERT(!mirror_class.IsNull());
const Function& allocation_function = Function::ZoneHandle(
mirror_class.LookupStaticFunction(
- PrivateCoreLibName(Symbols::AllocateInvocationMirror())));
+ Library::PrivateCoreLibName(Symbols::AllocateInvocationMirror())));
ASSERT(!allocation_function.IsNull());
return new StaticCallNode(call_pos, allocation_function, arguments);
}
@@ -6191,7 +6170,7 @@
TokenPos(), Integer::ZoneHandle(Integer::New(TokenPos()))));
current_block_->statements->Add(
MakeStaticCall(Symbols::FallThroughError(),
- PrivateCoreLibName(Symbols::ThrowNew()),
+ Library::PrivateCoreLibName(Symbols::ThrowNew()),
arguments));
}
break;
@@ -6509,7 +6488,7 @@
AstNode* Parser::MakeStaticCall(const String& cls_name,
const String& func_name,
ArgumentListNode* arguments) {
- const Class& cls = Class::Handle(LookupCoreClass(cls_name));
+ const Class& cls = Class::Handle(Library::LookupCoreClass(cls_name));
ASSERT(!cls.IsNull());
const Function& func = Function::ZoneHandle(
Resolver::ResolveStatic(cls,
@@ -6529,7 +6508,7 @@
arguments->Add(new LiteralNode(end,
Integer::ZoneHandle(Integer::New(end))));
return MakeStaticCall(Symbols::AssertionError(),
- PrivateCoreLibName(Symbols::ThrowNew()),
+ Library::PrivateCoreLibName(Symbols::ThrowNew()),
arguments);
}
@@ -6822,7 +6801,7 @@
new InstanceCallNode(
catch_pos,
new LoadLocalNode(catch_pos, trace),
- PrivateCoreLibName(Symbols::_setupFullStackTrace()),
+ Library::PrivateCoreLibName(Symbols::_setupFullStackTrace()),
no_args));
}
@@ -7390,7 +7369,7 @@
arguments->Add(new LiteralNode(type_pos, String::ZoneHandle(
Symbols::New(error.ToErrorCString()))));
return MakeStaticCall(Symbols::TypeError(),
- PrivateCoreLibName(Symbols::ThrowNew()),
+ Library::PrivateCoreLibName(Symbols::ThrowNew()),
arguments);
}
@@ -7469,7 +7448,7 @@
arguments->Add(new LiteralNode(call_pos, array));
return MakeStaticCall(Symbols::NoSuchMethodError(),
- PrivateCoreLibName(Symbols::ThrowNew()),
+ Library::PrivateCoreLibName(Symbols::ThrowNew()),
arguments);
}
@@ -9354,11 +9333,11 @@
} else {
// Factory call at runtime.
const Class& factory_class =
- Class::Handle(LookupCoreClass(Symbols::List()));
+ Class::Handle(Library::LookupCoreClass(Symbols::List()));
ASSERT(!factory_class.IsNull());
const Function& factory_method = Function::ZoneHandle(
factory_class.LookupFactory(
- PrivateCoreLibName(Symbols::ListLiteralFactory())));
+ Library::PrivateCoreLibName(Symbols::ListLiteralFactory())));
ASSERT(!factory_method.IsNull());
if (!list_type_arguments.IsNull() &&
!list_type_arguments.IsInstantiated() &&
@@ -9597,7 +9576,7 @@
// Construct the map object.
const Class& immutable_map_class =
- Class::Handle(LookupCoreClass(Symbols::ImmutableMap()));
+ Class::Handle(Library::LookupCoreClass(Symbols::ImmutableMap()));
ASSERT(!immutable_map_class.IsNull());
// If the immutable map class extends other parameterized classes, we need
// to adjust the type argument vector. This is currently not the case.
@@ -9606,7 +9585,7 @@
constr_args->Add(new LiteralNode(literal_pos, key_value_array));
const Function& map_constr =
Function::ZoneHandle(immutable_map_class.LookupConstructor(
- PrivateCoreLibName(Symbols::ImmutableMapConstructor())));
+ Library::PrivateCoreLibName(Symbols::ImmutableMapConstructor())));
ASSERT(!map_constr.IsNull());
const Object& constructor_result = Object::Handle(
EvaluateConstConstructorCall(immutable_map_class,
@@ -9623,11 +9602,11 @@
} else {
// Factory call at runtime.
const Class& factory_class =
- Class::Handle(LookupCoreClass(Symbols::Map()));
+ Class::Handle(Library::LookupCoreClass(Symbols::Map()));
ASSERT(!factory_class.IsNull());
const Function& factory_method = Function::ZoneHandle(
factory_class.LookupFactory(
- PrivateCoreLibName(Symbols::MapLiteralFactory())));
+ Library::PrivateCoreLibName(Symbols::MapLiteralFactory())));
ASSERT(!factory_method.IsNull());
if (!map_type_arguments.IsNull() &&
!map_type_arguments.IsInstantiated() &&
@@ -9904,7 +9883,7 @@
arguments->Add(new LiteralNode(
TokenPos(), String::ZoneHandle(type_class_name.raw())));
return MakeStaticCall(Symbols::AbstractClassInstantiationError(),
- PrivateCoreLibName(Symbols::ThrowNew()),
+ Library::PrivateCoreLibName(Symbols::ThrowNew()),
arguments);
}
String& error_message = String::Handle();
@@ -10003,11 +9982,12 @@
String& Parser::Interpolate(const GrowableArray<AstNode*>& values) {
- const Class& cls = Class::Handle(LookupCoreClass(Symbols::StringBase()));
+ const Class& cls = Class::Handle(
hausner 2013/10/14 23:11:14 Class::Handle( on next line?
srdjan 2013/10/14 23:19:42 Done.
+ Library::LookupCoreClass(Symbols::StringBase()));
ASSERT(!cls.IsNull());
const Function& func =
Function::Handle(cls.LookupStaticFunction(
- PrivateCoreLibName(Symbols::Interpolate())));
+ Library::PrivateCoreLibName(Symbols::Interpolate())));
ASSERT(!func.IsNull());
// Build the array of literal values to interpolate.
@@ -10104,9 +10084,10 @@
Type::ZoneHandle(Type::ArrayType()),
values_list);
interpolate_arg->Add(values);
- primary = MakeStaticCall(Symbols::StringBase(),
- PrivateCoreLibName(Symbols::Interpolate()),
- interpolate_arg);
+ primary =
+ MakeStaticCall(Symbols::StringBase(),
+ Library::PrivateCoreLibName(Symbols::Interpolate()),
+ interpolate_arg);
}
return primary;
}
« runtime/vm/object.cc ('K') | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698