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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
997 ReportMessageAt(class_name_location, "strict_eval_arguments"); | 997 ReportMessageAt(class_name_location, "strict_eval_arguments"); |
998 *ok = false; | 998 *ok = false; |
999 return EmptyExpression(); | 999 return EmptyExpression(); |
1000 } | 1000 } |
1001 | 1001 |
1002 PreParserScope scope = NewScope(scope_, BLOCK_SCOPE); | 1002 PreParserScope scope = NewScope(scope_, BLOCK_SCOPE); |
1003 BlockState block_state(&scope_, &scope); | 1003 BlockState block_state(&scope_, &scope); |
1004 scope_->SetStrictMode(STRICT); | 1004 scope_->SetStrictMode(STRICT); |
1005 scope_->SetScopeName(name); | 1005 scope_->SetScopeName(name); |
1006 | 1006 |
1007 if (Check(Token::EXTENDS)) { | 1007 bool has_extends = Check(Token::EXTENDS); |
1008 ParseLeftHandSideExpression(CHECK_OK); | 1008 if (has_extends) ParseLeftHandSideExpression(CHECK_OK); |
rossberg
2015/02/03 15:52:42
Actually, I just realised that you need to put bra
Dmitry Lomov (no reviews)
2015/02/03 15:59:13
Good catch, done.
| |
1009 } | |
1010 | 1009 |
1011 ClassLiteralChecker checker(this); | 1010 ClassLiteralChecker checker(this); |
1012 bool has_seen_constructor = false; | 1011 bool has_seen_constructor = false; |
1013 | 1012 |
1014 Expect(Token::LBRACE, CHECK_OK); | 1013 Expect(Token::LBRACE, CHECK_OK); |
1015 while (peek() != Token::RBRACE) { | 1014 while (peek() != Token::RBRACE) { |
1016 if (Check(Token::SEMICOLON)) continue; | 1015 if (Check(Token::SEMICOLON)) continue; |
1017 const bool in_class = true; | 1016 const bool in_class = true; |
1018 const bool is_static = false; | 1017 const bool is_static = false; |
1019 bool is_computed_name = false; // Classes do not care about computed | 1018 bool is_computed_name = false; // Classes do not care about computed |
1020 // property names here. | 1019 // property names here. |
1021 ParsePropertyDefinition(&checker, in_class, is_static, &is_computed_name, | 1020 ParsePropertyDefinition(&checker, in_class, has_extends, is_static, |
1022 &has_seen_constructor, CHECK_OK); | 1021 &is_computed_name, &has_seen_constructor, CHECK_OK); |
1023 } | 1022 } |
1024 | 1023 |
1025 Expect(Token::RBRACE, CHECK_OK); | 1024 Expect(Token::RBRACE, CHECK_OK); |
1026 | 1025 |
1027 return Expression::Default(); | 1026 return Expression::Default(); |
1028 } | 1027 } |
1029 | 1028 |
1030 | 1029 |
1031 PreParser::Expression PreParser::ParseV8Intrinsic(bool* ok) { | 1030 PreParser::Expression PreParser::ParseV8Intrinsic(bool* ok) { |
1032 // CallRuntime :: | 1031 // CallRuntime :: |
1033 // '%' Identifier Arguments | 1032 // '%' Identifier Arguments |
1034 Expect(Token::MOD, CHECK_OK); | 1033 Expect(Token::MOD, CHECK_OK); |
1035 if (!allow_natives()) { | 1034 if (!allow_natives()) { |
1036 *ok = false; | 1035 *ok = false; |
1037 return Expression::Default(); | 1036 return Expression::Default(); |
1038 } | 1037 } |
1039 // Allow "eval" or "arguments" for backward compatibility. | 1038 // Allow "eval" or "arguments" for backward compatibility. |
1040 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); | 1039 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); |
1041 ParseArguments(ok); | 1040 ParseArguments(ok); |
1042 | 1041 |
1043 return Expression::Default(); | 1042 return Expression::Default(); |
1044 } | 1043 } |
1045 | 1044 |
1046 #undef CHECK_OK | 1045 #undef CHECK_OK |
1047 | 1046 |
1048 | 1047 |
1049 } } // v8::internal | 1048 } } // v8::internal |
OLD | NEW |