| 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 "platform/assert.h" | 10 #include "platform/assert.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // * its default value (or null if none was declared) | 156 // * its default value (or null if none was declared) |
| 157 // * an array of metadata (or null if no metadata was declared). | 157 // * an array of metadata (or null if no metadata was declared). |
| 158 enum { | 158 enum { |
| 159 kParameterIsFinalOffset, | 159 kParameterIsFinalOffset, |
| 160 kParameterDefaultValueOffset, | 160 kParameterDefaultValueOffset, |
| 161 kParameterMetadataOffset, | 161 kParameterMetadataOffset, |
| 162 kParameterEntrySize, | 162 kParameterEntrySize, |
| 163 }; | 163 }; |
| 164 static RawObject* ParseFunctionParameters(const Function& func); | 164 static RawObject* ParseFunctionParameters(const Function& func); |
| 165 | 165 |
| 166 // Format and print a message with source location. | |
| 167 // A null script means no source and a negative token_pos means no position. | |
| 168 static void PrintMessage(const Script& script, | |
| 169 intptr_t token_pos, | |
| 170 const char* message_header, | |
| 171 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); | |
| 172 | |
| 173 // Build an error object containing a formatted error or warning message. | |
| 174 // A null script means no source and a negative token_pos means no position. | |
| 175 static RawError* FormatError(const Script& script, | |
| 176 intptr_t token_pos, | |
| 177 const char* message_header, | |
| 178 const char* format, | |
| 179 va_list args); | |
| 180 static RawError* FormatErrorMsg(const Script& script, | |
| 181 intptr_t token_pos, | |
| 182 const char* message_header, | |
| 183 const char* format, ...) | |
| 184 PRINTF_ATTRIBUTE(4, 5); | |
| 185 | |
| 186 // Same as FormatError, but appends the new error to the 'prev_error'. | |
| 187 static RawError* FormatErrorWithAppend(const Error& prev_error, | |
| 188 const Script& script, | |
| 189 intptr_t token_pos, | |
| 190 const char* message_header, | |
| 191 const char* format, | |
| 192 va_list args); | |
| 193 | |
| 194 private: | 166 private: |
| 195 friend class EffectGraphVisitor; // For BuildNoSuchMethodArguments. | 167 friend class EffectGraphVisitor; // For BuildNoSuchMethodArguments. |
| 196 | 168 |
| 197 struct Block; | 169 struct Block; |
| 198 class TryBlocks; | 170 class TryBlocks; |
| 199 | 171 |
| 200 Parser(const Script& script, const Library& library, intptr_t token_pos); | 172 Parser(const Script& script, const Library& library, intptr_t token_pos); |
| 201 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos); | 173 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos); |
| 202 ~Parser(); | 174 ~Parser(); |
| 203 | 175 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 void SkipFunctionPreamble(); | 282 void SkipFunctionPreamble(); |
| 311 | 283 |
| 312 void CheckConstructorCallTypeArguments( | 284 void CheckConstructorCallTypeArguments( |
| 313 intptr_t pos, | 285 intptr_t pos, |
| 314 Function& constructor, | 286 Function& constructor, |
| 315 const AbstractTypeArguments& type_arguments); | 287 const AbstractTypeArguments& type_arguments); |
| 316 | 288 |
| 317 // A null script means no source and a negative token_pos means no position. | 289 // A null script means no source and a negative token_pos means no position. |
| 318 static RawString* FormatMessage(const Script& script, | 290 static RawString* FormatMessage(const Script& script, |
| 319 intptr_t token_pos, | 291 intptr_t token_pos, |
| 320 const char* message_header, | 292 LanguageError::Kind kind, |
| 321 const char* format, | 293 const char* format, |
| 322 va_list args); | 294 va_list args); |
| 323 | 295 |
| 324 // Reports error/warning msg at location of current token in current script. | 296 // Reports error/warning msg at location of current token in current script. |
| 325 void ErrorMsg(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); | 297 void ErrorMsg(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); |
| 326 void Warning(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); | 298 void Warning(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); |
| 327 void Unimplemented(const char* msg); | 299 void Unimplemented(const char* msg); |
| 328 | 300 |
| 329 // Reports error message at given location in current script. | 301 // Reports error message at given location in current script. |
| 330 void ErrorMsg(intptr_t token_pos, const char* msg, ...) const | 302 void ErrorMsg(intptr_t token_pos, const char* msg, ...) const |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 intptr_t last_used_try_index_; | 703 intptr_t last_used_try_index_; |
| 732 | 704 |
| 733 bool unregister_pending_function_; | 705 bool unregister_pending_function_; |
| 734 | 706 |
| 735 DISALLOW_COPY_AND_ASSIGN(Parser); | 707 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 736 }; | 708 }; |
| 737 | 709 |
| 738 } // namespace dart | 710 } // namespace dart |
| 739 | 711 |
| 740 #endif // VM_PARSER_H_ | 712 #endif // VM_PARSER_H_ |
| OLD | NEW |