| 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 #ifndef V8_SCOPES_H_ | 5 #ifndef V8_SCOPES_H_ | 
| 6 #define V8_SCOPES_H_ | 6 #define V8_SCOPES_H_ | 
| 7 | 7 | 
| 8 #include "src/ast.h" | 8 #include "src/ast.h" | 
| 9 #include "src/zone.h" | 9 #include "src/zone.h" | 
| 10 | 10 | 
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 460   // Strict mode support. | 460   // Strict mode support. | 
| 461   bool IsDeclared(const AstRawString* name) { | 461   bool IsDeclared(const AstRawString* name) { | 
| 462     // During formal parameter list parsing the scope only contains | 462     // During formal parameter list parsing the scope only contains | 
| 463     // two variables inserted at initialization: "this" and "arguments". | 463     // two variables inserted at initialization: "this" and "arguments". | 
| 464     // "this" is an invalid parameter name and "arguments" is invalid parameter | 464     // "this" is an invalid parameter name and "arguments" is invalid parameter | 
| 465     // name in strict mode. Therefore looking up with the map which includes | 465     // name in strict mode. Therefore looking up with the map which includes | 
| 466     // "this" and "arguments" in addition to all formal parameters is safe. | 466     // "this" and "arguments" in addition to all formal parameters is safe. | 
| 467     return variables_.Lookup(name) != NULL; | 467     return variables_.Lookup(name) != NULL; | 
| 468   } | 468   } | 
| 469 | 469 | 
|  | 470   bool IsDeclaredParameter(const AstRawString* name) { | 
|  | 471     // If IsSimpleParameterList is false, duplicate parameters are not allowed, | 
|  | 472     // however `arguments` may be allowed if function is not strict code. Thus, | 
|  | 473     // the assumptions explained above do not hold. | 
|  | 474     Variable* var = variables_.Lookup(name); | 
|  | 475     return var != NULL && params_.Contains(var); | 
|  | 476   } | 
|  | 477 | 
| 470   // --------------------------------------------------------------------------- | 478   // --------------------------------------------------------------------------- | 
| 471   // Debugging. | 479   // Debugging. | 
| 472 | 480 | 
| 473 #ifdef DEBUG | 481 #ifdef DEBUG | 
| 474   void Print(int n = 0);  // n = indentation; n < 0 => don't print recursively | 482   void Print(int n = 0);  // n = indentation; n < 0 => don't print recursively | 
| 475 #endif | 483 #endif | 
| 476 | 484 | 
| 477   // --------------------------------------------------------------------------- | 485   // --------------------------------------------------------------------------- | 
| 478   // Implementation. | 486   // Implementation. | 
| 479  protected: | 487  protected: | 
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 691                    Scope* outer_scope, | 699                    Scope* outer_scope, | 
| 692                    Handle<ScopeInfo> scope_info); | 700                    Handle<ScopeInfo> scope_info); | 
| 693 | 701 | 
| 694   AstValueFactory* ast_value_factory_; | 702   AstValueFactory* ast_value_factory_; | 
| 695   Zone* zone_; | 703   Zone* zone_; | 
| 696 }; | 704 }; | 
| 697 | 705 | 
| 698 } }  // namespace v8::internal | 706 } }  // namespace v8::internal | 
| 699 | 707 | 
| 700 #endif  // V8_SCOPES_H_ | 708 #endif  // V8_SCOPES_H_ | 
| OLD | NEW | 
|---|