| 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 "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // class if the metadata is at the top-level). | 144 // class if the metadata is at the top-level). |
| 145 static RawObject* ParseMetadata(const Class& cls, intptr_t token_pos); | 145 static RawObject* ParseMetadata(const Class& cls, intptr_t token_pos); |
| 146 | 146 |
| 147 // Format and print a message with source location. | 147 // Format and print a message with source location. |
| 148 // A null script means no source and a negative token_pos means no position. | 148 // A null script means no source and a negative token_pos means no position. |
| 149 static void PrintMessage(const Script& script, | 149 static void PrintMessage(const Script& script, |
| 150 intptr_t token_pos, | 150 intptr_t token_pos, |
| 151 const char* message_header, | 151 const char* message_header, |
| 152 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); | 152 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); |
| 153 | 153 |
| 154 // Build an error object containing a formatted error or warning message. | 154 // Build an error object containing a formatted error message. |
| 155 // A null script means no source and a negative token_pos means no position. | 155 // A null script means no source and a negative token_pos means no position. |
| 156 static RawError* FormatError(const Script& script, | 156 static RawError* FormatError(const Script& script, |
| 157 intptr_t token_pos, | 157 intptr_t token_pos, |
| 158 const char* message_header, | 158 const char* message_header, |
| 159 const char* format, | 159 const char* format, |
| 160 va_list args); | 160 va_list args); |
| 161 static RawError* FormatErrorMsg(const Script& script, | 161 static RawError* FormatErrorMsg(const Script& script, |
| 162 intptr_t token_pos, | 162 intptr_t token_pos, |
| 163 const char* message_header, | 163 const char* message_header, |
| 164 const char* format, ...) | 164 const char* format, ...) |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 Function& constructor, | 295 Function& constructor, |
| 296 const AbstractTypeArguments& type_arguments); | 296 const AbstractTypeArguments& type_arguments); |
| 297 | 297 |
| 298 // A null script means no source and a negative token_pos means no position. | 298 // A null script means no source and a negative token_pos means no position. |
| 299 static RawString* FormatMessage(const Script& script, | 299 static RawString* FormatMessage(const Script& script, |
| 300 intptr_t token_pos, | 300 intptr_t token_pos, |
| 301 const char* message_header, | 301 const char* message_header, |
| 302 const char* format, | 302 const char* format, |
| 303 va_list args); | 303 va_list args); |
| 304 | 304 |
| 305 // Reports error/warning msg at location of current token in current script. | 305 // Reports error msg at location of current token in current script. |
| 306 void ErrorMsg(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); | 306 void ErrorMsg(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); |
| 307 void Warning(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); | |
| 308 void Unimplemented(const char* msg); | 307 void Unimplemented(const char* msg); |
| 309 | 308 |
| 310 // Reports error message at given location in current script. | 309 // Reports error message at given location in current script. |
| 311 void ErrorMsg(intptr_t token_pos, const char* msg, ...) const | 310 void ErrorMsg(intptr_t token_pos, const char* msg, ...) const |
| 312 PRINTF_ATTRIBUTE(3, 4); | 311 PRINTF_ATTRIBUTE(3, 4); |
| 313 void Warning(intptr_t token_pos, const char* msg, ...) | |
| 314 PRINTF_ATTRIBUTE(3, 4); | |
| 315 | 312 |
| 316 // Reports an already formatted error message. | 313 // Reports an already formatted error message. |
| 317 static void ErrorMsg(const Error& error); | 314 static void ErrorMsg(const Error& error); |
| 318 | 315 |
| 319 // Concatenates two error messages, the previous and the current one. | 316 // Concatenates two error messages, the previous and the current one. |
| 320 void AppendErrorMsg( | 317 void AppendErrorMsg( |
| 321 const Error& prev_error, intptr_t token_pos, const char* format, ...) | 318 const Error& prev_error, intptr_t token_pos, const char* format, ...) |
| 322 PRINTF_ATTRIBUTE(4, 5); | 319 PRINTF_ATTRIBUTE(4, 5); |
| 323 | 320 |
| 324 void CheckRecursiveInvocation(); | 321 void CheckRecursiveInvocation(); |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 intptr_t last_used_try_index_; | 694 intptr_t last_used_try_index_; |
| 698 | 695 |
| 699 bool unregister_pending_function_; | 696 bool unregister_pending_function_; |
| 700 | 697 |
| 701 DISALLOW_COPY_AND_ASSIGN(Parser); | 698 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 702 }; | 699 }; |
| 703 | 700 |
| 704 } // namespace dart | 701 } // namespace dart |
| 705 | 702 |
| 706 #endif // VM_PARSER_H_ | 703 #endif // VM_PARSER_H_ |
| OLD | NEW |