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

Side by Side Diff: src/preparser.h

Issue 7207007: Proper handling of future reserved words in strict and normal mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 static Identifier Eval() { 87 static Identifier Eval() {
88 return Identifier(kEvalIdentifier); 88 return Identifier(kEvalIdentifier);
89 } 89 }
90 static Identifier Arguments() { 90 static Identifier Arguments() {
91 return Identifier(kArgumentsIdentifier); 91 return Identifier(kArgumentsIdentifier);
92 } 92 }
93 static Identifier FutureReserved() { 93 static Identifier FutureReserved() {
94 return Identifier(kFutureReservedIdentifier); 94 return Identifier(kFutureReservedIdentifier);
95 } 95 }
96 static Identifier FutureStrictReserved() {
97 return Identifier(kFutureStrictReservedIdentifier);
98 }
96 bool IsEval() { return type_ == kEvalIdentifier; } 99 bool IsEval() { return type_ == kEvalIdentifier; }
97 bool IsArguments() { return type_ == kArgumentsIdentifier; } 100 bool IsArguments() { return type_ == kArgumentsIdentifier; }
98 bool IsEvalOrArguments() { return type_ >= kEvalIdentifier; } 101 bool IsEvalOrArguments() { return type_ >= kEvalIdentifier; }
99 bool IsFutureReserved() { return type_ == kFutureReservedIdentifier; } 102 bool IsFutureReserved() { return type_ == kFutureReservedIdentifier; }
103 bool IsFutureStrictReserved() {
104 return type_ == kFutureStrictReservedIdentifier;
105 }
100 bool IsValidStrictVariable() { return type_ == kUnknownIdentifier; } 106 bool IsValidStrictVariable() { return type_ == kUnknownIdentifier; }
101 107
102 private: 108 private:
103 enum Type { 109 enum Type {
104 kUnknownIdentifier, 110 kUnknownIdentifier,
105 kFutureReservedIdentifier, 111 kFutureReservedIdentifier,
112 kFutureStrictReservedIdentifier,
106 kEvalIdentifier, 113 kEvalIdentifier,
107 kArgumentsIdentifier 114 kArgumentsIdentifier
108 }; 115 };
109 explicit Identifier(Type type) : type_(type) { } 116 explicit Identifier(Type type) : type_(type) { }
110 Type type_; 117 Type type_;
111 118
112 friend class Expression; 119 friend class Expression;
113 }; 120 };
114 121
115 // Bits 0 and 1 are used to identify the type of expression: 122 // Bits 0 and 1 are used to identify the type of expression:
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 Expression ParseArrayLiteral(bool* ok); 411 Expression ParseArrayLiteral(bool* ok);
405 Expression ParseObjectLiteral(bool* ok); 412 Expression ParseObjectLiteral(bool* ok);
406 Expression ParseRegExpLiteral(bool seen_equal, bool* ok); 413 Expression ParseRegExpLiteral(bool seen_equal, bool* ok);
407 Expression ParseV8Intrinsic(bool* ok); 414 Expression ParseV8Intrinsic(bool* ok);
408 415
409 Arguments ParseArguments(bool* ok); 416 Arguments ParseArguments(bool* ok);
410 Expression ParseFunctionLiteral(bool* ok); 417 Expression ParseFunctionLiteral(bool* ok);
411 418
412 Identifier ParseIdentifier(bool* ok); 419 Identifier ParseIdentifier(bool* ok);
413 Identifier ParseIdentifierName(bool* ok); 420 Identifier ParseIdentifierName(bool* ok);
414 Identifier ParseIdentifierOrGetOrSet(bool* is_get, bool* is_set, bool* ok); 421 Identifier ParseIdentifierNameOrGetOrSet(bool* is_get, bool* is_set, bool* ok) ;
415 422
416 // Logs the currently parsed literal as a symbol in the preparser data. 423 // Logs the currently parsed literal as a symbol in the preparser data.
417 void LogSymbol(); 424 void LogSymbol();
418 // Log the currently parsed identifier. 425 // Log the currently parsed identifier.
419 Identifier GetIdentifierSymbol(); 426 Identifier GetIdentifierSymbol();
420 // Log the currently parsed string literal. 427 // Log the currently parsed string literal.
421 Expression GetStringSymbol(); 428 Expression GetStringSymbol();
422 429
423 i::Token::Value peek() { 430 i::Token::Value peek() {
424 if (stack_overflow_) return i::Token::ILLEGAL; 431 if (stack_overflow_) return i::Token::ILLEGAL;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 uintptr_t stack_limit_; 491 uintptr_t stack_limit_;
485 i::Scanner::Location strict_mode_violation_location_; 492 i::Scanner::Location strict_mode_violation_location_;
486 const char* strict_mode_violation_type_; 493 const char* strict_mode_violation_type_;
487 bool stack_overflow_; 494 bool stack_overflow_;
488 bool allow_lazy_; 495 bool allow_lazy_;
489 bool parenthesized_function_; 496 bool parenthesized_function_;
490 }; 497 };
491 } } // v8::preparser 498 } } // v8::preparser
492 499
493 #endif // V8_PREPARSER_H 500 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698