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 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 CheckArityRestrictions(formals.arity, kind, formals.has_rest, start_position, | 1052 CheckArityRestrictions(formals.arity, kind, formals.has_rest, start_position, |
1053 formals_end_position, CHECK_OK); | 1053 formals_end_position, CHECK_OK); |
1054 | 1054 |
1055 // See Parser::ParseFunctionLiteral for more information about lazy parsing | 1055 // See Parser::ParseFunctionLiteral for more information about lazy parsing |
1056 // and lazy compilation. | 1056 // and lazy compilation. |
1057 bool is_lazily_parsed = | 1057 bool is_lazily_parsed = |
1058 (outer_is_script_scope && allow_lazy() && !parenthesized_function_); | 1058 (outer_is_script_scope && allow_lazy() && !parenthesized_function_); |
1059 parenthesized_function_ = false; | 1059 parenthesized_function_ = false; |
1060 | 1060 |
1061 // Parse optional type annotation. | 1061 // Parse optional type annotation. |
1062 if (scope_->typed() && Check(Token::COLON)) { // Braces required here. | 1062 if (scope_->typed() && |
| 1063 !(type_flags & typesystem::kDisallowTypeAnnotation) && |
| 1064 Check(Token::COLON)) { // Braces required here. |
1063 ParseValidType(CHECK_OK); | 1065 ParseValidType(CHECK_OK); |
1064 } | 1066 } |
1065 | 1067 |
1066 // Allow for a function signature (i.e., a literal without body). | 1068 // Allow for a function signature (i.e., a literal without body). |
1067 if (peek() != Token::LBRACE && scope_->typed() && | 1069 if (peek() != Token::LBRACE && scope_->typed() && |
1068 (type_flags & typesystem::kAllowSignature)) { | 1070 (type_flags & typesystem::kAllowSignature)) { |
1069 ExpectSemicolon(CHECK_OK); | 1071 ExpectSemicolon(CHECK_OK); |
1070 return this->EmptyExpression(); | 1072 return this->EmptyExpression(); |
1071 } | 1073 } |
1072 | 1074 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 Expect(Token::RBRACE, CHECK_OK); | 1221 Expect(Token::RBRACE, CHECK_OK); |
1220 return PreParserExpression::Default(); | 1222 return PreParserExpression::Default(); |
1221 } | 1223 } |
1222 } | 1224 } |
1223 | 1225 |
1224 #undef CHECK_OK | 1226 #undef CHECK_OK |
1225 | 1227 |
1226 | 1228 |
1227 } // namespace internal | 1229 } // namespace internal |
1228 } // namespace v8 | 1230 } // namespace v8 |
OLD | NEW |