| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/parser.h" | 5 #include "vm/parser.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1827 // The instantiator may be required at run time for generic type checks. | 1827 // The instantiator may be required at run time for generic type checks. |
| 1828 if (IsInstantiatorRequired()) { | 1828 if (IsInstantiatorRequired()) { |
| 1829 // Make sure that the receiver of the enclosing instance function | 1829 // Make sure that the receiver of the enclosing instance function |
| 1830 // (or implicit first parameter of an enclosing factory) is marked as | 1830 // (or implicit first parameter of an enclosing factory) is marked as |
| 1831 // captured if type checks are enabled, because they may access the | 1831 // captured if type checks are enabled, because they may access the |
| 1832 // receiver to instantiate types. | 1832 // receiver to instantiate types. |
| 1833 CaptureReceiver(); | 1833 CaptureReceiver(); |
| 1834 } | 1834 } |
| 1835 } | 1835 } |
| 1836 | 1836 |
| 1837 OpenBlock(); // Open a nested scope for the outermost function block. | |
| 1838 if (CurrentToken() == Token::kLBRACE) { | 1837 if (CurrentToken() == Token::kLBRACE) { |
| 1839 ConsumeToken(); | 1838 ConsumeToken(); |
| 1840 ParseStatementSequence(); | 1839 ParseStatementSequence(); |
| 1841 ExpectToken(Token::kRBRACE); | 1840 ExpectToken(Token::kRBRACE); |
| 1842 } else if (CurrentToken() == Token::kARROW) { | 1841 } else if (CurrentToken() == Token::kARROW) { |
| 1843 ConsumeToken(); | 1842 ConsumeToken(); |
| 1844 const intptr_t expr_pos = token_index_; | 1843 const intptr_t expr_pos = token_index_; |
| 1845 AstNode* expr = ParseExpr(kAllowConst); | 1844 AstNode* expr = ParseExpr(kAllowConst); |
| 1846 ASSERT(expr != NULL); | 1845 ASSERT(expr != NULL); |
| 1847 current_block_->statements->Add(new ReturnNode(expr_pos, expr)); | 1846 current_block_->statements->Add(new ReturnNode(expr_pos, expr)); |
| 1848 } else if (IsLiteral("native")) { | 1847 } else if (IsLiteral("native")) { |
| 1849 ParseNativeFunctionBlock(¶ms, func); | 1848 ParseNativeFunctionBlock(¶ms, func); |
| 1850 } else { | 1849 } else { |
| 1851 UnexpectedToken(); | 1850 UnexpectedToken(); |
| 1852 } | 1851 } |
| 1853 SequenceNode* body = CloseBlock(); | |
| 1854 current_block_->statements->Add(body); | |
| 1855 return CloseBlock(); | 1852 return CloseBlock(); |
| 1856 } | 1853 } |
| 1857 | 1854 |
| 1858 | 1855 |
| 1859 void Parser::SkipIf(Token::Kind token) { | 1856 void Parser::SkipIf(Token::Kind token) { |
| 1860 if (CurrentToken() == token) { | 1857 if (CurrentToken() == token) { |
| 1861 ConsumeToken(); | 1858 ConsumeToken(); |
| 1862 } | 1859 } |
| 1863 } | 1860 } |
| 1864 | 1861 |
| (...skipping 5828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7693 } | 7690 } |
| 7694 | 7691 |
| 7695 | 7692 |
| 7696 void Parser::SkipNestedExpr() { | 7693 void Parser::SkipNestedExpr() { |
| 7697 const bool saved_mode = SetAllowFunctionLiterals(true); | 7694 const bool saved_mode = SetAllowFunctionLiterals(true); |
| 7698 SkipExpr(); | 7695 SkipExpr(); |
| 7699 SetAllowFunctionLiterals(saved_mode); | 7696 SetAllowFunctionLiterals(saved_mode); |
| 7700 } | 7697 } |
| 7701 | 7698 |
| 7702 } // namespace dart | 7699 } // namespace dart |
| OLD | NEW |