| 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. |
| 1837 if (CurrentToken() == Token::kLBRACE) { | 1838 if (CurrentToken() == Token::kLBRACE) { |
| 1838 ConsumeToken(); | 1839 ConsumeToken(); |
| 1839 ParseStatementSequence(); | 1840 ParseStatementSequence(); |
| 1840 ExpectToken(Token::kRBRACE); | 1841 ExpectToken(Token::kRBRACE); |
| 1841 } else if (CurrentToken() == Token::kARROW) { | 1842 } else if (CurrentToken() == Token::kARROW) { |
| 1842 ConsumeToken(); | 1843 ConsumeToken(); |
| 1843 const intptr_t expr_pos = token_index_; | 1844 const intptr_t expr_pos = token_index_; |
| 1844 AstNode* expr = ParseExpr(kAllowConst); | 1845 AstNode* expr = ParseExpr(kAllowConst); |
| 1845 ASSERT(expr != NULL); | 1846 ASSERT(expr != NULL); |
| 1846 current_block_->statements->Add(new ReturnNode(expr_pos, expr)); | 1847 current_block_->statements->Add(new ReturnNode(expr_pos, expr)); |
| 1847 } else if (IsLiteral("native")) { | 1848 } else if (IsLiteral("native")) { |
| 1848 ParseNativeFunctionBlock(¶ms, func); | 1849 ParseNativeFunctionBlock(¶ms, func); |
| 1849 } else { | 1850 } else { |
| 1850 UnexpectedToken(); | 1851 UnexpectedToken(); |
| 1851 } | 1852 } |
| 1852 | 1853 current_block_->statements->Add(CloseBlock()); |
| 1853 SequenceNode* statements = CloseBlock(); | 1854 SequenceNode* statements = CloseBlock(); |
| 1854 return statements; | 1855 return statements; |
| 1855 } | 1856 } |
| 1856 | 1857 |
| 1857 | 1858 |
| 1858 void Parser::SkipIf(Token::Kind token) { | 1859 void Parser::SkipIf(Token::Kind token) { |
| 1859 if (CurrentToken() == token) { | 1860 if (CurrentToken() == token) { |
| 1860 ConsumeToken(); | 1861 ConsumeToken(); |
| 1861 } | 1862 } |
| 1862 } | 1863 } |
| (...skipping 5829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7692 } | 7693 } |
| 7693 | 7694 |
| 7694 | 7695 |
| 7695 void Parser::SkipNestedExpr() { | 7696 void Parser::SkipNestedExpr() { |
| 7696 const bool saved_mode = SetAllowFunctionLiterals(true); | 7697 const bool saved_mode = SetAllowFunctionLiterals(true); |
| 7697 SkipExpr(); | 7698 SkipExpr(); |
| 7698 SetAllowFunctionLiterals(saved_mode); | 7699 SetAllowFunctionLiterals(saved_mode); |
| 7699 } | 7700 } |
| 7700 | 7701 |
| 7701 } // namespace dart | 7702 } // namespace dart |
| OLD | NEW |