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

Side by Side Diff: src/preparser.cc

Issue 160073006: Implement handling of arrow functions in the parser (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased after latest changes in runtime.{h,cc} Created 6 years, 8 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
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 const char* type, 82 const char* type,
83 const char* name_opt, 83 const char* name_opt,
84 bool is_reference_error) { 84 bool is_reference_error) {
85 pre_parser_->log_->LogMessage(start_pos, end_pos, type, name_opt, 85 pre_parser_->log_->LogMessage(start_pos, end_pos, type, name_opt,
86 is_reference_error); 86 is_reference_error);
87 } 87 }
88 88
89 89
90 PreParserIdentifier PreParserTraits::GetSymbol(Scanner* scanner) { 90 PreParserIdentifier PreParserTraits::GetSymbol(Scanner* scanner) {
91 if (scanner->current_token() == Token::FUTURE_RESERVED_WORD) { 91 if (scanner->current_token() == Token::FUTURE_RESERVED_WORD) {
92 return PreParserIdentifier::FutureReserved(); 92 return PreParserIdentifier::FutureReserved(scanner->location().beg_pos);
93 } else if (scanner->current_token() == 93 } else if (scanner->current_token() ==
94 Token::FUTURE_STRICT_RESERVED_WORD) { 94 Token::FUTURE_STRICT_RESERVED_WORD) {
95 return PreParserIdentifier::FutureStrictReserved(); 95 return PreParserIdentifier::FutureStrictReserved(
96 scanner->location().beg_pos);
96 } else if (scanner->current_token() == Token::YIELD) { 97 } else if (scanner->current_token() == Token::YIELD) {
97 return PreParserIdentifier::Yield(); 98 return PreParserIdentifier::Yield(scanner->location().beg_pos);
98 } 99 }
99 if (scanner->UnescapedLiteralMatches("eval", 4)) { 100 if (scanner->UnescapedLiteralMatches("eval", 4)) {
100 return PreParserIdentifier::Eval(); 101 return PreParserIdentifier::Eval(scanner->location().beg_pos);
101 } 102 }
102 if (scanner->UnescapedLiteralMatches("arguments", 9)) { 103 if (scanner->UnescapedLiteralMatches("arguments", 9)) {
103 return PreParserIdentifier::Arguments(); 104 return PreParserIdentifier::Arguments(scanner->location().beg_pos);
104 } 105 }
105 return PreParserIdentifier::Default(); 106 return PreParserIdentifier::Default(scanner->location().beg_pos);
106 } 107 }
107 108
108 109
109 PreParserExpression PreParserTraits::ExpressionFromString( 110 PreParserExpression PreParserTraits::ExpressionFromString(
110 int pos, Scanner* scanner, PreParserFactory* factory) { 111 int pos, Scanner* scanner, PreParserFactory* factory) {
111 if (scanner->UnescapedLiteralMatches("use strict", 10)) { 112 if (scanner->UnescapedLiteralMatches("use strict", 10)) {
112 return PreParserExpression::UseStrictStringLiteral(); 113 return PreParserExpression::UseStrictStringLiteral();
113 } 114 }
114 return PreParserExpression::StringLiteral(); 115 return PreParserExpression::StringLiteral();
115 } 116 }
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); 956 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK);
956 ParseArguments(ok); 957 ParseArguments(ok);
957 958
958 return Expression::Default(); 959 return Expression::Default();
959 } 960 }
960 961
961 #undef CHECK_OK 962 #undef CHECK_OK
962 963
963 964
964 } } // v8::internal 965 } } // v8::internal
OLDNEW
« src/preparser.h ('K') | « src/preparser.h ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698