OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 24 matching lines...) Expand all Loading... |
35 namespace internal { | 35 namespace internal { |
36 | 36 |
37 class CompilationInfo; | 37 class CompilationInfo; |
38 | 38 |
39 | 39 |
40 // A hash map to support fast variable declaration and lookup. | 40 // A hash map to support fast variable declaration and lookup. |
41 class VariableMap: public HashMap { | 41 class VariableMap: public HashMap { |
42 public: | 42 public: |
43 VariableMap(); | 43 VariableMap(); |
44 | 44 |
45 // Dummy constructor. This constructor doesn't set up the map | |
46 // properly so don't use it unless you have a good reason. | |
47 explicit VariableMap(bool gotta_love_static_overloading); | |
48 | |
49 virtual ~VariableMap(); | 45 virtual ~VariableMap(); |
50 | 46 |
51 Variable* Declare(Scope* scope, | 47 Variable* Declare(Scope* scope, |
52 Handle<String> name, | 48 Handle<String> name, |
53 VariableMode mode, | 49 VariableMode mode, |
54 bool is_valid_lhs, | 50 bool is_valid_lhs, |
55 Variable::Kind kind); | 51 Variable::Kind kind); |
56 | 52 |
57 Variable* Lookup(Handle<String> name); | 53 Variable* Lookup(Handle<String> name); |
58 }; | 54 }; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 362 |
367 #ifdef DEBUG | 363 #ifdef DEBUG |
368 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively | 364 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively |
369 #endif | 365 #endif |
370 | 366 |
371 // --------------------------------------------------------------------------- | 367 // --------------------------------------------------------------------------- |
372 // Implementation. | 368 // Implementation. |
373 protected: | 369 protected: |
374 friend class ParserFactory; | 370 friend class ParserFactory; |
375 | 371 |
376 explicit Scope(ScopeType type); | |
377 | |
378 Isolate* const isolate_; | 372 Isolate* const isolate_; |
379 | 373 |
380 // Scope tree. | 374 // Scope tree. |
381 Scope* outer_scope_; // the immediately enclosing outer scope, or NULL | 375 Scope* outer_scope_; // the immediately enclosing outer scope, or NULL |
382 ZoneList<Scope*> inner_scopes_; // the immediately enclosed inner scopes | 376 ZoneList<Scope*> inner_scopes_; // the immediately enclosed inner scopes |
383 | 377 |
384 // The scope type. | 378 // The scope type. |
385 ScopeType type_; | 379 ScopeType type_; |
386 | 380 |
387 // Debugging support. | 381 // Debugging support. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 } | 538 } |
545 | 539 |
546 void SetDefaults(ScopeType type, | 540 void SetDefaults(ScopeType type, |
547 Scope* outer_scope, | 541 Scope* outer_scope, |
548 Handle<SerializedScopeInfo> scope_info); | 542 Handle<SerializedScopeInfo> scope_info); |
549 }; | 543 }; |
550 | 544 |
551 } } // namespace v8::internal | 545 } } // namespace v8::internal |
552 | 546 |
553 #endif // V8_SCOPES_H_ | 547 #endif // V8_SCOPES_H_ |
OLD | NEW |