OLD | NEW |
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 "src/allocation.h" | 7 #include "src/allocation.h" |
8 #include "src/base/logging.h" | 8 #include "src/base/logging.h" |
9 #include "src/conversions-inl.h" | 9 #include "src/conversions-inl.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 ValidateExpression(CHECK_OK); | 847 ValidateExpression(CHECK_OK); |
848 impl()->AccumulateFormalParameterContainmentErrors(); | 848 impl()->AccumulateFormalParameterContainmentErrors(); |
849 } | 849 } |
850 | 850 |
851 ClassLiteralChecker checker(this); | 851 ClassLiteralChecker checker(this); |
852 bool has_seen_constructor = false; | 852 bool has_seen_constructor = false; |
853 | 853 |
854 Expect(Token::LBRACE, CHECK_OK); | 854 Expect(Token::LBRACE, CHECK_OK); |
855 while (peek() != Token::RBRACE) { | 855 while (peek() != Token::RBRACE) { |
856 if (Check(Token::SEMICOLON)) continue; | 856 if (Check(Token::SEMICOLON)) continue; |
| 857 IdentifierT private_name; |
857 bool is_computed_name = false; // Classes do not care about computed | 858 bool is_computed_name = false; // Classes do not care about computed |
858 // property names here. | 859 // property names here. |
859 ExpressionClassifier property_classifier(this); | 860 ExpressionClassifier property_classifier(this); |
860 ParseClassPropertyDefinition(&checker, has_extends, &is_computed_name, | 861 ParseClassPropertyDefinition(&checker, has_extends, &private_name, |
861 &has_seen_constructor, CHECK_OK); | 862 &is_computed_name, &has_seen_constructor, |
| 863 CHECK_OK); |
862 ValidateExpression(CHECK_OK); | 864 ValidateExpression(CHECK_OK); |
863 impl()->AccumulateFormalParameterContainmentErrors(); | 865 impl()->AccumulateFormalParameterContainmentErrors(); |
864 } | 866 } |
865 | 867 |
866 Expect(Token::RBRACE, CHECK_OK); | 868 Expect(Token::RBRACE, CHECK_OK); |
867 | 869 |
868 return Expression::Default(); | 870 return Expression::Default(); |
869 } | 871 } |
870 | 872 |
871 | 873 |
(...skipping 23 matching lines...) Expand all Loading... |
895 // do '{' StatementList '}' | 897 // do '{' StatementList '}' |
896 Expect(Token::DO, CHECK_OK); | 898 Expect(Token::DO, CHECK_OK); |
897 Expect(Token::LBRACE, CHECK_OK); | 899 Expect(Token::LBRACE, CHECK_OK); |
898 while (peek() != Token::RBRACE) { | 900 while (peek() != Token::RBRACE) { |
899 ParseStatementListItem(CHECK_OK); | 901 ParseStatementListItem(CHECK_OK); |
900 } | 902 } |
901 Expect(Token::RBRACE, CHECK_OK); | 903 Expect(Token::RBRACE, CHECK_OK); |
902 return PreParserExpression::Default(); | 904 return PreParserExpression::Default(); |
903 } | 905 } |
904 | 906 |
| 907 PreParserExpression PreParser::ParsePrivateFieldReference( |
| 908 PreParserExpression base, bool* ok) { |
| 909 // PrimaryExpression :: |
| 910 // PrivateName |
| 911 Expect(Token::HASH, CHECK_OK); |
| 912 ParseIdentifierName(CHECK_OK); |
| 913 return PreParserExpression::Property(); |
| 914 } |
| 915 |
905 void PreParser::ParseAsyncArrowSingleExpressionBody(PreParserStatementList body, | 916 void PreParser::ParseAsyncArrowSingleExpressionBody(PreParserStatementList body, |
906 bool accept_IN, int pos, | 917 bool accept_IN, int pos, |
907 bool* ok) { | 918 bool* ok) { |
908 scope()->ForceContextAllocation(); | 919 scope()->ForceContextAllocation(); |
909 | 920 |
910 PreParserExpression return_value = | 921 PreParserExpression return_value = |
911 ParseAssignmentExpression(accept_IN, CHECK_OK_VOID); | 922 ParseAssignmentExpression(accept_IN, CHECK_OK_VOID); |
912 | 923 |
913 body->Add(PreParserStatement::ExpressionStatement(return_value), zone()); | 924 body->Add(PreParserStatement::ExpressionStatement(return_value), zone()); |
914 } | 925 } |
915 | 926 |
916 #undef CHECK_OK | 927 #undef CHECK_OK |
917 #undef CHECK_OK_CUSTOM | 928 #undef CHECK_OK_CUSTOM |
918 | 929 |
919 | 930 |
920 } // namespace internal | 931 } // namespace internal |
921 } // namespace v8 | 932 } // namespace v8 |
OLD | NEW |