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

Unified Diff: runtime/vm/parser.cc

Issue 18801005: Small cleanup in parser (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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/parser.h ('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 24796)
+++ runtime/vm/parser.cc (working copy)
@@ -1006,7 +1006,7 @@
// func.token_pos() points to the name of the field.
intptr_t ident_pos = func.token_pos();
ASSERT(current_class().raw() == func.Owner());
- params.AddReceiver(ReceiverType(ident_pos), ident_pos);
+ params.AddReceiver(ReceiverType(), ident_pos);
ASSERT(func.num_fixed_parameters() == 1); // receiver.
ASSERT(!func.HasOptionalParameters());
ASSERT(AbstractType::Handle(func.result_type()).IsResolved());
@@ -1050,7 +1050,7 @@
ParamList params;
ASSERT(current_class().raw() == func.Owner());
- params.AddReceiver(ReceiverType(ident_pos), ident_pos);
+ params.AddReceiver(ReceiverType(), ident_pos);
params.AddFinalParameter(ident_pos,
&Symbols::Value(),
&field_type);
@@ -1083,7 +1083,7 @@
const intptr_t ident_pos = func.token_pos();
ASSERT(func.token_pos() == 0);
ASSERT(current_class().raw() == func.Owner());
- params.AddReceiver(ReceiverType(ident_pos), ident_pos);
+ params.AddReceiver(ReceiverType(), ident_pos);
ASSERT(func.num_fixed_parameters() == 1); // Receiver.
ASSERT(!func.HasOptionalParameters());
@@ -1115,7 +1115,7 @@
intptr_t token_pos = func.token_pos();
ASSERT(func.token_pos() == 0);
ASSERT(current_class().raw() == func.Owner());
- params.AddReceiver(ReceiverType(token_pos), token_pos);
+ params.AddReceiver(ReceiverType(), token_pos);
ASSERT(func.num_fixed_parameters() == 1); // Receiver.
ASSERT(!func.HasOptionalParameters());
@@ -2220,7 +2220,7 @@
// Add implicit receiver parameter which is passed the allocated
// but uninitialized instance to construct.
ASSERT(current_class().raw() == func.Owner());
- params.AddReceiver(ReceiverType(TokenPos()), func.token_pos());
+ params.AddReceiver(ReceiverType(), func.token_pos());
// Add implicit parameter for construction phase.
params.AddFinalParameter(
@@ -2479,7 +2479,7 @@
} else if (!func.is_static()) {
// Static functions do not have a receiver.
ASSERT(current_class().raw() == func.Owner());
- params.AddReceiver(ReceiverType(TokenPos()), func.token_pos());
+ params.AddReceiver(ReceiverType(), func.token_pos());
} else if (func.IsFactory()) {
// The first parameter of a factory is the AbstractTypeArguments vector of
// the type of the instance to be allocated.
@@ -2696,8 +2696,7 @@
// The first parameter of a factory is the AbstractTypeArguments vector of
// the type of the instance to be allocated.
if (!method->has_static || method->IsConstructor()) {
- method->params.AddReceiver(ReceiverType(formal_param_pos),
- formal_param_pos);
+ method->params.AddReceiver(ReceiverType(), formal_param_pos);
} else if (method->IsFactory()) {
method->params.AddFinalParameter(
formal_param_pos,
@@ -3048,7 +3047,7 @@
field->name_pos);
ParamList params;
ASSERT(current_class().raw() == getter.Owner());
- params.AddReceiver(ReceiverType(TokenPos()), field->name_pos);
+ params.AddReceiver(ReceiverType(), field->name_pos);
getter.set_result_type(*field->type);
AddFormalParamsToFunction(&params, getter);
members->AddFunction(getter);
@@ -3064,7 +3063,7 @@
field->name_pos);
ParamList params;
ASSERT(current_class().raw() == setter.Owner());
- params.AddReceiver(ReceiverType(TokenPos()), field->name_pos);
+ params.AddReceiver(ReceiverType(), field->name_pos);
params.AddFinalParameter(TokenPos(),
&Symbols::Value(),
field->type);
@@ -8072,14 +8071,14 @@
}
-const Type* Parser::ReceiverType(intptr_t type_pos) const {
+const Type* Parser::ReceiverType() const {
ASSERT(!current_class().IsNull());
TypeArguments& type_arguments = TypeArguments::Handle();
if (current_class().NumTypeParameters() > 0) {
type_arguments = current_class().type_parameters();
}
Type& type = Type::ZoneHandle(
- Type::New(current_class(), type_arguments, type_pos));
+ Type::New(current_class(), type_arguments, current_class().token_pos()));
if (!is_top_level_ || current_class().is_type_finalized()) {
type ^= ClassFinalizer::FinalizeType(
current_class(), type, ClassFinalizer::kCanonicalizeWellFormed);
« no previous file with comments | « runtime/vm/parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698