OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 if (this->IsEvalOrArguments(function_name)) { | 439 if (this->IsEvalOrArguments(function_name)) { |
440 Traits::ReportMessageAt(function_name_loc, "strict_eval_arguments"); | 440 Traits::ReportMessageAt(function_name_loc, "strict_eval_arguments"); |
441 *ok = false; | 441 *ok = false; |
442 return; | 442 return; |
443 } | 443 } |
444 if (function_name_is_strict_reserved) { | 444 if (function_name_is_strict_reserved) { |
445 Traits::ReportMessageAt(function_name_loc, "unexpected_strict_reserved"); | 445 Traits::ReportMessageAt(function_name_loc, "unexpected_strict_reserved"); |
446 *ok = false; | 446 *ok = false; |
447 return; | 447 return; |
448 } | 448 } |
| 449 CheckStrictFunctionParameters(eval_args_error_loc, dupe_error_loc, |
| 450 reserved_loc, ok); |
| 451 } |
| 452 |
| 453 // Validates strict mode for function parameter lists. This has to be |
| 454 // done after parsing the function, since the function can declare |
| 455 // itself strict. |
| 456 void CheckStrictFunctionParameters( |
| 457 const Scanner::Location& eval_args_error_loc, |
| 458 const Scanner::Location& dupe_error_loc, |
| 459 const Scanner::Location& reserved_loc, bool* ok) { |
449 if (eval_args_error_loc.IsValid()) { | 460 if (eval_args_error_loc.IsValid()) { |
450 Traits::ReportMessageAt(eval_args_error_loc, "strict_eval_arguments"); | 461 Traits::ReportMessageAt(eval_args_error_loc, "strict_eval_arguments"); |
451 *ok = false; | 462 *ok = false; |
452 return; | 463 return; |
453 } | 464 } |
454 if (dupe_error_loc.IsValid()) { | 465 if (dupe_error_loc.IsValid()) { |
455 Traits::ReportMessageAt(dupe_error_loc, "strict_param_dupe"); | 466 Traits::ReportMessageAt(dupe_error_loc, "strict_param_dupe"); |
456 *ok = false; | 467 *ok = false; |
457 return; | 468 return; |
458 } | 469 } |
(...skipping 2638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3097 *ok = false; | 3108 *ok = false; |
3098 return; | 3109 return; |
3099 } | 3110 } |
3100 has_seen_constructor_ = true; | 3111 has_seen_constructor_ = true; |
3101 return; | 3112 return; |
3102 } | 3113 } |
3103 } | 3114 } |
3104 } } // v8::internal | 3115 } } // v8::internal |
3105 | 3116 |
3106 #endif // V8_PREPARSER_H | 3117 #endif // V8_PREPARSER_H |
OLD | NEW |