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

Revert "Traitify ParserBase and move functions there."

This reverts commit r19230.

Reason: Build failures on NaCl.

BUG=
TBR=marja@chromium.org,mstarzinger@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19234 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 44d61f3c
This diff is collapsed.
...@@ -404,44 +404,10 @@ class RegExpParser BASE_EMBEDDED { ...@@ -404,44 +404,10 @@ class RegExpParser BASE_EMBEDDED {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// JAVASCRIPT PARSING // JAVASCRIPT PARSING
class Parser; // Forward declaration.
class SingletonLogger; class SingletonLogger;
class ParserTraits { class Parser : public ParserBase {
public:
typedef Parser* ParserType;
// Return types for traversing functions.
typedef Handle<String> IdentifierType;
explicit ParserTraits(Parser* parser) : parser_(parser) {}
// Helper functions for recursive descent.
bool is_classic_mode() const;
bool is_generator() const;
bool IsEvalOrArguments(Handle<String> identifier) const;
// Reporting errors.
void ReportMessageAt(Scanner::Location source_location,
const char* message,
Vector<const char*> args);
void ReportMessage(const char* message, Vector<Handle<String> > args);
void ReportMessageAt(Scanner::Location source_location,
const char* message,
Vector<Handle<String> > args);
// Identifiers:
static IdentifierType EmptyIdentifier() {
return Handle<String>();
}
IdentifierType GetSymbol();
private:
Parser* parser_;
};
class Parser : public ParserBase<ParserTraits> {
public: public:
explicit Parser(CompilationInfo* info); explicit Parser(CompilationInfo* info);
~Parser() { ~Parser() {
...@@ -461,8 +427,6 @@ class Parser : public ParserBase<ParserTraits> { ...@@ -461,8 +427,6 @@ class Parser : public ParserBase<ParserTraits> {
bool Parse(); bool Parse();
private: private:
friend class ParserTraits;
static const int kMaxNumFunctionLocals = 131071; // 2^17-1 static const int kMaxNumFunctionLocals = 131071; // 2^17-1
enum Mode { enum Mode {
...@@ -557,6 +521,10 @@ class Parser : public ParserBase<ParserTraits> { ...@@ -557,6 +521,10 @@ class Parser : public ParserBase<ParserTraits> {
Mode old_mode_; Mode old_mode_;
}; };
virtual bool is_classic_mode() {
return top_scope_->is_classic_mode();
}
// Returns NULL if parsing failed. // Returns NULL if parsing failed.
FunctionLiteral* ParseProgram(); FunctionLiteral* ParseProgram();
...@@ -573,6 +541,17 @@ class Parser : public ParserBase<ParserTraits> { ...@@ -573,6 +541,17 @@ class Parser : public ParserBase<ParserTraits> {
// Report syntax error // Report syntax error
void ReportInvalidPreparseData(Handle<String> name, bool* ok); void ReportInvalidPreparseData(Handle<String> name, bool* ok);
void ReportMessage(const char* message, Vector<const char*> args);
void ReportMessage(const char* message, Vector<Handle<String> > args);
void ReportMessageAt(Scanner::Location location, const char* type) {
ReportMessageAt(location, type, Vector<const char*>::empty());
}
void ReportMessageAt(Scanner::Location loc,
const char* message,
Vector<const char*> args);
void ReportMessageAt(Scanner::Location loc,
const char* message,
Vector<Handle<String> > args);
void set_pre_parse_data(ScriptDataImpl *data) { void set_pre_parse_data(ScriptDataImpl *data) {
pre_parse_data_ = data; pre_parse_data_ = data;
...@@ -592,6 +571,9 @@ class Parser : public ParserBase<ParserTraits> { ...@@ -592,6 +571,9 @@ class Parser : public ParserBase<ParserTraits> {
? top_scope_ : top_scope_->DeclarationScope(); ? top_scope_ : top_scope_->DeclarationScope();
} }
// Check if the given string is 'eval' or 'arguments'.
bool IsEvalOrArguments(Handle<String> string);
// All ParseXXX functions take as the last argument an *ok parameter // All ParseXXX functions take as the last argument an *ok parameter
// which is set to false if parsing failed; it is unchanged otherwise. // which is set to false if parsing failed; it is unchanged otherwise.
// By making the 'exception handling' explicit, we are forced to check // By making the 'exception handling' explicit, we are forced to check
...@@ -678,6 +660,8 @@ class Parser : public ParserBase<ParserTraits> { ...@@ -678,6 +660,8 @@ class Parser : public ParserBase<ParserTraits> {
// Magical syntax support. // Magical syntax support.
Expression* ParseV8Intrinsic(bool* ok); Expression* ParseV8Intrinsic(bool* ok);
bool is_generator() const { return current_function_state_->is_generator(); }
bool CheckInOrOf(bool accept_OF, ForEachStatement::VisitMode* visit_mode); bool CheckInOrOf(bool accept_OF, ForEachStatement::VisitMode* visit_mode);
Handle<String> LiteralString(PretenureFlag tenured) { Handle<String> LiteralString(PretenureFlag tenured) {
...@@ -700,10 +684,20 @@ class Parser : public ParserBase<ParserTraits> { ...@@ -700,10 +684,20 @@ class Parser : public ParserBase<ParserTraits> {
} }
} }
Handle<String> GetSymbol();
// Get odd-ball literals. // Get odd-ball literals.
Literal* GetLiteralUndefined(int position); Literal* GetLiteralUndefined(int position);
Literal* GetLiteralTheHole(int position); Literal* GetLiteralTheHole(int position);
Handle<String> ParseIdentifier(AllowEvalOrArgumentsAsIdentifier, bool* ok);
Handle<String> ParseIdentifierOrStrictReservedWord(
bool* is_strict_reserved, bool* ok);
Handle<String> ParseIdentifierName(bool* ok);
Handle<String> ParseIdentifierNameOrGetOrSet(bool* is_get,
bool* is_set,
bool* ok);
// Determine if the expression is a variable proxy and mark it as being used // Determine if the expression is a variable proxy and mark it as being used
// in an assignment or with a increment/decrement operator. This is currently // in an assignment or with a increment/decrement operator. This is currently
// used on for the statically checking assignments to harmony const bindings. // used on for the statically checking assignments to harmony const bindings.
......
This diff is collapsed.
This diff is collapsed.
...@@ -1108,9 +1108,8 @@ enum ParserSyncTestResult { ...@@ -1108,9 +1108,8 @@ enum ParserSyncTestResult {
kError kError
}; };
template <typename Traits>
void SetParserFlags(i::ParserBase<Traits>* parser, void SetParserFlags(i::ParserBase* parser, i::EnumSet<ParserFlag> flags) {
i::EnumSet<ParserFlag> flags) {
parser->set_allow_lazy(flags.Contains(kAllowLazy)); parser->set_allow_lazy(flags.Contains(kAllowLazy));
parser->set_allow_natives_syntax(flags.Contains(kAllowNativesSyntax)); parser->set_allow_natives_syntax(flags.Contains(kAllowNativesSyntax));
parser->set_allow_harmony_scoping(flags.Contains(kAllowHarmonyScoping)); parser->set_allow_harmony_scoping(flags.Contains(kAllowHarmonyScoping));
......
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