Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: runtime/vm/parser.h

Issue 16780008: Reified metadata in the VM (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // Parse the top level of a whole script file and register declared classes 134 // Parse the top level of a whole script file and register declared classes
135 // in the given library. 135 // in the given library.
136 static void ParseCompilationUnit(const Library& library, 136 static void ParseCompilationUnit(const Library& library,
137 const Script& script); 137 const Script& script);
138 138
139 // Parse top level of a class and register all functions/fields. 139 // Parse top level of a class and register all functions/fields.
140 static void ParseClass(const Class& cls); 140 static void ParseClass(const Class& cls);
141 141
142 static void ParseFunction(ParsedFunction* parsed_function); 142 static void ParseFunction(ParsedFunction* parsed_function);
143 143
144 // Parse and evaluate the metadata expressions at token_pos in the
145 // class namespace of class cls (which can be the implicit toplevel
146 // class if the metadata is at the top-level).
147 static RawObject* ParseMetadata(const Class& cls, intptr_t token_pos);
148
144 // Format and print a message with source location. 149 // Format and print a message with source location.
145 // A null script means no source and a negative token_pos means no position. 150 // A null script means no source and a negative token_pos means no position.
146 static void PrintMessage(const Script& script, 151 static void PrintMessage(const Script& script,
147 intptr_t token_pos, 152 intptr_t token_pos,
148 const char* message_header, 153 const char* message_header,
149 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); 154 const char* format, ...) PRINTF_ATTRIBUTE(4, 5);
150 155
151 // Build an error object containing a formatted error or warning message. 156 // Build an error object containing a formatted error or warning message.
152 // A null script means no source and a negative token_pos means no position. 157 // A null script means no source and a negative token_pos means no position.
153 static RawError* FormatError(const Script& script, 158 static RawError* FormatError(const Script& script,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 void ConsumeRightAngleBracket(); 259 void ConsumeRightAngleBracket();
255 void ExpectToken(Token::Kind token_expected); 260 void ExpectToken(Token::Kind token_expected);
256 void ExpectSemicolon(); 261 void ExpectSemicolon();
257 void UnexpectedToken(); 262 void UnexpectedToken();
258 String* ExpectUserDefinedTypeIdentifier(const char* msg); 263 String* ExpectUserDefinedTypeIdentifier(const char* msg);
259 String* ExpectIdentifier(const char* msg); 264 String* ExpectIdentifier(const char* msg);
260 bool IsLiteral(const char* literal); 265 bool IsLiteral(const char* literal);
261 266
262 void SkipIf(Token::Kind); 267 void SkipIf(Token::Kind);
263 void SkipBlock(); 268 void SkipBlock();
264 void SkipMetadata(); 269 intptr_t SkipMetadata();
265 void SkipToMatchingParenthesis(); 270 void SkipToMatchingParenthesis();
266 void SkipTypeArguments(); 271 void SkipTypeArguments();
267 void SkipType(bool allow_void); 272 void SkipType(bool allow_void);
268 void SkipInitializers(); 273 void SkipInitializers();
269 void SkipExpr(); 274 void SkipExpr();
270 void SkipNestedExpr(); 275 void SkipNestedExpr();
271 void SkipConditionalExpr(); 276 void SkipConditionalExpr();
272 void SkipBinaryExpr(); 277 void SkipBinaryExpr();
273 void SkipUnaryExpr(); 278 void SkipUnaryExpr();
274 void SkipPostfixExpr(); 279 void SkipPostfixExpr();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 AstNode* RunStaticFieldInitializer(const Field& field); 323 AstNode* RunStaticFieldInitializer(const Field& field);
319 RawObject* EvaluateConstConstructorCall( 324 RawObject* EvaluateConstConstructorCall(
320 const Class& type_class, 325 const Class& type_class,
321 const AbstractTypeArguments& type_arguments, 326 const AbstractTypeArguments& type_arguments,
322 const Function& constructor, 327 const Function& constructor,
323 ArgumentListNode* arguments); 328 ArgumentListNode* arguments);
324 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); 329 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr);
325 330
326 // Support for parsing of scripts. 331 // Support for parsing of scripts.
327 void ParseTopLevel(); 332 void ParseTopLevel();
328 void ParseClassDeclaration(const GrowableObjectArray& pending_classes); 333 void ParseClassDeclaration(const GrowableObjectArray& pending_classes,
334 intptr_t metadata_pos);
329 void ParseClassDefinition(const Class& cls); 335 void ParseClassDefinition(const Class& cls);
330 void ParseMixinTypedef(const GrowableObjectArray& pending_classes); 336 void ParseMixinTypedef(const GrowableObjectArray& pending_classes);
331 void ParseTypedef(const GrowableObjectArray& pending_classes); 337 void ParseTypedef(const GrowableObjectArray& pending_classes);
332 void ParseTopLevelVariable(TopLevel* top_level); 338 void ParseTopLevelVariable(TopLevel* top_level, intptr_t metadata_pos);
333 void ParseTopLevelFunction(TopLevel* top_level); 339 void ParseTopLevelFunction(TopLevel* top_level, intptr_t metadata_pos);
334 void ParseTopLevelAccessor(TopLevel* top_level); 340 void ParseTopLevelAccessor(TopLevel* top_level, intptr_t metadata_pos);
341 RawArray* EvaluateMetadata();
335 342
336 // Support for parsing libraries. 343 // Support for parsing libraries.
337 RawObject* CallLibraryTagHandler(Dart_LibraryTag tag, 344 RawObject* CallLibraryTagHandler(Dart_LibraryTag tag,
338 intptr_t token_pos, 345 intptr_t token_pos,
339 const String& url); 346 const String& url);
340 void ParseIdentList(GrowableObjectArray* names); 347 void ParseIdentList(GrowableObjectArray* names);
341 void ParseLibraryDefinition(); 348 void ParseLibraryDefinition();
342 void ParseLibraryName(); 349 void ParseLibraryName();
343 void ParseLibraryImportExport(); 350 void ParseLibraryImportExport();
344 void ParseLibraryPart(); 351 void ParseLibraryPart();
345 void ParsePartHeader(); 352 void ParsePartHeader();
346 void ParseLibraryNameObsoleteSyntax(); 353 void ParseLibraryNameObsoleteSyntax();
347 void ParseLibraryImportObsoleteSyntax(); 354 void ParseLibraryImportObsoleteSyntax();
348 void ParseLibraryIncludeObsoleteSyntax(); 355 void ParseLibraryIncludeObsoleteSyntax();
349 356
350 void ResolveTypeFromClass(const Class& cls, 357 void ResolveTypeFromClass(const Class& cls,
351 ClassFinalizer::FinalizationKind finalization, 358 ClassFinalizer::FinalizationKind finalization,
352 AbstractType* type); 359 AbstractType* type);
353 RawAbstractType* ParseType(ClassFinalizer::FinalizationKind finalization); 360 RawAbstractType* ParseType(ClassFinalizer::FinalizationKind finalization);
354 void ParseTypeParameters(const Class& cls); 361 void ParseTypeParameters(const Class& cls);
355 RawAbstractTypeArguments* ParseTypeArguments( 362 RawAbstractTypeArguments* ParseTypeArguments(
356 Error* malformed_error, 363 Error* malformed_error,
357 ClassFinalizer::FinalizationKind finalization); 364 ClassFinalizer::FinalizationKind finalization);
358 void ParseQualIdent(QualIdent* qual_ident); 365 void ParseQualIdent(QualIdent* qual_ident);
359 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method); 366 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method);
360 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); 367 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field);
361 void ParseClassMemberDefinition(ClassDesc* members); 368 void ParseClassMemberDefinition(ClassDesc* members,
369 intptr_t metadata_pos);
362 void ParseFormalParameter(bool allow_explicit_default_value, 370 void ParseFormalParameter(bool allow_explicit_default_value,
363 ParamList* params); 371 ParamList* params);
364 void ParseFormalParameters(bool allow_explicit_default_values, 372 void ParseFormalParameters(bool allow_explicit_default_values,
365 ParamList* params); 373 ParamList* params);
366 void ParseFormalParameterList(bool allow_explicit_default_values, 374 void ParseFormalParameterList(bool allow_explicit_default_values,
367 ParamList* params); 375 ParamList* params);
368 void CheckConstFieldsInitialized(const Class& cls); 376 void CheckConstFieldsInitialized(const Class& cls);
369 void AddImplicitConstructor(const Class& cls); 377 void AddImplicitConstructor(const Class& cls);
370 void CheckConstructors(ClassDesc* members); 378 void CheckConstructors(ClassDesc* members);
371 AstNode* ParseExternalInitializedField(const Field& field); 379 AstNode* ParseExternalInitializedField(const Field& field);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 AstNode* ParsePrimary(); 523 AstNode* ParsePrimary();
516 AstNode* ParseStringLiteral(); 524 AstNode* ParseStringLiteral();
517 String* ParseImportStringLiteral(); 525 String* ParseImportStringLiteral();
518 AstNode* ParseCompoundLiteral(); 526 AstNode* ParseCompoundLiteral();
519 AstNode* ParseListLiteral(intptr_t type_pos, 527 AstNode* ParseListLiteral(intptr_t type_pos,
520 bool is_const, 528 bool is_const,
521 const AbstractTypeArguments& type_arguments); 529 const AbstractTypeArguments& type_arguments);
522 AstNode* ParseMapLiteral(intptr_t type_pos, 530 AstNode* ParseMapLiteral(intptr_t type_pos,
523 bool is_const, 531 bool is_const,
524 const AbstractTypeArguments& type_arguments); 532 const AbstractTypeArguments& type_arguments);
525 AstNode* ParseNewOperator(); 533 AstNode* ParseNewOperator(Token::Kind op_kind);
526 AstNode* ParseArgumentDefinitionTest(); 534 AstNode* ParseArgumentDefinitionTest();
527 535
528 // An implicit argument, if non-null, is prepended to the returned list. 536 // An implicit argument, if non-null, is prepended to the returned list.
529 ArgumentListNode* ParseActualParameters(ArgumentListNode* implicit_arguments, 537 ArgumentListNode* ParseActualParameters(ArgumentListNode* implicit_arguments,
530 bool require_const); 538 bool require_const);
531 AstNode* ParseStaticCall(const Class& cls, 539 AstNode* ParseStaticCall(const Class& cls,
532 const String& method_name, 540 const String& method_name,
533 intptr_t ident_pos); 541 intptr_t ident_pos);
534 AstNode* ParseInstanceCall(AstNode* receiver, const String& method_name); 542 AstNode* ParseInstanceCall(AstNode* receiver, const String& method_name);
535 AstNode* ParseClosureCall(AstNode* closure); 543 AstNode* ParseClosureCall(AstNode* closure);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 // code at all points in the try block where an exit from the block is 682 // code at all points in the try block where an exit from the block is
675 // done using 'return', 'break' or 'continue' statements. 683 // done using 'return', 'break' or 'continue' statements.
676 TryBlocks* try_blocks_list_; 684 TryBlocks* try_blocks_list_;
677 685
678 DISALLOW_COPY_AND_ASSIGN(Parser); 686 DISALLOW_COPY_AND_ASSIGN(Parser);
679 }; 687 };
680 688
681 } // namespace dart 689 } // namespace dart
682 690
683 #endif // VM_PARSER_H_ 691 #endif // VM_PARSER_H_
OLDNEW
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698