| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 PreParserIdentifier PreParserTraits::GetNumberAsSymbol(Scanner* scanner) { | 74 PreParserIdentifier PreParserTraits::GetNumberAsSymbol(Scanner* scanner) { |
| 75 return PreParserIdentifier::Default(); | 75 return PreParserIdentifier::Default(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 | 78 |
| 79 PreParserExpression PreParserTraits::ExpressionFromString( | 79 PreParserExpression PreParserTraits::ExpressionFromString( |
| 80 int pos, Scanner* scanner, PreParserFactory* factory) { | 80 int pos, Scanner* scanner, PreParserFactory* factory) { |
| 81 if (scanner->UnescapedLiteralMatches("use strict", 10)) { | 81 if (scanner->UnescapedLiteralMatches("use strict", 10)) { |
| 82 return PreParserExpression::UseStrictStringLiteral(); | 82 return PreParserExpression::UseStrictStringLiteral(); |
| 83 } else if (scanner->UnescapedLiteralMatches("use sanity", 10)) { |
| 84 return PreParserExpression::UseSanityStringLiteral(); |
| 83 } | 85 } |
| 84 return PreParserExpression::StringLiteral(); | 86 return PreParserExpression::StringLiteral(); |
| 85 } | 87 } |
| 86 | 88 |
| 87 | 89 |
| 88 PreParserExpression PreParserTraits::ParseV8Intrinsic(bool* ok) { | 90 PreParserExpression PreParserTraits::ParseV8Intrinsic(bool* ok) { |
| 89 return pre_parser_->ParseV8Intrinsic(ok); | 91 return pre_parser_->ParseV8Intrinsic(ok); |
| 90 } | 92 } |
| 91 | 93 |
| 92 | 94 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 207 |
| 206 bool directive_prologue = true; | 208 bool directive_prologue = true; |
| 207 while (peek() != end_token) { | 209 while (peek() != end_token) { |
| 208 if (directive_prologue && peek() != Token::STRING) { | 210 if (directive_prologue && peek() != Token::STRING) { |
| 209 directive_prologue = false; | 211 directive_prologue = false; |
| 210 } | 212 } |
| 211 Statement statement = ParseSourceElement(CHECK_OK); | 213 Statement statement = ParseSourceElement(CHECK_OK); |
| 212 if (directive_prologue) { | 214 if (directive_prologue) { |
| 213 if (statement.IsUseStrictLiteral()) { | 215 if (statement.IsUseStrictLiteral()) { |
| 214 scope_->SetLanguageMode( | 216 scope_->SetLanguageMode( |
| 215 static_cast<LanguageMode>(scope_->language_mode() | STRICT)); | 217 static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); |
| 218 } else if (statement.IsUseSanityLiteral()) { |
| 219 scope_->SetLanguageMode(static_cast<LanguageMode>( |
| 220 scope_->language_mode() | STRICT_BIT | SANE_BIT)); |
| 216 } else if (!statement.IsStringLiteral()) { | 221 } else if (!statement.IsStringLiteral()) { |
| 217 directive_prologue = false; | 222 directive_prologue = false; |
| 218 } | 223 } |
| 219 } | 224 } |
| 220 } | 225 } |
| 221 return kUnknownSourceElements; | 226 return kUnknownSourceElements; |
| 222 } | 227 } |
| 223 | 228 |
| 224 | 229 |
| 225 #undef CHECK_OK | 230 #undef CHECK_OK |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 } | 1000 } |
| 996 if (IsEvalOrArguments(name)) { | 1001 if (IsEvalOrArguments(name)) { |
| 997 ReportMessageAt(class_name_location, "strict_eval_arguments"); | 1002 ReportMessageAt(class_name_location, "strict_eval_arguments"); |
| 998 *ok = false; | 1003 *ok = false; |
| 999 return EmptyExpression(); | 1004 return EmptyExpression(); |
| 1000 } | 1005 } |
| 1001 | 1006 |
| 1002 PreParserScope scope = NewScope(scope_, BLOCK_SCOPE); | 1007 PreParserScope scope = NewScope(scope_, BLOCK_SCOPE); |
| 1003 BlockState block_state(&scope_, &scope); | 1008 BlockState block_state(&scope_, &scope); |
| 1004 scope_->SetLanguageMode( | 1009 scope_->SetLanguageMode( |
| 1005 static_cast<LanguageMode>(scope_->language_mode() | STRICT)); | 1010 static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); |
| 1006 scope_->SetScopeName(name); | 1011 scope_->SetScopeName(name); |
| 1007 | 1012 |
| 1008 bool has_extends = Check(Token::EXTENDS); | 1013 bool has_extends = Check(Token::EXTENDS); |
| 1009 if (has_extends) { | 1014 if (has_extends) { |
| 1010 ParseLeftHandSideExpression(CHECK_OK); | 1015 ParseLeftHandSideExpression(CHECK_OK); |
| 1011 } | 1016 } |
| 1012 | 1017 |
| 1013 ClassLiteralChecker checker(this); | 1018 ClassLiteralChecker checker(this); |
| 1014 bool has_seen_constructor = false; | 1019 bool has_seen_constructor = false; |
| 1015 | 1020 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1042 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); | 1047 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); |
| 1043 ParseArguments(ok); | 1048 ParseArguments(ok); |
| 1044 | 1049 |
| 1045 return Expression::Default(); | 1050 return Expression::Default(); |
| 1046 } | 1051 } |
| 1047 | 1052 |
| 1048 #undef CHECK_OK | 1053 #undef CHECK_OK |
| 1049 | 1054 |
| 1050 | 1055 |
| 1051 } } // v8::internal | 1056 } } // v8::internal |
| OLD | NEW |