OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/typing-asm.h" | 7 #include "src/typing-asm.h" |
8 | 8 |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 RECURSE( | 120 RECURSE( |
121 VisitWithExpectation(decl->fun(), Type::Any(zone()), "UNREACHABLE")); | 121 VisitWithExpectation(decl->fun(), Type::Any(zone()), "UNREACHABLE")); |
122 if (!computed_type_->IsFunction()) { | 122 if (!computed_type_->IsFunction()) { |
123 FAIL(decl->fun(), "function literal expected to be a function"); | 123 FAIL(decl->fun(), "function literal expected to be a function"); |
124 } | 124 } |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 // Validate exports. | 128 // Validate exports. |
129 ReturnStatement* stmt = fun->body()->last()->AsReturnStatement(); | 129 ReturnStatement* stmt = fun->body()->last()->AsReturnStatement(); |
| 130 if (stmt == nullptr) { |
| 131 FAIL(fun->body()->last(), "last statement in module is not a return"); |
| 132 } |
130 RECURSE(VisitWithExpectation(stmt->expression(), Type::Object(), | 133 RECURSE(VisitWithExpectation(stmt->expression(), Type::Object(), |
131 "expected object export")); | 134 "expected object export")); |
132 } | 135 } |
133 | 136 |
134 | 137 |
135 void AsmTyper::VisitVariableDeclaration(VariableDeclaration* decl) { | 138 void AsmTyper::VisitVariableDeclaration(VariableDeclaration* decl) { |
136 Variable* var = decl->proxy()->var(); | 139 Variable* var = decl->proxy()->var(); |
137 if (var->location() != VariableLocation::PARAMETER) { | 140 if (var->location() != VariableLocation::PARAMETER) { |
138 if (GetType(var) == NULL) { | 141 if (GetType(var) == NULL) { |
139 SetType(var, Type::Any(zone())); | 142 SetType(var, Type::Any(zone())); |
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 | 1452 |
1450 | 1453 |
1451 void AsmTyper::VisitRewritableAssignmentExpression( | 1454 void AsmTyper::VisitRewritableAssignmentExpression( |
1452 RewritableAssignmentExpression* expr) { | 1455 RewritableAssignmentExpression* expr) { |
1453 RECURSE(Visit(expr->expression())); | 1456 RECURSE(Visit(expr->expression())); |
1454 } | 1457 } |
1455 | 1458 |
1456 | 1459 |
1457 } // namespace internal | 1460 } // namespace internal |
1458 } // namespace v8 | 1461 } // namespace v8 |
OLD | NEW |