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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 Traits::ReportMessageAt(function_name_loc, "strong_undefined"); | 488 Traits::ReportMessageAt(function_name_loc, "strong_undefined"); |
489 *ok = false; | 489 *ok = false; |
490 return; | 490 return; |
491 } | 491 } |
492 } | 492 } |
493 | 493 |
494 // Checking the parameter names of a function literal. This has to be done | 494 // Checking the parameter names of a function literal. This has to be done |
495 // after parsing the function, since the function can declare itself strict. | 495 // after parsing the function, since the function can declare itself strict. |
496 void CheckFunctionParameterNames(LanguageMode language_mode, | 496 void CheckFunctionParameterNames(LanguageMode language_mode, |
497 bool strict_params, | 497 bool strict_params, |
498 const Scanner::Location& eval_args_error_loc, | 498 const Scanner::Location& eval_args_loc, |
499 const Scanner::Location& undefined_error_loc, | 499 const Scanner::Location& undefined_loc, |
500 const Scanner::Location& dupe_error_loc, | 500 const Scanner::Location& dupe_loc, |
501 const Scanner::Location& reserved_loc, | 501 const Scanner::Location& reserved_loc, |
502 bool* ok) { | 502 bool* ok) { |
503 if (is_sloppy(language_mode) && !strict_params) return; | 503 if (is_sloppy(language_mode) && !strict_params) return; |
504 | 504 if (is_strict(language_mode) && eval_args_loc.IsValid()) { |
505 if (is_strict(language_mode) && eval_args_error_loc.IsValid()) { | 505 Traits::ReportMessageAt(eval_args_loc, "strict_eval_arguments"); |
506 Traits::ReportMessageAt(eval_args_error_loc, "strict_eval_arguments"); | |
507 *ok = false; | 506 *ok = false; |
508 return; | 507 return; |
509 } | 508 } |
510 if (is_strong(language_mode) && undefined_error_loc.IsValid()) { | 509 if (is_strong(language_mode) && undefined_loc.IsValid()) { |
511 Traits::ReportMessageAt(eval_args_error_loc, "strong_undefined"); | 510 Traits::ReportMessageAt(undefined_loc, "strong_undefined"); |
512 *ok = false; | 511 *ok = false; |
513 return; | 512 return; |
514 } | 513 } |
515 // TODO(arv): When we add support for destructuring in setters we also need | 514 // TODO(arv): When we add support for destructuring in setters we also need |
516 // to check for duplicate names. | 515 // to check for duplicate names. |
517 if (dupe_error_loc.IsValid()) { | 516 if (dupe_loc.IsValid()) { |
518 Traits::ReportMessageAt(dupe_error_loc, "strict_param_dupe"); | 517 Traits::ReportMessageAt(dupe_loc, "strict_param_dupe"); |
519 *ok = false; | 518 *ok = false; |
520 return; | 519 return; |
521 } | 520 } |
522 if (reserved_loc.IsValid()) { | 521 if (reserved_loc.IsValid()) { |
523 Traits::ReportMessageAt(reserved_loc, "unexpected_strict_reserved"); | 522 Traits::ReportMessageAt(reserved_loc, "unexpected_strict_reserved"); |
524 *ok = false; | 523 *ok = false; |
525 return; | 524 return; |
526 } | 525 } |
527 } | 526 } |
528 | 527 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
750 bool IsStatic() const { return type_ == kStaticIdentifier; } | 749 bool IsStatic() const { return type_ == kStaticIdentifier; } |
751 bool IsYield() const { return type_ == kYieldIdentifier; } | 750 bool IsYield() const { return type_ == kYieldIdentifier; } |
752 bool IsPrototype() const { return type_ == kPrototypeIdentifier; } | 751 bool IsPrototype() const { return type_ == kPrototypeIdentifier; } |
753 bool IsConstructor() const { return type_ == kConstructorIdentifier; } | 752 bool IsConstructor() const { return type_ == kConstructorIdentifier; } |
754 bool IsFutureReserved() const { return type_ == kFutureReservedIdentifier; } | 753 bool IsFutureReserved() const { return type_ == kFutureReservedIdentifier; } |
755 bool IsFutureStrictReserved() const { | 754 bool IsFutureStrictReserved() const { |
756 return type_ == kFutureStrictReservedIdentifier || | 755 return type_ == kFutureStrictReservedIdentifier || |
757 type_ == kLetIdentifier || type_ == kStaticIdentifier || | 756 type_ == kLetIdentifier || type_ == kStaticIdentifier || |
758 type_ == kYieldIdentifier; | 757 type_ == kYieldIdentifier; |
759 } | 758 } |
760 V8_INLINE bool IsValidArrowParam() const { | |
761 // A valid identifier can be an arrow function parameter | |
762 // except for eval, arguments, yield, and reserved keywords. | |
763 return !(IsEval() || IsArguments() || IsFutureStrictReserved()); | |
764 } | |
765 | 759 |
766 // Allow identifier->name()[->length()] to work. The preparser | 760 // Allow identifier->name()[->length()] to work. The preparser |
767 // does not need the actual positions/lengths of the identifiers. | 761 // does not need the actual positions/lengths of the identifiers. |
768 const PreParserIdentifier* operator->() const { return this; } | 762 const PreParserIdentifier* operator->() const { return this; } |
769 const PreParserIdentifier raw_name() const { return *this; } | 763 const PreParserIdentifier raw_name() const { return *this; } |
770 | 764 |
771 int position() const { return 0; } | 765 int position() const { return 0; } |
772 int length() const { return 0; } | 766 int length() const { return 0; } |
773 | 767 |
774 private: | 768 private: |
775 enum Type { | 769 enum Type { |
776 kUnknownIdentifier, | 770 kUnknownIdentifier, |
777 kFutureReservedIdentifier, | 771 kFutureReservedIdentifier, |
778 kFutureStrictReservedIdentifier, | 772 kFutureStrictReservedIdentifier, |
779 kLetIdentifier, | 773 kLetIdentifier, |
780 kStaticIdentifier, | 774 kStaticIdentifier, |
781 kYieldIdentifier, | 775 kYieldIdentifier, |
782 kEvalIdentifier, | 776 kEvalIdentifier, |
783 kArgumentsIdentifier, | 777 kArgumentsIdentifier, |
784 kUndefinedIdentifier, | 778 kUndefinedIdentifier, |
785 kPrototypeIdentifier, | 779 kPrototypeIdentifier, |
786 kConstructorIdentifier | 780 kConstructorIdentifier |
787 }; | 781 }; |
782 | |
788 explicit PreParserIdentifier(Type type) : type_(type) {} | 783 explicit PreParserIdentifier(Type type) : type_(type) {} |
789 Type type_; | 784 Type type_; |
790 | 785 |
791 friend class PreParserExpression; | 786 friend class PreParserExpression; |
792 }; | 787 }; |
793 | 788 |
794 | 789 |
795 class PreParserExpression { | 790 class PreParserExpression { |
796 public: | 791 public: |
797 static PreParserExpression Default() { | 792 static PreParserExpression Default() { |
798 return PreParserExpression(TypeField::encode(kExpression)); | 793 return PreParserExpression(TypeField::encode(kExpression)); |
799 } | 794 } |
800 | 795 |
801 static PreParserExpression Spread(PreParserExpression expression) { | 796 static PreParserExpression Spread(PreParserExpression expression) { |
802 return PreParserExpression(TypeField::encode(kSpreadExpression)); | 797 return PreParserExpression(TypeField::encode(kSpreadExpression)); |
803 } | 798 } |
804 | 799 |
805 static PreParserExpression FromIdentifier(PreParserIdentifier id) { | 800 static PreParserExpression FromIdentifier(PreParserIdentifier id) { |
806 return PreParserExpression(TypeField::encode(kIdentifierExpression) | | 801 return PreParserExpression(TypeField::encode(kIdentifierExpression) | |
807 IdentifierTypeField::encode(id.type_)); | 802 IdentifierTypeField::encode(id.type_)); |
808 } | 803 } |
809 | 804 |
810 static PreParserExpression BinaryOperation(PreParserExpression left, | 805 static PreParserExpression BinaryOperation(PreParserExpression left, |
811 Token::Value op, | 806 Token::Value op, |
812 PreParserExpression right) { | 807 PreParserExpression right) { |
813 bool valid_arrow_param_list = | 808 ValidArrowParam valid_arrow_param_list = |
814 op == Token::COMMA && !left.is_parenthesized() && | 809 (op == Token::COMMA && !left.is_parenthesized() && |
815 !right.is_parenthesized() && left.IsValidArrowParams() && | 810 !right.is_parenthesized()) ? |
816 right.IsValidArrowParams(); | 811 std::min(left.ValidateArrowParams(), right.ValidateArrowParams()) |
812 : kInvalidArrowParam; | |
817 return PreParserExpression( | 813 return PreParserExpression( |
818 TypeField::encode(kBinaryOperationExpression) | | 814 TypeField::encode(kBinaryOperationExpression) | |
819 IsValidArrowParamListField::encode(valid_arrow_param_list)); | 815 IsValidArrowParamListField::encode(valid_arrow_param_list)); |
820 } | 816 } |
821 | 817 |
822 static PreParserExpression EmptyArrowParamList() { | 818 static PreParserExpression EmptyArrowParamList() { |
823 // Any expression for which IsValidArrowParamList() returns true | 819 // Any expression for which IsValidArrowParamList() returns true |
824 // will work here. | 820 // will work here. |
825 return FromIdentifier(PreParserIdentifier::Default()); | 821 return FromIdentifier(PreParserIdentifier::Default()); |
826 } | 822 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
908 | 904 |
909 bool IsCall() const { | 905 bool IsCall() const { |
910 return TypeField::decode(code_) == kExpression && | 906 return TypeField::decode(code_) == kExpression && |
911 ExpressionTypeField::decode(code_) == kCallExpression; | 907 ExpressionTypeField::decode(code_) == kCallExpression; |
912 } | 908 } |
913 | 909 |
914 bool IsValidReferenceExpression() const { | 910 bool IsValidReferenceExpression() const { |
915 return IsIdentifier() || IsProperty(); | 911 return IsIdentifier() || IsProperty(); |
916 } | 912 } |
917 | 913 |
918 bool IsValidArrowParamList() const { | 914 bool IsValidArrowParamList(Scanner::Location* undefined_loc) |
919 return IsValidArrowParams() && | 915 const { |
rossberg
2015/04/10 15:58:02
Nit: get rid of line break
conradw
2015/04/10 16:02:12
Done.
| |
920 ParenthesizationField::decode(code_) != | 916 ValidArrowParam valid = ValidateArrowParams(); |
921 kMultiParenthesizedExpression; | 917 if (ParenthesizationField::decode(code_) == kMultiParenthesizedExpression) { |
918 return false; | |
919 } | |
920 if (valid == kValidArrowParam) { | |
921 return true; | |
922 } else if (valid == kInvalidStrongArrowParam) { | |
923 // Return true for now regardless of strong mode for compatibility with | |
924 // parser. | |
925 *undefined_loc = Scanner::Location(); | |
926 return true; | |
927 } else { | |
928 return false; | |
929 } | |
922 } | 930 } |
923 | 931 |
924 // At the moment PreParser doesn't track these expression types. | 932 // At the moment PreParser doesn't track these expression types. |
925 bool IsFunctionLiteral() const { return false; } | 933 bool IsFunctionLiteral() const { return false; } |
926 bool IsCallNew() const { return false; } | 934 bool IsCallNew() const { return false; } |
927 | 935 |
928 bool IsNoTemplateTag() const { | 936 bool IsNoTemplateTag() const { |
929 return TypeField::decode(code_) == kExpression && | 937 return TypeField::decode(code_) == kExpression && |
930 ExpressionTypeField::decode(code_) == kNoTemplateTagExpression; | 938 ExpressionTypeField::decode(code_) == kNoTemplateTagExpression; |
931 } | 939 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
977 }; | 985 }; |
978 | 986 |
979 enum ExpressionType { | 987 enum ExpressionType { |
980 kThisExpression, | 988 kThisExpression, |
981 kThisPropertyExpression, | 989 kThisPropertyExpression, |
982 kPropertyExpression, | 990 kPropertyExpression, |
983 kCallExpression, | 991 kCallExpression, |
984 kNoTemplateTagExpression | 992 kNoTemplateTagExpression |
985 }; | 993 }; |
986 | 994 |
995 enum ValidArrowParam { | |
996 kInvalidArrowParam, | |
997 kInvalidStrongArrowParam, | |
998 kValidArrowParam | |
999 }; | |
1000 | |
987 explicit PreParserExpression(uint32_t expression_code) | 1001 explicit PreParserExpression(uint32_t expression_code) |
988 : code_(expression_code) {} | 1002 : code_(expression_code) {} |
989 | 1003 |
990 V8_INLINE bool IsValidArrowParams() const { | 1004 V8_INLINE ValidArrowParam ValidateArrowParams() const { |
991 return IsBinaryOperation() | 1005 if (IsBinaryOperation()) { |
992 ? IsValidArrowParamListField::decode(code_) | 1006 return IsValidArrowParamListField::decode(code_); |
993 : (IsIdentifier() && AsIdentifier().IsValidArrowParam()); | 1007 } |
1008 if (!IsIdentifier()) { | |
1009 return kInvalidArrowParam; | |
1010 } | |
1011 PreParserIdentifier ident = AsIdentifier(); | |
1012 // A valid identifier can be an arrow function parameter | |
1013 // except for eval, arguments, yield, and reserved keywords. | |
1014 if (ident.IsEval() || ident.IsArguments() || | |
1015 ident.IsFutureStrictReserved()) { | |
1016 return kInvalidArrowParam; | |
1017 } | |
1018 // In strong mode, 'undefined' is similarly restricted. | |
1019 if (ident.IsUndefined()) { | |
1020 return kInvalidStrongArrowParam; | |
1021 } | |
1022 return kValidArrowParam; | |
994 } | 1023 } |
995 | 1024 |
996 // The first five bits are for the Type and Parenthesization. | 1025 // The first five bits are for the Type and Parenthesization. |
997 typedef BitField<Type, 0, 3> TypeField; | 1026 typedef BitField<Type, 0, 3> TypeField; |
998 typedef BitField<Parenthesization, TypeField::kNext, 2> ParenthesizationField; | 1027 typedef BitField<Parenthesization, TypeField::kNext, 2> ParenthesizationField; |
999 | 1028 |
1000 // The rest of the bits are interpreted depending on the value | 1029 // The rest of the bits are interpreted depending on the value |
1001 // of the Type field, so they can share the storage. | 1030 // of the Type field, so they can share the storage. |
1002 typedef BitField<ExpressionType, ParenthesizationField::kNext, 3> | 1031 typedef BitField<ExpressionType, ParenthesizationField::kNext, 3> |
1003 ExpressionTypeField; | 1032 ExpressionTypeField; |
1004 typedef BitField<bool, ParenthesizationField::kNext, 1> IsUseStrictField; | 1033 typedef BitField<bool, ParenthesizationField::kNext, 1> IsUseStrictField; |
1005 typedef BitField<bool, IsUseStrictField::kNext, 1> IsUseStrongField; | 1034 typedef BitField<bool, IsUseStrictField::kNext, 1> IsUseStrongField; |
1006 typedef BitField<bool, ParenthesizationField::kNext, 1> | 1035 typedef BitField<ValidArrowParam, ParenthesizationField::kNext, 2> |
1007 IsValidArrowParamListField; | 1036 IsValidArrowParamListField; |
1008 typedef BitField<PreParserIdentifier::Type, ParenthesizationField::kNext, 10> | 1037 typedef BitField<PreParserIdentifier::Type, ParenthesizationField::kNext, 10> |
1009 IdentifierTypeField; | 1038 IdentifierTypeField; |
1010 | 1039 |
1011 uint32_t code_; | 1040 uint32_t code_; |
1012 }; | 1041 }; |
1013 | 1042 |
1014 | 1043 |
1015 // PreParserExpressionList doesn't actually store the expressions because | 1044 // PreParserExpressionList doesn't actually store the expressions because |
1016 // PreParser doesn't need to. | 1045 // PreParser doesn't need to. |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1484 } | 1513 } |
1485 | 1514 |
1486 V8_INLINE PreParserStatementList | 1515 V8_INLINE PreParserStatementList |
1487 ParseEagerFunctionBody(PreParserIdentifier function_name, int pos, | 1516 ParseEagerFunctionBody(PreParserIdentifier function_name, int pos, |
1488 Variable* fvar, Token::Value fvar_init_op, | 1517 Variable* fvar, Token::Value fvar_init_op, |
1489 FunctionKind kind, bool* ok); | 1518 FunctionKind kind, bool* ok); |
1490 | 1519 |
1491 // Utility functions | 1520 // Utility functions |
1492 int DeclareArrowParametersFromExpression(PreParserExpression expression, | 1521 int DeclareArrowParametersFromExpression(PreParserExpression expression, |
1493 Scope* scope, | 1522 Scope* scope, |
1523 Scanner::Location* undefined_loc, | |
1494 Scanner::Location* dupe_loc, | 1524 Scanner::Location* dupe_loc, |
1495 bool* ok) { | 1525 bool* ok) { |
1496 // TODO(aperez): Detect duplicated identifiers in paramlists. | 1526 // TODO(aperez): Detect duplicated identifiers in paramlists. |
1497 *ok = expression.IsValidArrowParamList(); | 1527 *ok = expression.IsValidArrowParamList(undefined_loc); |
1498 return 0; | 1528 return 0; |
1499 } | 1529 } |
1500 | 1530 |
1501 struct TemplateLiteralState {}; | 1531 struct TemplateLiteralState {}; |
1502 | 1532 |
1503 TemplateLiteralState OpenTemplateLiteral(int pos) { | 1533 TemplateLiteralState OpenTemplateLiteral(int pos) { |
1504 return TemplateLiteralState(); | 1534 return TemplateLiteralState(); |
1505 } | 1535 } |
1506 void AddTemplateSpan(TemplateLiteralState*, bool) {} | 1536 void AddTemplateSpan(TemplateLiteralState*, bool) {} |
1507 void AddTemplateExpression(TemplateLiteralState*, PreParserExpression) {} | 1537 void AddTemplateExpression(TemplateLiteralState*, PreParserExpression) {} |
(...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3015 int num_parameters = -1; | 3045 int num_parameters = -1; |
3016 int materialized_literal_count = -1; | 3046 int materialized_literal_count = -1; |
3017 int expected_property_count = -1; | 3047 int expected_property_count = -1; |
3018 int handler_count = 0; | 3048 int handler_count = 0; |
3019 Scanner::Location super_loc; | 3049 Scanner::Location super_loc; |
3020 | 3050 |
3021 { | 3051 { |
3022 typename Traits::Type::Factory function_factory(ast_value_factory()); | 3052 typename Traits::Type::Factory function_factory(ast_value_factory()); |
3023 FunctionState function_state(&function_state_, &scope_, scope, | 3053 FunctionState function_state(&function_state_, &scope_, scope, |
3024 kArrowFunction, &function_factory); | 3054 kArrowFunction, &function_factory); |
3025 Scanner::Location dupe_error_loc = Scanner::Location::invalid(); | 3055 Scanner::Location undefined_loc = Scanner::Location::invalid(); |
3026 // TODO(arv): Pass in eval_args_error_loc and reserved_loc here. | 3056 Scanner::Location dupe_loc = Scanner::Location::invalid(); |
3057 // TODO(arv): Pass in eval_args_loc and reserved_loc here. | |
3027 num_parameters = Traits::DeclareArrowParametersFromExpression( | 3058 num_parameters = Traits::DeclareArrowParametersFromExpression( |
3028 params_ast, scope_, &dupe_error_loc, ok); | 3059 params_ast, scope_, &undefined_loc, &dupe_loc, ok); |
3029 if (!*ok) { | 3060 if (!*ok) { |
3030 ReportMessageAt( | 3061 ReportMessageAt( |
3031 Scanner::Location(start_pos, scanner()->location().beg_pos), | 3062 Scanner::Location(start_pos, scanner()->location().beg_pos), |
3032 "malformed_arrow_function_parameter_list"); | 3063 "malformed_arrow_function_parameter_list"); |
3033 return this->EmptyExpression(); | 3064 return this->EmptyExpression(); |
3034 } | 3065 } |
3035 | 3066 |
3067 if (undefined_loc.IsValid()) { | |
3068 // Workaround for preparser not keeping track of positions. | |
3069 undefined_loc = Scanner::Location(start_pos, | |
3070 scanner()->location().end_pos); | |
3071 } | |
3036 if (num_parameters > Code::kMaxArguments) { | 3072 if (num_parameters > Code::kMaxArguments) { |
3037 ReportMessageAt(Scanner::Location(params_ast->position(), position()), | 3073 ReportMessageAt(Scanner::Location(params_ast->position(), position()), |
3038 "too_many_parameters"); | 3074 "too_many_parameters"); |
3039 *ok = false; | 3075 *ok = false; |
3040 return this->EmptyExpression(); | 3076 return this->EmptyExpression(); |
3041 } | 3077 } |
3042 | 3078 |
3043 Expect(Token::ARROW, CHECK_OK); | 3079 Expect(Token::ARROW, CHECK_OK); |
3044 | 3080 |
3045 if (peek() == Token::LBRACE) { | 3081 if (peek() == Token::LBRACE) { |
3046 // Multiple statemente body | 3082 // Multiple statement body |
3047 Consume(Token::LBRACE); | 3083 Consume(Token::LBRACE); |
3048 bool is_lazily_parsed = | 3084 bool is_lazily_parsed = |
3049 (mode() == PARSE_LAZILY && scope_->AllowsLazyCompilation()); | 3085 (mode() == PARSE_LAZILY && scope_->AllowsLazyCompilation()); |
3050 if (is_lazily_parsed) { | 3086 if (is_lazily_parsed) { |
3051 body = this->NewStatementList(0, zone()); | 3087 body = this->NewStatementList(0, zone()); |
3052 this->SkipLazyFunctionBody(this->EmptyIdentifier(), | 3088 this->SkipLazyFunctionBody(this->EmptyIdentifier(), |
3053 &materialized_literal_count, | 3089 &materialized_literal_count, |
3054 &expected_property_count, CHECK_OK); | 3090 &expected_property_count, CHECK_OK); |
3055 } else { | 3091 } else { |
3056 body = this->ParseEagerFunctionBody( | 3092 body = this->ParseEagerFunctionBody( |
(...skipping 14 matching lines...) Expand all Loading... | |
3071 materialized_literal_count = function_state.materialized_literal_count(); | 3107 materialized_literal_count = function_state.materialized_literal_count(); |
3072 expected_property_count = function_state.expected_property_count(); | 3108 expected_property_count = function_state.expected_property_count(); |
3073 handler_count = function_state.handler_count(); | 3109 handler_count = function_state.handler_count(); |
3074 } | 3110 } |
3075 super_loc = function_state.super_call_location(); | 3111 super_loc = function_state.super_call_location(); |
3076 | 3112 |
3077 scope->set_start_position(start_pos); | 3113 scope->set_start_position(start_pos); |
3078 scope->set_end_position(scanner()->location().end_pos); | 3114 scope->set_end_position(scanner()->location().end_pos); |
3079 | 3115 |
3080 // Arrow function *parameter lists* are always checked as in strict mode. | 3116 // Arrow function *parameter lists* are always checked as in strict mode. |
3081 // TODO(arv): eval_args_error_loc, undefined_error_loc, and reserved_loc | 3117 // TODO(arv): eval_args_loc and reserved_loc needs to be set by |
3082 // needs to be set by DeclareArrowParametersFromExpression. | 3118 // DeclareArrowParametersFromExpression. |
3083 Scanner::Location eval_args_error_loc = Scanner::Location::invalid(); | 3119 Scanner::Location eval_args_loc = Scanner::Location::invalid(); |
3084 Scanner::Location undefined_error_loc = Scanner::Location::invalid(); | |
3085 Scanner::Location reserved_loc = Scanner::Location::invalid(); | 3120 Scanner::Location reserved_loc = Scanner::Location::invalid(); |
3086 const bool use_strict_params = true; | 3121 const bool use_strict_params = true; |
3087 this->CheckFunctionParameterNames(language_mode(), use_strict_params, | 3122 this->CheckFunctionParameterNames(language_mode(), use_strict_params, |
3088 eval_args_error_loc, undefined_error_loc, | 3123 eval_args_loc, undefined_loc, dupe_loc, |
3089 dupe_error_loc, reserved_loc, CHECK_OK); | 3124 reserved_loc, CHECK_OK); |
3090 | 3125 |
3091 // Validate strict mode. | 3126 // Validate strict mode. |
3092 if (is_strict(language_mode())) { | 3127 if (is_strict(language_mode())) { |
3093 CheckStrictOctalLiteral(start_pos, scanner()->location().end_pos, | 3128 CheckStrictOctalLiteral(start_pos, scanner()->location().end_pos, |
3094 CHECK_OK); | 3129 CHECK_OK); |
3095 this->CheckConflictingVarDeclarations(scope, CHECK_OK); | 3130 this->CheckConflictingVarDeclarations(scope, CHECK_OK); |
3096 } | 3131 } |
3097 } | 3132 } |
3098 | 3133 |
3099 FunctionLiteralT function_literal = factory()->NewFunctionLiteral( | 3134 FunctionLiteralT function_literal = factory()->NewFunctionLiteral( |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3292 *ok = false; | 3327 *ok = false; |
3293 return; | 3328 return; |
3294 } | 3329 } |
3295 has_seen_constructor_ = true; | 3330 has_seen_constructor_ = true; |
3296 return; | 3331 return; |
3297 } | 3332 } |
3298 } | 3333 } |
3299 } } // v8::internal | 3334 } } // v8::internal |
3300 | 3335 |
3301 #endif // V8_PREPARSER_H | 3336 #endif // V8_PREPARSER_H |
OLD | NEW |