| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 const char* message_header, | 128 const char* message_header, |
| 129 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); | 129 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); |
| 130 | 130 |
| 131 // Build an error object containing a formatted error or warning message. | 131 // Build an error object containing a formatted error or warning message. |
| 132 // A null script means no source and a negative token_pos means no position. | 132 // A null script means no source and a negative token_pos means no position. |
| 133 static RawError* FormatError(const Script& script, | 133 static RawError* FormatError(const Script& script, |
| 134 intptr_t token_pos, | 134 intptr_t token_pos, |
| 135 const char* message_header, | 135 const char* message_header, |
| 136 const char* format, | 136 const char* format, |
| 137 va_list args); | 137 va_list args); |
| 138 static RawError* FormatErrorMsg(const Script& script, |
| 139 intptr_t token_pos, |
| 140 const char* message_header, |
| 141 const char* format, ...) |
| 142 PRINTF_ATTRIBUTE(4, 5); |
| 138 | 143 |
| 139 // Same as FormatError, but appends the new error to the 'prev_error'. | 144 // Same as FormatError, but appends the new error to the 'prev_error'. |
| 140 static RawError* FormatErrorWithAppend(const Error& prev_error, | 145 static RawError* FormatErrorWithAppend(const Error& prev_error, |
| 141 const Script& script, | 146 const Script& script, |
| 142 intptr_t token_pos, | 147 intptr_t token_pos, |
| 143 const char* message_header, | 148 const char* message_header, |
| 144 const char* format, | 149 const char* format, |
| 145 va_list args); | 150 va_list args); |
| 146 | 151 |
| 147 private: | 152 private: |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 void CheckInstanceFieldAccess(intptr_t field_pos, const String& field_name); | 502 void CheckInstanceFieldAccess(intptr_t field_pos, const String& field_name); |
| 498 bool ParsingStaticMember() const; | 503 bool ParsingStaticMember() const; |
| 499 const Type* ReceiverType(intptr_t type_pos) const; | 504 const Type* ReceiverType(intptr_t type_pos) const; |
| 500 bool IsInstantiatorRequired() const; | 505 bool IsInstantiatorRequired() const; |
| 501 bool ResolveIdentInLocalScope(intptr_t ident_pos, | 506 bool ResolveIdentInLocalScope(intptr_t ident_pos, |
| 502 const String &ident, | 507 const String &ident, |
| 503 AstNode** node); | 508 AstNode** node); |
| 504 static const bool kResolveLocally = true; | 509 static const bool kResolveLocally = true; |
| 505 static const bool kResolveIncludingImports = false; | 510 static const bool kResolveIncludingImports = false; |
| 506 | 511 |
| 507 // Resolve a primary identifier in the libary or prefix scope and | 512 // Resolve a primary identifier in the library or prefix scope and |
| 508 // generate the corresponding AstNode. | 513 // generate the corresponding AstNode. |
| 514 AstNode* ResolveIdentInCurrentLibraryScope(intptr_t ident_pos, |
| 515 const String& ident); |
| 509 AstNode* ResolveIdentInPrefixScope(intptr_t ident_pos, | 516 AstNode* ResolveIdentInPrefixScope(intptr_t ident_pos, |
| 510 const LibraryPrefix& prefix, | 517 const LibraryPrefix& prefix, |
| 511 const String& ident); | 518 const String& ident); |
| 512 AstNode* ResolveIdentInCurrentLibraryScope(intptr_t ident_pos, | |
| 513 const String& ident); | |
| 514 | 519 |
| 515 // Find class with the given name in the library or prefix scope. | 520 // Find class with the given name in the library or prefix scope. |
| 516 RawClass* ResolveClassInCurrentLibraryScope(intptr_t ident_pos, | 521 RawClass* ResolveClassInCurrentLibraryScope(intptr_t ident_pos, |
| 517 const String& name); | 522 const String& name, |
| 523 Error* error); |
| 518 RawClass* ResolveClassInPrefixScope(intptr_t ident_pos, | 524 RawClass* ResolveClassInPrefixScope(intptr_t ident_pos, |
| 519 const LibraryPrefix& prefix, | 525 const LibraryPrefix& prefix, |
| 520 const String& name); | 526 const String& name, |
| 527 Error* error); |
| 521 | 528 |
| 522 // Find name in the library or prefix scope and return the corresponding | 529 // Find name in the library or prefix scope and return the corresponding |
| 523 // object (field, class, function etc). | 530 // object (field, class, function etc). |
| 524 RawObject* ResolveNameInCurrentLibraryScope(intptr_t ident_pos, | 531 RawObject* ResolveNameInCurrentLibraryScope(intptr_t ident_pos, |
| 525 const String& ident); | 532 const String& ident, |
| 533 Error* error); |
| 526 RawObject* ResolveNameInPrefixScope(intptr_t ident_pos, | 534 RawObject* ResolveNameInPrefixScope(intptr_t ident_pos, |
| 527 const LibraryPrefix& prefix, | 535 const LibraryPrefix& prefix, |
| 528 const String& name); | 536 const String& name, |
| 537 Error* error); |
| 529 | 538 |
| 530 AstNode* ResolveIdent(intptr_t ident_pos, | 539 AstNode* ResolveIdent(intptr_t ident_pos, |
| 531 const String& ident, | 540 const String& ident, |
| 532 bool allow_closure_names); | 541 bool allow_closure_names); |
| 533 RawString* ResolveImportVar(intptr_t ident_pos, const String& ident); | 542 RawString* ResolveImportVar(intptr_t ident_pos, const String& ident); |
| 534 AstNode* OptimizeBinaryOpNode(intptr_t op_pos, | 543 AstNode* OptimizeBinaryOpNode(intptr_t op_pos, |
| 535 Token::Kind binary_op, | 544 Token::Kind binary_op, |
| 536 AstNode* lhs, | 545 AstNode* lhs, |
| 537 AstNode* rhs); | 546 AstNode* rhs); |
| 538 AstNode* ExpandAssignableOp(intptr_t op_pos, | 547 AstNode* ExpandAssignableOp(intptr_t op_pos, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 | 618 |
| 610 // Allocate temporary only once per function. | 619 // Allocate temporary only once per function. |
| 611 LocalVariable* expression_temp_; | 620 LocalVariable* expression_temp_; |
| 612 | 621 |
| 613 DISALLOW_COPY_AND_ASSIGN(Parser); | 622 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 614 }; | 623 }; |
| 615 | 624 |
| 616 } // namespace dart | 625 } // namespace dart |
| 617 | 626 |
| 618 #endif // VM_PARSER_H_ | 627 #endif // VM_PARSER_H_ |
| OLD | NEW |