OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "api.h" | 7 #include "api.h" |
8 #include "ast.h" | 8 #include "ast.h" |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "char-predicates-inl.h" | 10 #include "char-predicates-inl.h" |
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 } | 1267 } |
1268 | 1268 |
1269 Expect(Token::RBRACE, CHECK_OK); | 1269 Expect(Token::RBRACE, CHECK_OK); |
1270 scope->set_end_position(scanner()->location().end_pos); | 1270 scope->set_end_position(scanner()->location().end_pos); |
1271 body->set_scope(scope); | 1271 body->set_scope(scope); |
1272 | 1272 |
1273 // Check that all exports are bound. | 1273 // Check that all exports are bound. |
1274 Interface* interface = scope->interface(); | 1274 Interface* interface = scope->interface(); |
1275 for (Interface::Iterator it = interface->iterator(); | 1275 for (Interface::Iterator it = interface->iterator(); |
1276 !it.done(); it.Advance()) { | 1276 !it.done(); it.Advance()) { |
1277 if (scope->LocalLookup(it.name()) == NULL) { | 1277 if (scope->LookupLocal(it.name()) == NULL) { |
1278 ParserTraits::ReportMessage("module_export_undefined", it.name()); | 1278 ParserTraits::ReportMessage("module_export_undefined", it.name()); |
1279 *ok = false; | 1279 *ok = false; |
1280 return NULL; | 1280 return NULL; |
1281 } | 1281 } |
1282 } | 1282 } |
1283 | 1283 |
1284 interface->MakeModule(ok); | 1284 interface->MakeModule(ok); |
1285 ASSERT(*ok); | 1285 ASSERT(*ok); |
1286 interface->Freeze(ok); | 1286 interface->Freeze(ok); |
1287 ASSERT(*ok); | 1287 ASSERT(*ok); |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 declaration_scope->is_strict_eval_scope() || | 1679 declaration_scope->is_strict_eval_scope() || |
1680 declaration_scope->is_block_scope() || | 1680 declaration_scope->is_block_scope() || |
1681 declaration_scope->is_module_scope() || | 1681 declaration_scope->is_module_scope() || |
1682 declaration_scope->is_global_scope()) { | 1682 declaration_scope->is_global_scope()) { |
1683 // Declare the variable in the declaration scope. | 1683 // Declare the variable in the declaration scope. |
1684 // For the global scope, we have to check for collisions with earlier | 1684 // For the global scope, we have to check for collisions with earlier |
1685 // (i.e., enclosing) global scopes, to maintain the illusion of a single | 1685 // (i.e., enclosing) global scopes, to maintain the illusion of a single |
1686 // global scope. | 1686 // global scope. |
1687 var = declaration_scope->is_global_scope() | 1687 var = declaration_scope->is_global_scope() |
1688 ? declaration_scope->Lookup(name) | 1688 ? declaration_scope->Lookup(name) |
1689 : declaration_scope->LocalLookup(name); | 1689 : declaration_scope->LookupLocal(name); |
1690 if (var == NULL) { | 1690 if (var == NULL) { |
1691 // Declare the name. | 1691 // Declare the name. |
1692 var = declaration_scope->DeclareLocal( | 1692 var = declaration_scope->DeclareLocal( |
1693 name, mode, declaration->initialization(), proxy->interface()); | 1693 name, mode, declaration->initialization(), proxy->interface()); |
1694 } else if ((mode != VAR || var->mode() != VAR) && | 1694 } else if ((mode != VAR || var->mode() != VAR) && |
1695 (!declaration_scope->is_global_scope() || | 1695 (!declaration_scope->is_global_scope() || |
1696 IsLexicalVariableMode(mode) || | 1696 IsLexicalVariableMode(mode) || |
1697 IsLexicalVariableMode(var->mode()))) { | 1697 IsLexicalVariableMode(var->mode()))) { |
1698 // The name was declared in this scope before; check for conflicting | 1698 // The name was declared in this scope before; check for conflicting |
1699 // re-declarations. We have a conflict if either of the declarations is | 1699 // re-declarations. We have a conflict if either of the declarations is |
(...skipping 2899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4599 ASSERT(info()->isolate()->has_pending_exception()); | 4599 ASSERT(info()->isolate()->has_pending_exception()); |
4600 } else { | 4600 } else { |
4601 result = ParseProgram(); | 4601 result = ParseProgram(); |
4602 } | 4602 } |
4603 } | 4603 } |
4604 info()->SetFunction(result); | 4604 info()->SetFunction(result); |
4605 return (result != NULL); | 4605 return (result != NULL); |
4606 } | 4606 } |
4607 | 4607 |
4608 } } // namespace v8::internal | 4608 } } // namespace v8::internal |
OLD | NEW |