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 "src/scopes.h" | 5 #include "src/scopes.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/messages.h" | 9 #include "src/messages.h" |
10 #include "src/parser.h" | 10 #include "src/parser.h" |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 | 552 |
553 void Scope::SetIllegalRedeclaration(Expression* expression) { | 553 void Scope::SetIllegalRedeclaration(Expression* expression) { |
554 // Record only the first illegal redeclaration. | 554 // Record only the first illegal redeclaration. |
555 if (!HasIllegalRedeclaration()) { | 555 if (!HasIllegalRedeclaration()) { |
556 illegal_redecl_ = expression; | 556 illegal_redecl_ = expression; |
557 } | 557 } |
558 DCHECK(HasIllegalRedeclaration()); | 558 DCHECK(HasIllegalRedeclaration()); |
559 } | 559 } |
560 | 560 |
561 | 561 |
562 void Scope::VisitIllegalRedeclaration(AstVisitor* visitor) { | 562 Expression* Scope::GetIllegalRedeclaration() { |
563 DCHECK(HasIllegalRedeclaration()); | 563 DCHECK(HasIllegalRedeclaration()); |
564 illegal_redecl_->Accept(visitor); | 564 return illegal_redecl_; |
565 } | 565 } |
566 | 566 |
567 | 567 |
568 Declaration* Scope::CheckConflictingVarDeclarations() { | 568 Declaration* Scope::CheckConflictingVarDeclarations() { |
569 int length = decls_.length(); | 569 int length = decls_.length(); |
570 for (int i = 0; i < length; i++) { | 570 for (int i = 0; i < length; i++) { |
571 Declaration* decl = decls_[i]; | 571 Declaration* decl = decls_[i]; |
572 if (decl->mode() != VAR && !is_block_scope()) continue; | 572 if (decl->mode() != VAR && !is_block_scope()) continue; |
573 const AstRawString* name = decl->proxy()->raw_name(); | 573 const AstRawString* name = decl->proxy()->raw_name(); |
574 | 574 |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 function_ != NULL && function_->proxy()->var()->IsContextSlot(); | 1621 function_ != NULL && function_->proxy()->var()->IsContextSlot(); |
1622 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - | 1622 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - |
1623 (is_function_var_in_context ? 1 : 0); | 1623 (is_function_var_in_context ? 1 : 0); |
1624 } | 1624 } |
1625 | 1625 |
1626 | 1626 |
1627 int Scope::ContextGlobalCount() const { return num_global_slots(); } | 1627 int Scope::ContextGlobalCount() const { return num_global_slots(); } |
1628 | 1628 |
1629 } // namespace internal | 1629 } // namespace internal |
1630 } // namespace v8 | 1630 } // namespace v8 |
OLD | NEW |