| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // * its default value (or null if none was declared) | 152 // * its default value (or null if none was declared) |
| 153 // * an array of metadata (or null if no metadata was declared). | 153 // * an array of metadata (or null if no metadata was declared). |
| 154 enum { | 154 enum { |
| 155 kParameterIsFinalOffset, | 155 kParameterIsFinalOffset, |
| 156 kParameterDefaultValueOffset, | 156 kParameterDefaultValueOffset, |
| 157 kParameterMetadataOffset, | 157 kParameterMetadataOffset, |
| 158 kParameterEntrySize, | 158 kParameterEntrySize, |
| 159 }; | 159 }; |
| 160 static RawObject* ParseFunctionParameters(const Function& func); | 160 static RawObject* ParseFunctionParameters(const Function& func); |
| 161 | 161 |
| 162 // Format and print a message with source location. | |
| 163 // A null script means no source and a negative token_pos means no position. | |
| 164 static void PrintMessage(const Script& script, | |
| 165 intptr_t token_pos, | |
| 166 const char* message_header, | |
| 167 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); | |
| 168 | |
| 169 // Build an error object containing a formatted error or warning message. | |
| 170 // A null script means no source and a negative token_pos means no position. | |
| 171 static RawError* FormatError(const Script& script, | |
| 172 intptr_t token_pos, | |
| 173 const char* message_header, | |
| 174 const char* format, | |
| 175 va_list args); | |
| 176 static RawError* FormatErrorMsg(const Script& script, | |
| 177 intptr_t token_pos, | |
| 178 const char* message_header, | |
| 179 const char* format, ...) | |
| 180 PRINTF_ATTRIBUTE(4, 5); | |
| 181 | |
| 182 // Same as FormatError, but appends the new error to the 'prev_error'. | |
| 183 static RawError* FormatErrorWithAppend(const Error& prev_error, | |
| 184 const Script& script, | |
| 185 intptr_t token_pos, | |
| 186 const char* message_header, | |
| 187 const char* format, | |
| 188 va_list args); | |
| 189 | |
| 190 private: | 162 private: |
| 191 friend class EffectGraphVisitor; // For BuildNoSuchMethodArguments. | 163 friend class EffectGraphVisitor; // For BuildNoSuchMethodArguments. |
| 192 | 164 |
| 193 struct Block; | 165 struct Block; |
| 194 class TryBlocks; | 166 class TryBlocks; |
| 195 | 167 |
| 196 Parser(const Script& script, const Library& library, intptr_t token_pos); | 168 Parser(const Script& script, const Library& library, intptr_t token_pos); |
| 197 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos); | 169 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos); |
| 198 ~Parser(); | 170 ~Parser(); |
| 199 | 171 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 void SkipFunctionPreamble(); | 277 void SkipFunctionPreamble(); |
| 306 | 278 |
| 307 void CheckConstructorCallTypeArguments( | 279 void CheckConstructorCallTypeArguments( |
| 308 intptr_t pos, | 280 intptr_t pos, |
| 309 Function& constructor, | 281 Function& constructor, |
| 310 const AbstractTypeArguments& type_arguments); | 282 const AbstractTypeArguments& type_arguments); |
| 311 | 283 |
| 312 // A null script means no source and a negative token_pos means no position. | 284 // A null script means no source and a negative token_pos means no position. |
| 313 static RawString* FormatMessage(const Script& script, | 285 static RawString* FormatMessage(const Script& script, |
| 314 intptr_t token_pos, | 286 intptr_t token_pos, |
| 315 const char* message_header, | 287 LanguageError::Kind kind, |
| 316 const char* format, | 288 const char* format, |
| 317 va_list args); | 289 va_list args); |
| 318 | 290 |
| 319 // Reports error/warning msg at location of current token in current script. | 291 // Reports error/warning msg at location of current token in current script. |
| 320 void ErrorMsg(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); | 292 void ErrorMsg(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); |
| 321 void Warning(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); | 293 void Warning(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); |
| 322 void Unimplemented(const char* msg); | 294 void Unimplemented(const char* msg); |
| 323 | 295 |
| 324 // Reports error message at given location in current script. | 296 // Reports error message at given location in current script. |
| 325 void ErrorMsg(intptr_t token_pos, const char* msg, ...) const | 297 void ErrorMsg(intptr_t token_pos, const char* msg, ...) const |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 intptr_t last_used_try_index_; | 692 intptr_t last_used_try_index_; |
| 721 | 693 |
| 722 bool unregister_pending_function_; | 694 bool unregister_pending_function_; |
| 723 | 695 |
| 724 DISALLOW_COPY_AND_ASSIGN(Parser); | 696 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 725 }; | 697 }; |
| 726 | 698 |
| 727 } // namespace dart | 699 } // namespace dart |
| 728 | 700 |
| 729 #endif // VM_PARSER_H_ | 701 #endif // VM_PARSER_H_ |
| OLD | NEW |