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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 401 |
402 private: | 402 private: |
403 ZoneList<Statement*> statements_; | 403 ZoneList<Statement*> statements_; |
404 bool is_initializer_block_; | 404 bool is_initializer_block_; |
405 Scope* block_scope_; | 405 Scope* block_scope_; |
406 }; | 406 }; |
407 | 407 |
408 | 408 |
409 class Declaration: public AstNode { | 409 class Declaration: public AstNode { |
410 public: | 410 public: |
411 Declaration(VariableProxy* proxy, Variable::Mode mode, FunctionLiteral* fun) | 411 Declaration(VariableProxy* proxy, |
| 412 Variable::Mode mode, |
| 413 FunctionLiteral* fun, |
| 414 Scope* scope) |
412 : proxy_(proxy), | 415 : proxy_(proxy), |
413 mode_(mode), | 416 mode_(mode), |
414 fun_(fun) { | 417 fun_(fun), |
| 418 scope_(scope) { |
415 ASSERT(mode == Variable::VAR || | 419 ASSERT(mode == Variable::VAR || |
416 mode == Variable::CONST || | 420 mode == Variable::CONST || |
417 mode == Variable::LET); | 421 mode == Variable::LET); |
418 // At the moment there are no "const functions"'s in JavaScript... | 422 // At the moment there are no "const functions"'s in JavaScript... |
419 ASSERT(fun == NULL || mode == Variable::VAR || mode == Variable::LET); | 423 ASSERT(fun == NULL || mode == Variable::VAR || mode == Variable::LET); |
420 } | 424 } |
421 | 425 |
422 DECLARE_NODE_TYPE(Declaration) | 426 DECLARE_NODE_TYPE(Declaration) |
423 | 427 |
424 VariableProxy* proxy() const { return proxy_; } | 428 VariableProxy* proxy() const { return proxy_; } |
425 Variable::Mode mode() const { return mode_; } | 429 Variable::Mode mode() const { return mode_; } |
426 FunctionLiteral* fun() const { return fun_; } // may be NULL | 430 FunctionLiteral* fun() const { return fun_; } // may be NULL |
427 virtual bool IsInlineable() const; | 431 virtual bool IsInlineable() const; |
| 432 Scope* scope() const { return scope_; } |
428 | 433 |
429 private: | 434 private: |
430 VariableProxy* proxy_; | 435 VariableProxy* proxy_; |
431 Variable::Mode mode_; | 436 Variable::Mode mode_; |
432 FunctionLiteral* fun_; | 437 FunctionLiteral* fun_; |
| 438 |
| 439 // Nested scope from which the declaration originated. |
| 440 Scope* scope_; |
433 }; | 441 }; |
434 | 442 |
435 | 443 |
436 class IterationStatement: public BreakableStatement { | 444 class IterationStatement: public BreakableStatement { |
437 public: | 445 public: |
438 // Type testing & conversion. | 446 // Type testing & conversion. |
439 virtual IterationStatement* AsIterationStatement() { return this; } | 447 virtual IterationStatement* AsIterationStatement() { return this; } |
440 | 448 |
441 Statement* body() const { return body_; } | 449 Statement* body() const { return body_; } |
442 | 450 |
(...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2257 | 2265 |
2258 private: | 2266 private: |
2259 Isolate* isolate_; | 2267 Isolate* isolate_; |
2260 bool stack_overflow_; | 2268 bool stack_overflow_; |
2261 }; | 2269 }; |
2262 | 2270 |
2263 | 2271 |
2264 } } // namespace v8::internal | 2272 } } // namespace v8::internal |
2265 | 2273 |
2266 #endif // V8_AST_H_ | 2274 #endif // V8_AST_H_ |
OLD | NEW |