Commit b6a8f739 authored by marja@chromium.org's avatar marja@chromium.org

Misc cleanup (split from the "delay string / value internalization" CL).

- Missing includes / forward declaration
- Parser: Simplifying calling error reporting funcs.

R=ulan@chromium.org
BUG=

Review URL: https://codereview.chromium.org/307393002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21652 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 55443af6
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
template<typename T> class Vector;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// The list is a template for very light-weight lists. We are not // The list is a template for very light-weight lists. We are not
......
...@@ -2107,7 +2107,7 @@ Block* Parser::ParseVariableDeclarations( ...@@ -2107,7 +2107,7 @@ Block* Parser::ParseVariableDeclarations(
Declare(declaration, mode != VAR, CHECK_OK); Declare(declaration, mode != VAR, CHECK_OK);
nvars++; nvars++;
if (declaration_scope->num_var_or_const() > kMaxNumFunctionLocals) { if (declaration_scope->num_var_or_const() > kMaxNumFunctionLocals) {
ReportMessageAt(scanner()->location(), "too_many_variables"); ReportMessage("too_many_variables");
*ok = false; *ok = false;
return NULL; return NULL;
} }
...@@ -2405,7 +2405,7 @@ Statement* Parser::ParseContinueStatement(bool* ok) { ...@@ -2405,7 +2405,7 @@ Statement* Parser::ParseContinueStatement(bool* ok) {
if (!label.is_null()) { if (!label.is_null()) {
message = "unknown_label"; message = "unknown_label";
} }
ParserTraits::ReportMessageAt(scanner()->location(), message, label); ParserTraits::ReportMessage(message, label);
*ok = false; *ok = false;
return NULL; return NULL;
} }
...@@ -2441,7 +2441,7 @@ Statement* Parser::ParseBreakStatement(ZoneStringList* labels, bool* ok) { ...@@ -2441,7 +2441,7 @@ Statement* Parser::ParseBreakStatement(ZoneStringList* labels, bool* ok) {
if (!label.is_null()) { if (!label.is_null()) {
message = "unknown_label"; message = "unknown_label";
} }
ParserTraits::ReportMessageAt(scanner()->location(), message, label); ParserTraits::ReportMessage(message, label);
*ok = false; *ok = false;
return NULL; return NULL;
} }
...@@ -3389,7 +3389,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral( ...@@ -3389,7 +3389,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
scope_->DeclareParameter(param_name, VAR); scope_->DeclareParameter(param_name, VAR);
num_parameters++; num_parameters++;
if (num_parameters > Code::kMaxArguments) { if (num_parameters > Code::kMaxArguments) {
ReportMessageAt(scanner()->location(), "too_many_parameters"); ReportMessage("too_many_parameters");
*ok = false; *ok = false;
return NULL; return NULL;
} }
......
...@@ -1234,8 +1234,7 @@ void ParserBase<Traits>::ReportUnexpectedToken(Token::Value token) { ...@@ -1234,8 +1234,7 @@ void ParserBase<Traits>::ReportUnexpectedToken(Token::Value token) {
default: default:
const char* name = Token::String(token); const char* name = Token::String(token);
ASSERT(name != NULL); ASSERT(name != NULL);
Traits::ReportMessageAt( Traits::ReportMessageAt(source_location, "unexpected_token", name);
source_location, "unexpected_token", name);
} }
} }
...@@ -1249,7 +1248,7 @@ typename ParserBase<Traits>::IdentifierT ParserBase<Traits>::ParseIdentifier( ...@@ -1249,7 +1248,7 @@ typename ParserBase<Traits>::IdentifierT ParserBase<Traits>::ParseIdentifier(
IdentifierT name = this->GetSymbol(scanner()); IdentifierT name = this->GetSymbol(scanner());
if (allow_eval_or_arguments == kDontAllowEvalOrArguments && if (allow_eval_or_arguments == kDontAllowEvalOrArguments &&
strict_mode() == STRICT && this->IsEvalOrArguments(name)) { strict_mode() == STRICT && this->IsEvalOrArguments(name)) {
ReportMessageAt(scanner()->location(), "strict_eval_arguments"); ReportMessage("strict_eval_arguments");
*ok = false; *ok = false;
} }
return name; return name;
...@@ -1326,7 +1325,7 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseRegExpLiteral( ...@@ -1326,7 +1325,7 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseRegExpLiteral(
IdentifierT js_pattern = this->NextLiteralString(scanner(), TENURED); IdentifierT js_pattern = this->NextLiteralString(scanner(), TENURED);
if (!scanner()->ScanRegExpFlags()) { if (!scanner()->ScanRegExpFlags()) {
Next(); Next();
ReportMessageAt(scanner()->location(), "invalid_regexp_flags"); ReportMessage("invalid_regexp_flags");
*ok = false; *ok = false;
return Traits::EmptyExpression(); return Traits::EmptyExpression();
} }
...@@ -1669,7 +1668,7 @@ typename Traits::Type::ExpressionList ParserBase<Traits>::ParseArguments( ...@@ -1669,7 +1668,7 @@ typename Traits::Type::ExpressionList ParserBase<Traits>::ParseArguments(
true, CHECK_OK_CUSTOM(NullExpressionList)); true, CHECK_OK_CUSTOM(NullExpressionList));
result->Add(argument, zone_); result->Add(argument, zone_);
if (result->length() > Code::kMaxArguments) { if (result->length() > Code::kMaxArguments) {
ReportMessageAt(scanner()->location(), "too_many_arguments"); ReportMessage("too_many_arguments");
*ok = false; *ok = false;
return this->NullExpressionList(); return this->NullExpressionList();
} }
...@@ -2152,17 +2151,14 @@ void ParserBase<Traits>::ObjectLiteralChecker::CheckProperty( ...@@ -2152,17 +2151,14 @@ void ParserBase<Traits>::ObjectLiteralChecker::CheckProperty(
if (IsDataDataConflict(old_type, type)) { if (IsDataDataConflict(old_type, type)) {
// Both are data properties. // Both are data properties.
if (strict_mode_ == SLOPPY) return; if (strict_mode_ == SLOPPY) return;
parser()->ReportMessageAt(scanner()->location(), parser()->ReportMessage("strict_duplicate_property");
"strict_duplicate_property");
} else if (IsDataAccessorConflict(old_type, type)) { } else if (IsDataAccessorConflict(old_type, type)) {
// Both a data and an accessor property with the same name. // Both a data and an accessor property with the same name.
parser()->ReportMessageAt(scanner()->location(), parser()->ReportMessage("accessor_data_property");
"accessor_data_property");
} else { } else {
ASSERT(IsAccessorAccessorConflict(old_type, type)); ASSERT(IsAccessorAccessorConflict(old_type, type));
// Both accessors of the same type. // Both accessors of the same type.
parser()->ReportMessageAt(scanner()->location(), parser()->ReportMessage("accessor_get_set");
"accessor_get_set");
} }
*ok = false; *ok = false;
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "src/allocation.h" #include "src/allocation.h"
#include "src/checks.h" #include "src/checks.h"
#include "src/globals.h" #include "src/globals.h"
#include "src/list.h"
#include "src/platform.h" #include "src/platform.h"
#include "src/vector.h" #include "src/vector.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment