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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 | 976 |
977 PreParserScope scope = NewScope(scope_, BLOCK_SCOPE); | 977 PreParserScope scope = NewScope(scope_, BLOCK_SCOPE); |
978 BlockState block_state(&scope_, &scope); | 978 BlockState block_state(&scope_, &scope); |
979 scope_->SetStrictMode(STRICT); | 979 scope_->SetStrictMode(STRICT); |
980 scope_->SetScopeName(name); | 980 scope_->SetScopeName(name); |
981 | 981 |
982 if (Check(Token::EXTENDS)) { | 982 if (Check(Token::EXTENDS)) { |
983 ParseLeftHandSideExpression(CHECK_OK); | 983 ParseLeftHandSideExpression(CHECK_OK); |
984 } | 984 } |
985 | 985 |
| 986 ClassLiteralChecker checker(this); |
986 bool has_seen_constructor = false; | 987 bool has_seen_constructor = false; |
987 | 988 |
988 Expect(Token::LBRACE, CHECK_OK); | 989 Expect(Token::LBRACE, CHECK_OK); |
989 while (peek() != Token::RBRACE) { | 990 while (peek() != Token::RBRACE) { |
990 if (Check(Token::SEMICOLON)) continue; | 991 if (Check(Token::SEMICOLON)) continue; |
991 const bool in_class = true; | 992 const bool in_class = true; |
992 const bool is_static = false; | 993 const bool is_static = false; |
993 bool is_computed_name = false; // Classes do not care about computed | 994 bool is_computed_name = false; // Classes do not care about computed |
994 // property names here. | 995 // property names here. |
995 ParsePropertyDefinition(NULL, in_class, is_static, &is_computed_name, | 996 ParsePropertyDefinition(&checker, in_class, is_static, &is_computed_name, |
996 &has_seen_constructor, CHECK_OK); | 997 &has_seen_constructor, CHECK_OK); |
997 } | 998 } |
998 | 999 |
999 Expect(Token::RBRACE, CHECK_OK); | 1000 Expect(Token::RBRACE, CHECK_OK); |
1000 | 1001 |
1001 return Expression::Default(); | 1002 return Expression::Default(); |
1002 } | 1003 } |
1003 | 1004 |
1004 | 1005 |
1005 PreParser::Expression PreParser::ParseV8Intrinsic(bool* ok) { | 1006 PreParser::Expression PreParser::ParseV8Intrinsic(bool* ok) { |
1006 // CallRuntime :: | 1007 // CallRuntime :: |
1007 // '%' Identifier Arguments | 1008 // '%' Identifier Arguments |
1008 Expect(Token::MOD, CHECK_OK); | 1009 Expect(Token::MOD, CHECK_OK); |
1009 if (!allow_natives()) { | 1010 if (!allow_natives()) { |
1010 *ok = false; | 1011 *ok = false; |
1011 return Expression::Default(); | 1012 return Expression::Default(); |
1012 } | 1013 } |
1013 // Allow "eval" or "arguments" for backward compatibility. | 1014 // Allow "eval" or "arguments" for backward compatibility. |
1014 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); | 1015 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); |
1015 ParseArguments(ok); | 1016 ParseArguments(ok); |
1016 | 1017 |
1017 return Expression::Default(); | 1018 return Expression::Default(); |
1018 } | 1019 } |
1019 | 1020 |
1020 #undef CHECK_OK | 1021 #undef CHECK_OK |
1021 | 1022 |
1022 | 1023 |
1023 } } // v8::internal | 1024 } } // v8::internal |
OLD | NEW |