| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #ifndef VM_PARSER_H_ | 5 #ifndef VM_PARSER_H_ |
| 6 #define VM_PARSER_H_ | 6 #define VM_PARSER_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 | 9 |
| 10 #include "vm/ast.h" | 10 #include "vm/ast.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 void ParseClassDefinition(GrowableArray<const Class*>* classes); | 202 void ParseClassDefinition(GrowableArray<const Class*>* classes); |
| 203 void ParseInterfaceDefinition(GrowableArray<const Class*>* classes); | 203 void ParseInterfaceDefinition(GrowableArray<const Class*>* classes); |
| 204 void ParseFunctionTypeAlias(GrowableArray<const Class*>* classes); | 204 void ParseFunctionTypeAlias(GrowableArray<const Class*>* classes); |
| 205 void ParseTopLevelVariable(TopLevel* top_level); | 205 void ParseTopLevelVariable(TopLevel* top_level); |
| 206 void ParseTopLevelFunction(TopLevel* top_level); | 206 void ParseTopLevelFunction(TopLevel* top_level); |
| 207 void ParseTopLevelAccessor(TopLevel* top_level); | 207 void ParseTopLevelAccessor(TopLevel* top_level); |
| 208 | 208 |
| 209 // Support for parsing libraries. | 209 // Support for parsing libraries. |
| 210 Dart_Handle CallLibraryTagHandler(Dart_LibraryTag tag, | 210 Dart_Handle CallLibraryTagHandler(Dart_LibraryTag tag, |
| 211 intptr_t token_pos, | 211 intptr_t token_pos, |
| 212 const String& url); | 212 const String& url, |
| 213 const Array& import_map); |
| 213 void ParseLibraryDefinition(); | 214 void ParseLibraryDefinition(); |
| 214 void ParseLibraryName(); | 215 void ParseLibraryName(); |
| 215 void ParseLibraryImport(); | 216 void ParseLibraryImport(); |
| 216 void ParseLibraryInclude(); | 217 void ParseLibraryInclude(); |
| 217 | 218 |
| 218 enum TypeResolution { | 219 enum TypeResolution { |
| 219 kIgnore, // Parsed type is ignored and replaced by Dynamic. | 220 kIgnore, // Parsed type is ignored and replaced by Dynamic. |
| 220 kDoNotResolve, // Type resolution is postponed. | 221 kDoNotResolve, // Type resolution is postponed. |
| 221 kCanResolve, // Type resolution is optional. | 222 kCanResolve, // Type resolution is optional. |
| 222 kMustResolve // Type resolution is required. | 223 kMustResolve // Type resolution is required. |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 LiteralNode* ParseConstExpr(); | 344 LiteralNode* ParseConstExpr(); |
| 344 static const bool kRequireConst = true; | 345 static const bool kRequireConst = true; |
| 345 static const bool kAllowConst = false; | 346 static const bool kAllowConst = false; |
| 346 AstNode* ParseExpr(bool require_compiletime_const); | 347 AstNode* ParseExpr(bool require_compiletime_const); |
| 347 AstNode* ParseExprList(); | 348 AstNode* ParseExprList(); |
| 348 AstNode* ParseConditionalExpr(); | 349 AstNode* ParseConditionalExpr(); |
| 349 AstNode* ParseUnaryExpr(); | 350 AstNode* ParseUnaryExpr(); |
| 350 AstNode* ParsePostfixExpr(); | 351 AstNode* ParsePostfixExpr(); |
| 351 AstNode* ParsePrimary(); | 352 AstNode* ParsePrimary(); |
| 352 AstNode* ParseStringLiteral(); | 353 AstNode* ParseStringLiteral(); |
| 354 String* ParseImportStringLiteral(); |
| 353 AstNode* ParseCompoundLiteral(); | 355 AstNode* ParseCompoundLiteral(); |
| 354 AstNode* ParseListLiteral(intptr_t type_pos, | 356 AstNode* ParseListLiteral(intptr_t type_pos, |
| 355 bool is_const, | 357 bool is_const, |
| 356 const AbstractTypeArguments& type_arguments); | 358 const AbstractTypeArguments& type_arguments); |
| 357 AstNode* ParseMapLiteral(intptr_t type_pos, | 359 AstNode* ParseMapLiteral(intptr_t type_pos, |
| 358 bool is_const, | 360 bool is_const, |
| 359 const AbstractTypeArguments& type_arguments); | 361 const AbstractTypeArguments& type_arguments); |
| 360 AstNode* ParseNewOperator(); | 362 AstNode* ParseNewOperator(); |
| 361 | 363 |
| 362 // An implicit argument, if non-null, is prepended to the returned list. | 364 // An implicit argument, if non-null, is prepended to the returned list. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 384 bool IsInstantiatorRequired() const; | 386 bool IsInstantiatorRequired() const; |
| 385 bool IsDefinedInLexicalScope(const String& ident); | 387 bool IsDefinedInLexicalScope(const String& ident); |
| 386 bool ResolveIdentInLocalScope(intptr_t ident_pos, | 388 bool ResolveIdentInLocalScope(intptr_t ident_pos, |
| 387 const String &ident, | 389 const String &ident, |
| 388 AstNode** node); | 390 AstNode** node); |
| 389 static const bool kResolveLocally = true; | 391 static const bool kResolveLocally = true; |
| 390 static const bool kResolveIncludingImports = false; | 392 static const bool kResolveIncludingImports = false; |
| 391 AstNode* ResolveIdentInLibraryScope(const Library& lib, | 393 AstNode* ResolveIdentInLibraryScope(const Library& lib, |
| 392 const QualIdent& qual_ident, | 394 const QualIdent& qual_ident, |
| 393 bool resolve_locally); | 395 bool resolve_locally); |
| 394 AstNode* ResolveVarOrField(intptr_t ident_pos, const String &ident); | 396 AstNode* ResolveVarOrField(intptr_t ident_pos, const String& ident); |
| 397 RawString* ResolveImportVar(intptr_t ident_pos, const String& ident); |
| 395 AstNode* OptimizeBinaryOpNode(intptr_t op_pos, | 398 AstNode* OptimizeBinaryOpNode(intptr_t op_pos, |
| 396 Token::Kind binary_op, | 399 Token::Kind binary_op, |
| 397 AstNode* lhs, | 400 AstNode* lhs, |
| 398 AstNode* rhs); | 401 AstNode* rhs); |
| 399 AstNode* ExpandAssignableOp(intptr_t op_pos, | 402 AstNode* ExpandAssignableOp(intptr_t op_pos, |
| 400 Token::Kind assignment_op, | 403 Token::Kind assignment_op, |
| 401 AstNode* lhs, | 404 AstNode* lhs, |
| 402 AstNode* rhs); | 405 AstNode* rhs); |
| 403 AstNode* AsSideEffectFreeNode(AstNode* node); | 406 AstNode* AsSideEffectFreeNode(AstNode* node); |
| 404 LocalVariable* CreateTempConstVariable(intptr_t token_index, | 407 LocalVariable* CreateTempConstVariable(intptr_t token_index, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 // code at all points in the try block where an exit from the block is | 457 // code at all points in the try block where an exit from the block is |
| 455 // done using 'return', 'break' or 'continue' statements. | 458 // done using 'return', 'break' or 'continue' statements. |
| 456 TryBlocks* try_blocks_list_; | 459 TryBlocks* try_blocks_list_; |
| 457 | 460 |
| 458 DISALLOW_COPY_AND_ASSIGN(Parser); | 461 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 459 }; | 462 }; |
| 460 | 463 |
| 461 } // namespace dart | 464 } // namespace dart |
| 462 | 465 |
| 463 #endif // VM_PARSER_H_ | 466 #endif // VM_PARSER_H_ |
| OLD | NEW |