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

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: CHECK_OK fixed Created 5 years, 10 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
« no previous file with comments | « src/preparser.h ('k') | src/runtime/runtime-classes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (has_extends) {
1008 ParseLeftHandSideExpression(CHECK_OK); 1009 ParseLeftHandSideExpression(CHECK_OK);
1009 } 1010 }
1010 1011
1011 ClassLiteralChecker checker(this); 1012 ClassLiteralChecker checker(this);
1012 bool has_seen_constructor = false; 1013 bool has_seen_constructor = false;
1013 1014
1014 Expect(Token::LBRACE, CHECK_OK); 1015 Expect(Token::LBRACE, CHECK_OK);
1015 while (peek() != Token::RBRACE) { 1016 while (peek() != Token::RBRACE) {
1016 if (Check(Token::SEMICOLON)) continue; 1017 if (Check(Token::SEMICOLON)) continue;
1017 const bool in_class = true; 1018 const bool in_class = true;
1018 const bool is_static = false; 1019 const bool is_static = false;
1019 bool is_computed_name = false; // Classes do not care about computed 1020 bool is_computed_name = false; // Classes do not care about computed
1020 // property names here. 1021 // property names here.
1021 ParsePropertyDefinition(&checker, in_class, is_static, &is_computed_name, 1022 ParsePropertyDefinition(&checker, in_class, has_extends, is_static,
1022 &has_seen_constructor, CHECK_OK); 1023 &is_computed_name, &has_seen_constructor, CHECK_OK);
1023 } 1024 }
1024 1025
1025 Expect(Token::RBRACE, CHECK_OK); 1026 Expect(Token::RBRACE, CHECK_OK);
1026 1027
1027 return Expression::Default(); 1028 return Expression::Default();
1028 } 1029 }
1029 1030
1030 1031
1031 PreParser::Expression PreParser::ParseV8Intrinsic(bool* ok) { 1032 PreParser::Expression PreParser::ParseV8Intrinsic(bool* ok) {
1032 // CallRuntime :: 1033 // CallRuntime ::
1033 // '%' Identifier Arguments 1034 // '%' Identifier Arguments
1034 Expect(Token::MOD, CHECK_OK); 1035 Expect(Token::MOD, CHECK_OK);
1035 if (!allow_natives()) { 1036 if (!allow_natives()) {
1036 *ok = false; 1037 *ok = false;
1037 return Expression::Default(); 1038 return Expression::Default();
1038 } 1039 }
1039 // Allow "eval" or "arguments" for backward compatibility. 1040 // Allow "eval" or "arguments" for backward compatibility.
1040 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); 1041 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK);
1041 ParseArguments(ok); 1042 ParseArguments(ok);
1042 1043
1043 return Expression::Default(); 1044 return Expression::Default();
1044 } 1045 }
1045 1046
1046 #undef CHECK_OK 1047 #undef CHECK_OK
1047 1048
1048 1049
1049 } } // v8::internal 1050 } } // v8::internal
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | src/runtime/runtime-classes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698