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

Side by Side Diff: src/preparser.cc

Issue 273653002: Parser / PreParser: Simplify error message arguments. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 7 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/preparser.h ('k') | test/cctest/test-parsing.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 6
7 #include "../include/v8stdint.h" 7 #include "../include/v8stdint.h"
8 8
9 #include "allocation.h" 9 #include "allocation.h"
10 #include "checks.h" 10 #include "checks.h"
(...skipping 17 matching lines...) Expand all
28 28
29 } // namespace std 29 } // namespace std
30 #endif 30 #endif
31 31
32 namespace v8 { 32 namespace v8 {
33 namespace internal { 33 namespace internal {
34 34
35 35
36 void PreParserTraits::ReportMessageAt(Scanner::Location location, 36 void PreParserTraits::ReportMessageAt(Scanner::Location location,
37 const char* message, 37 const char* message,
38 Vector<const char*> args, 38 const char* arg,
39 bool is_reference_error) { 39 bool is_reference_error) {
40 ReportMessageAt(location.beg_pos, 40 ReportMessageAt(location.beg_pos,
41 location.end_pos, 41 location.end_pos,
42 message, 42 message,
43 args.length() > 0 ? args[0] : NULL, 43 arg,
44 is_reference_error); 44 is_reference_error);
45 } 45 }
46 46
47 47
48 void PreParserTraits::ReportMessageAt(Scanner::Location location,
49 const char* type,
50 const char* name_opt,
51 bool is_reference_error) {
52 pre_parser_->log_->LogMessage(location.beg_pos, location.end_pos, type,
53 name_opt, is_reference_error);
54 }
55
56
57 void PreParserTraits::ReportMessageAt(int start_pos, 48 void PreParserTraits::ReportMessageAt(int start_pos,
58 int end_pos, 49 int end_pos,
59 const char* type, 50 const char* message,
60 const char* name_opt, 51 const char* arg,
61 bool is_reference_error) { 52 bool is_reference_error) {
62 pre_parser_->log_->LogMessage(start_pos, end_pos, type, name_opt, 53 pre_parser_->log_->LogMessage(start_pos, end_pos, message, arg,
63 is_reference_error); 54 is_reference_error);
64 } 55 }
65 56
66 57
67 PreParserIdentifier PreParserTraits::GetSymbol(Scanner* scanner) { 58 PreParserIdentifier PreParserTraits::GetSymbol(Scanner* scanner) {
68 if (scanner->current_token() == Token::FUTURE_RESERVED_WORD) { 59 if (scanner->current_token() == Token::FUTURE_RESERVED_WORD) {
69 return PreParserIdentifier::FutureReserved(); 60 return PreParserIdentifier::FutureReserved();
70 } else if (scanner->current_token() == 61 } else if (scanner->current_token() ==
71 Token::FUTURE_STRICT_RESERVED_WORD) { 62 Token::FUTURE_STRICT_RESERVED_WORD) {
72 return PreParserIdentifier::FutureStrictReserved(); 63 return PreParserIdentifier::FutureStrictReserved();
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 case Token::TRY: 278 case Token::TRY:
288 return ParseTryStatement(ok); 279 return ParseTryStatement(ok);
289 280
290 case Token::FUNCTION: { 281 case Token::FUNCTION: {
291 Scanner::Location start_location = scanner()->peek_location(); 282 Scanner::Location start_location = scanner()->peek_location();
292 Statement statement = ParseFunctionDeclaration(CHECK_OK); 283 Statement statement = ParseFunctionDeclaration(CHECK_OK);
293 Scanner::Location end_location = scanner()->location(); 284 Scanner::Location end_location = scanner()->location();
294 if (strict_mode() == STRICT) { 285 if (strict_mode() == STRICT) {
295 PreParserTraits::ReportMessageAt(start_location.beg_pos, 286 PreParserTraits::ReportMessageAt(start_location.beg_pos,
296 end_location.end_pos, 287 end_location.end_pos,
297 "strict_function", 288 "strict_function");
298 NULL);
299 *ok = false; 289 *ok = false;
300 return Statement::Default(); 290 return Statement::Default();
301 } else { 291 } else {
302 return statement; 292 return statement;
303 } 293 }
304 } 294 }
305 295
306 case Token::DEBUGGER: 296 case Token::DEBUGGER:
307 return ParseDebuggerStatement(ok); 297 return ParseDebuggerStatement(ok);
308 298
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); 922 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK);
933 ParseArguments(ok); 923 ParseArguments(ok);
934 924
935 return Expression::Default(); 925 return Expression::Default();
936 } 926 }
937 927
938 #undef CHECK_OK 928 #undef CHECK_OK
939 929
940 930
941 } } // v8::internal 931 } } // v8::internal
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698