Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: src/preparser.cc

Issue 867153003: new classes: special construct stub for derived classs and TDZ for `this`. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 ReportMessageAt(class_name_location, "strict_eval_arguments"); 972 ReportMessageAt(class_name_location, "strict_eval_arguments");
973 *ok = false; 973 *ok = false;
974 return EmptyExpression(); 974 return EmptyExpression();
975 } 975 }
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 bool has_extends = false;
982 if (Check(Token::EXTENDS)) { 983 if (Check(Token::EXTENDS)) {
983 ParseLeftHandSideExpression(CHECK_OK); 984 ParseLeftHandSideExpression(CHECK_OK);
985 has_extends = true;
984 } 986 }
985 987
986 bool has_seen_constructor = false; 988 bool has_seen_constructor = false;
987 989
988 Expect(Token::LBRACE, CHECK_OK); 990 Expect(Token::LBRACE, CHECK_OK);
989 while (peek() != Token::RBRACE) { 991 while (peek() != Token::RBRACE) {
990 if (Check(Token::SEMICOLON)) continue; 992 if (Check(Token::SEMICOLON)) continue;
991 const bool in_class = true; 993 const bool in_class = true;
992 const bool is_static = false; 994 const bool is_static = false;
993 bool is_computed_name = false; // Classes do not care about computed 995 bool is_computed_name = false; // Classes do not care about computed
994 // property names here. 996 // property names here.
995 ParsePropertyDefinition(NULL, in_class, is_static, &is_computed_name, 997 ParsePropertyDefinition(NULL, in_class, is_static, has_extends,
996 &has_seen_constructor, CHECK_OK); 998 &is_computed_name, &has_seen_constructor, CHECK_OK);
997 } 999 }
998 1000
999 Expect(Token::RBRACE, CHECK_OK); 1001 Expect(Token::RBRACE, CHECK_OK);
1000 1002
1001 return Expression::Default(); 1003 return Expression::Default();
1002 } 1004 }
1003 1005
1004 1006
1005 PreParser::Expression PreParser::ParseV8Intrinsic(bool* ok) { 1007 PreParser::Expression PreParser::ParseV8Intrinsic(bool* ok) {
1006 // CallRuntime :: 1008 // CallRuntime ::
1007 // '%' Identifier Arguments 1009 // '%' Identifier Arguments
1008 Expect(Token::MOD, CHECK_OK); 1010 Expect(Token::MOD, CHECK_OK);
1009 if (!allow_natives()) { 1011 if (!allow_natives()) {
1010 *ok = false; 1012 *ok = false;
1011 return Expression::Default(); 1013 return Expression::Default();
1012 } 1014 }
1013 // Allow "eval" or "arguments" for backward compatibility. 1015 // Allow "eval" or "arguments" for backward compatibility.
1014 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); 1016 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK);
1015 ParseArguments(ok); 1017 ParseArguments(ok);
1016 1018
1017 return Expression::Default(); 1019 return Expression::Default();
1018 } 1020 }
1019 1021
1020 #undef CHECK_OK 1022 #undef CHECK_OK
1021 1023
1022 1024
1023 } } // v8::internal 1025 } } // v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698