Reviewers: ulan,

Message:
ulan, ptal

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

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

[email protected]
BUG=

Please review this at https://codereview.chromium.org/307393002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+13, -15 lines):
  M src/list.h
  M src/parser.cc
  M src/preparser.h
  M src/utils.h


Index: src/list.h
diff --git a/src/list.h b/src/list.h
index 1029f493f1919ceb7e7d3894361a9a6bf4244db7..80daa31beee8b7c75b29647b6d22e155465d56ab 100644
--- a/src/list.h
+++ b/src/list.h
@@ -10,6 +10,7 @@
 namespace v8 {
 namespace internal {

+template<typename T> class Vector;

// ----------------------------------------------------------------------------
 // The list is a template for very light-weight lists. We are not
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 49e76618ca6fbea9b0787b3ced1ca9050eeb37e5..90f137253530d123fa80638b05740615c054301d 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -2107,7 +2107,7 @@ Block* Parser::ParseVariableDeclarations(
     Declare(declaration, mode != VAR, CHECK_OK);
     nvars++;
     if (declaration_scope->num_var_or_const() > kMaxNumFunctionLocals) {
-      ReportMessageAt(scanner()->location(), "too_many_variables");
+      ReportMessage("too_many_variables");
       *ok = false;
       return NULL;
     }
@@ -2405,7 +2405,7 @@ Statement* Parser::ParseContinueStatement(bool* ok) {
     if (!label.is_null()) {
       message = "unknown_label";
     }
-    ParserTraits::ReportMessageAt(scanner()->location(), message, label);
+    ParserTraits::ReportMessage(message, label);
     *ok = false;
     return NULL;
   }
@@ -2441,7 +2441,7 @@ Statement* Parser::ParseBreakStatement(ZoneStringList* labels, bool* ok) {
     if (!label.is_null()) {
       message = "unknown_label";
     }
-    ParserTraits::ReportMessageAt(scanner()->location(), message, label);
+    ParserTraits::ReportMessage(message, label);
     *ok = false;
     return NULL;
   }
@@ -3389,7 +3389,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
       scope_->DeclareParameter(param_name, VAR);
       num_parameters++;
       if (num_parameters > Code::kMaxArguments) {
-        ReportMessageAt(scanner()->location(), "too_many_parameters");
+        ReportMessage("too_many_parameters");
         *ok = false;
         return NULL;
       }
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 9dee863d591191a40de0a78d7d191347f9bc3966..89136123cd4dc099b4effa4306c94f5748043563 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -1234,8 +1234,7 @@ void ParserBase<Traits>::ReportUnexpectedToken(Token::Value token) {
     default:
       const char* name = Token::String(token);
       ASSERT(name != NULL);
-      Traits::ReportMessageAt(
-          source_location, "unexpected_token", name);
+      ReportMessageAt(source_location, "unexpected_token", name);
   }
 }

@@ -1249,7 +1248,7 @@ typename ParserBase<Traits>::IdentifierT ParserBase<Traits>::ParseIdentifier(
     IdentifierT name = this->GetSymbol(scanner());
     if (allow_eval_or_arguments == kDontAllowEvalOrArguments &&
         strict_mode() == STRICT && this->IsEvalOrArguments(name)) {
-      ReportMessageAt(scanner()->location(), "strict_eval_arguments");
+      ReportMessage("strict_eval_arguments");
       *ok = false;
     }
     return name;
@@ -1326,7 +1325,7 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseRegExpLiteral(
   IdentifierT js_pattern = this->NextLiteralString(scanner(), TENURED);
   if (!scanner()->ScanRegExpFlags()) {
     Next();
-    ReportMessageAt(scanner()->location(), "invalid_regexp_flags");
+    ReportMessage("invalid_regexp_flags");
     *ok = false;
     return Traits::EmptyExpression();
   }
@@ -1669,7 +1668,7 @@ typename Traits::Type::ExpressionList ParserBase<Traits>::ParseArguments(
         true, CHECK_OK_CUSTOM(NullExpressionList));
     result->Add(argument, zone_);
     if (result->length() > Code::kMaxArguments) {
-      ReportMessageAt(scanner()->location(), "too_many_arguments");
+      ReportMessage("too_many_arguments");
       *ok = false;
       return this->NullExpressionList();
     }
@@ -2152,17 +2151,14 @@ void ParserBase<Traits>::ObjectLiteralChecker::CheckProperty(
     if (IsDataDataConflict(old_type, type)) {
       // Both are data properties.
       if (strict_mode_ == SLOPPY) return;
-      parser()->ReportMessageAt(scanner()->location(),
-                               "strict_duplicate_property");
+      parser()->ReportMessage("strict_duplicate_property");
     } else if (IsDataAccessorConflict(old_type, type)) {
       // Both a data and an accessor property with the same name.
-      parser()->ReportMessageAt(scanner()->location(),
-                               "accessor_data_property");
+      parser()->ReportMessage("accessor_data_property");
     } else {
       ASSERT(IsAccessorAccessorConflict(old_type, type));
       // Both accessors of the same type.
-      parser()->ReportMessageAt(scanner()->location(),
-                               "accessor_get_set");
+      parser()->ReportMessage("accessor_get_set");
     }
     *ok = false;
   }
Index: src/utils.h
diff --git a/src/utils.h b/src/utils.h
index eeb098752198d4f1ef6333bf64464e90113f61d7..60e6b3cdcb7aa0a523f1a8af223a481609b1a2f8 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -12,6 +12,7 @@
 #include "allocation.h"
 #include "checks.h"
 #include "globals.h"
+#include "list.h"
 #include "platform.h"
 #include "vector.h"



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to