| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 kParameterEntrySize, | 226 kParameterEntrySize, |
| 227 }; | 227 }; |
| 228 static RawObject* ParseFunctionParameters(const Function& func); | 228 static RawObject* ParseFunctionParameters(const Function& func); |
| 229 | 229 |
| 230 private: | 230 private: |
| 231 friend class EffectGraphVisitor; // For BuildNoSuchMethodArguments. | 231 friend class EffectGraphVisitor; // For BuildNoSuchMethodArguments. |
| 232 | 232 |
| 233 struct Block; | 233 struct Block; |
| 234 class TryStack; | 234 class TryStack; |
| 235 | 235 |
| 236 Parser(const Script& script, const Library& library, intptr_t token_pos); | 236 Parser(const Script& script, |
| 237 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos); | 237 const Library& library, |
| 238 TokenPosition token_pos); |
| 239 Parser(const Script& script, |
| 240 ParsedFunction* function, |
| 241 TokenPosition token_pos); |
| 238 ~Parser(); | 242 ~Parser(); |
| 239 | 243 |
| 240 // The function for which we will generate code. | 244 // The function for which we will generate code. |
| 241 const Function& current_function() const; | 245 const Function& current_function() const; |
| 242 | 246 |
| 243 // The innermost function being parsed. | 247 // The innermost function being parsed. |
| 244 const Function& innermost_function() const; | 248 const Function& innermost_function() const; |
| 245 | 249 |
| 246 // Note that a local function may be parsed multiple times. It is first parsed | 250 // Note that a local function may be parsed multiple times. It is first parsed |
| 247 // when its outermost enclosing function is being parsed. It is then parsed | 251 // when its outermost enclosing function is being parsed. It is then parsed |
| (...skipping 19 matching lines...) Expand all Loading... |
| 267 // The class being parsed. | 271 // The class being parsed. |
| 268 const Class& current_class() const; | 272 const Class& current_class() const; |
| 269 void set_current_class(const Class& value); | 273 void set_current_class(const Class& value); |
| 270 | 274 |
| 271 // ParsedFunction accessor. | 275 // ParsedFunction accessor. |
| 272 ParsedFunction* parsed_function() const { | 276 ParsedFunction* parsed_function() const { |
| 273 return parsed_function_; | 277 return parsed_function_; |
| 274 } | 278 } |
| 275 | 279 |
| 276 const Script& script() const { return script_; } | 280 const Script& script() const { return script_; } |
| 277 void SetScript(const Script& script, intptr_t token_pos); | 281 void SetScript(const Script& script, TokenPosition token_pos); |
| 278 | 282 |
| 279 const Library& library() const { return library_; } | 283 const Library& library() const { return library_; } |
| 280 void set_library(const Library& value) const { library_ = value.raw(); } | 284 void set_library(const Library& value) const { library_ = value.raw(); } |
| 281 | 285 |
| 282 // Parsing a library or a regular source script. | 286 // Parsing a library or a regular source script. |
| 283 bool is_library_source() const { | 287 bool is_library_source() const { |
| 284 return (script_.kind() == RawScript::kScriptTag) || | 288 return (script_.kind() == RawScript::kScriptTag) || |
| 285 (script_.kind() == RawScript::kLibraryTag); | 289 (script_.kind() == RawScript::kLibraryTag); |
| 286 } | 290 } |
| 287 | 291 |
| 288 bool is_part_source() const { | 292 bool is_part_source() const { |
| 289 return script_.kind() == RawScript::kSourceTag; | 293 return script_.kind() == RawScript::kSourceTag; |
| 290 } | 294 } |
| 291 | 295 |
| 292 // Parsing library patch script. | 296 // Parsing library patch script. |
| 293 bool is_patch_source() const { | 297 bool is_patch_source() const { |
| 294 return script_.kind() == RawScript::kPatchTag; | 298 return script_.kind() == RawScript::kPatchTag; |
| 295 } | 299 } |
| 296 | 300 |
| 297 intptr_t TokenPos() const { return tokens_iterator_.CurrentPosition(); } | 301 TokenPosition TokenPos() const { |
| 298 intptr_t PrevTokenPos() const { return prev_token_pos_; } | 302 return tokens_iterator_.CurrentPosition(); |
| 303 } |
| 304 TokenPosition PrevTokenPos() const { return prev_token_pos_; } |
| 299 | 305 |
| 300 Token::Kind CurrentToken() { | 306 Token::Kind CurrentToken() { |
| 301 if (token_kind_ == Token::kILLEGAL) { | 307 if (token_kind_ == Token::kILLEGAL) { |
| 302 ComputeCurrentToken(); | 308 ComputeCurrentToken(); |
| 303 } | 309 } |
| 304 return token_kind_; | 310 return token_kind_; |
| 305 } | 311 } |
| 306 | 312 |
| 307 void ComputeCurrentToken(); | 313 void ComputeCurrentToken(); |
| 308 | 314 |
| 309 RawLibraryPrefix* ParsePrefix(); | 315 RawLibraryPrefix* ParsePrefix(); |
| 310 | 316 |
| 311 Token::Kind LookaheadToken(int num_tokens); | 317 Token::Kind LookaheadToken(int num_tokens); |
| 312 String* CurrentLiteral() const; | 318 String* CurrentLiteral() const; |
| 313 RawDouble* CurrentDoubleLiteral() const; | 319 RawDouble* CurrentDoubleLiteral() const; |
| 314 RawInteger* CurrentIntegerLiteral() const; | 320 RawInteger* CurrentIntegerLiteral() const; |
| 315 | 321 |
| 316 // Sets parser to given token position in the stream. | 322 // Sets parser to given token position in the stream. |
| 317 void SetPosition(intptr_t position); | 323 void SetPosition(TokenPosition position); |
| 318 | 324 |
| 319 void ConsumeToken() { | 325 void ConsumeToken() { |
| 320 // Reset cache and advance the token. | 326 // Reset cache and advance the token. |
| 321 prev_token_pos_ = tokens_iterator_.CurrentPosition(); | 327 prev_token_pos_ = tokens_iterator_.CurrentPosition(); |
| 322 token_kind_ = Token::kILLEGAL; | 328 token_kind_ = Token::kILLEGAL; |
| 323 tokens_iterator_.Advance(); | 329 tokens_iterator_.Advance(); |
| 324 INC_STAT(thread(), num_tokens_consumed, 1); | 330 INC_STAT(thread(), num_tokens_consumed, 1); |
| 325 } | 331 } |
| 326 void ConsumeRightAngleBracket(); | 332 void ConsumeRightAngleBracket(); |
| 327 void CheckToken(Token::Kind token_expected, const char* msg = NULL); | 333 void CheckToken(Token::Kind token_expected, const char* msg = NULL); |
| 328 void ExpectToken(Token::Kind token_expected); | 334 void ExpectToken(Token::Kind token_expected); |
| 329 void ExpectSemicolon(); | 335 void ExpectSemicolon(); |
| 330 void UnexpectedToken(); | 336 void UnexpectedToken(); |
| 331 String* ExpectUserDefinedTypeIdentifier(const char* msg); | 337 String* ExpectUserDefinedTypeIdentifier(const char* msg); |
| 332 String* ExpectIdentifier(const char* msg); | 338 String* ExpectIdentifier(const char* msg); |
| 333 bool IsAwaitKeyword(); | 339 bool IsAwaitKeyword(); |
| 334 bool IsYieldKeyword(); | 340 bool IsYieldKeyword(); |
| 335 | 341 |
| 336 void SkipIf(Token::Kind); | 342 void SkipIf(Token::Kind); |
| 337 void SkipToMatching(); | 343 void SkipToMatching(); |
| 338 void SkipToMatchingParenthesis(); | 344 void SkipToMatchingParenthesis(); |
| 339 void SkipBlock(); | 345 void SkipBlock(); |
| 340 intptr_t SkipMetadata(); | 346 TokenPosition SkipMetadata(); |
| 341 void SkipTypeArguments(); | 347 void SkipTypeArguments(); |
| 342 void SkipType(bool allow_void); | 348 void SkipType(bool allow_void); |
| 343 void SkipInitializers(); | 349 void SkipInitializers(); |
| 344 void SkipExpr(); | 350 void SkipExpr(); |
| 345 void SkipNestedExpr(); | 351 void SkipNestedExpr(); |
| 346 void SkipConditionalExpr(); | 352 void SkipConditionalExpr(); |
| 347 void SkipBinaryExpr(); | 353 void SkipBinaryExpr(); |
| 348 void SkipUnaryExpr(); | 354 void SkipUnaryExpr(); |
| 349 void SkipPostfixExpr(); | 355 void SkipPostfixExpr(); |
| 350 void SkipSelectors(); | 356 void SkipSelectors(); |
| 351 void SkipPrimary(); | 357 void SkipPrimary(); |
| 352 void SkipCompoundLiteral(); | 358 void SkipCompoundLiteral(); |
| 353 void SkipSymbolLiteral(); | 359 void SkipSymbolLiteral(); |
| 354 void SkipNewOperator(); | 360 void SkipNewOperator(); |
| 355 void SkipActualParameters(); | 361 void SkipActualParameters(); |
| 356 void SkipMapLiteral(); | 362 void SkipMapLiteral(); |
| 357 void SkipListLiteral(); | 363 void SkipListLiteral(); |
| 358 void SkipFunctionLiteral(); | 364 void SkipFunctionLiteral(); |
| 359 void SkipStringLiteral(); | 365 void SkipStringLiteral(); |
| 360 void SkipQualIdent(); | 366 void SkipQualIdent(); |
| 361 void SkipFunctionPreamble(); | 367 void SkipFunctionPreamble(); |
| 362 | 368 |
| 363 AstNode* DartPrint(const char* str); | 369 AstNode* DartPrint(const char* str); |
| 364 | 370 |
| 365 void CheckConstructorCallTypeArguments(intptr_t pos, | 371 void CheckConstructorCallTypeArguments(TokenPosition pos, |
| 366 const Function& constructor, | 372 const Function& constructor, |
| 367 const TypeArguments& type_arguments); | 373 const TypeArguments& type_arguments); |
| 368 | 374 |
| 369 // Report error if parsed code is too deeply nested; avoid stack overflow. | 375 // Report error if parsed code is too deeply nested; avoid stack overflow. |
| 370 void CheckStack(); | 376 void CheckStack(); |
| 371 | 377 |
| 372 // Report already formatted error. | 378 // Report already formatted error. |
| 373 static void ReportError(const Error& error); | 379 static void ReportError(const Error& error); |
| 374 | 380 |
| 375 // Concatenate and report an already formatted error and a new error message. | 381 // Concatenate and report an already formatted error and a new error message. |
| 376 static void ReportErrors(const Error& prev_error, | 382 static void ReportErrors(const Error& prev_error, |
| 377 const Script& script, intptr_t token_pos, | 383 const Script& script, TokenPosition token_pos, |
| 378 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); | 384 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); |
| 379 | 385 |
| 380 // Report error message at location of current token in current script. | 386 // Report error message at location of current token in current script. |
| 381 void ReportError(const char* msg, ...) const PRINTF_ATTRIBUTE(2, 3); | 387 void ReportError(const char* msg, ...) const PRINTF_ATTRIBUTE(2, 3); |
| 382 | 388 |
| 383 void ReportErrorBefore(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 389 void ReportErrorBefore(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
| 384 | 390 |
| 385 // Report error message at given location in current script. | 391 // Report error message at given location in current script. |
| 386 void ReportError(intptr_t token_pos, | 392 void ReportError(TokenPosition token_pos, |
| 387 const char* msg, ...) const PRINTF_ATTRIBUTE(3, 4); | 393 const char* msg, ...) const PRINTF_ATTRIBUTE(3, 4); |
| 388 | 394 |
| 389 // Report warning message at location of current token in current script. | 395 // Report warning message at location of current token in current script. |
| 390 void ReportWarning(const char* msg, ...) const PRINTF_ATTRIBUTE(2, 3); | 396 void ReportWarning(const char* msg, ...) const PRINTF_ATTRIBUTE(2, 3); |
| 391 | 397 |
| 392 // Report warning message at given location in current script. | 398 // Report warning message at given location in current script. |
| 393 void ReportWarning(intptr_t token_pos, | 399 void ReportWarning(TokenPosition token_pos, |
| 394 const char* msg, ...) const PRINTF_ATTRIBUTE(3, 4); | 400 const char* msg, ...) const PRINTF_ATTRIBUTE(3, 4); |
| 395 | 401 |
| 396 void CheckRecursiveInvocation(); | 402 void CheckRecursiveInvocation(); |
| 397 | 403 |
| 398 const Instance& EvaluateConstExpr(intptr_t expr_pos, AstNode* expr); | 404 const Instance& EvaluateConstExpr(TokenPosition expr_pos, AstNode* expr); |
| 399 StaticGetterNode* RunStaticFieldInitializer(const Field& field, | 405 StaticGetterNode* RunStaticFieldInitializer(const Field& field, |
| 400 intptr_t field_ref_pos); | 406 TokenPosition field_ref_pos); |
| 401 RawObject* EvaluateConstConstructorCall(const Class& type_class, | 407 RawObject* EvaluateConstConstructorCall(const Class& type_class, |
| 402 const TypeArguments& type_arguments, | 408 const TypeArguments& type_arguments, |
| 403 const Function& constructor, | 409 const Function& constructor, |
| 404 ArgumentListNode* arguments); | 410 ArgumentListNode* arguments); |
| 405 LiteralNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); | 411 LiteralNode* FoldConstExpr(TokenPosition expr_pos, AstNode* expr); |
| 406 | 412 |
| 407 // Support for parsing of scripts. | 413 // Support for parsing of scripts. |
| 408 void ParseTopLevel(); | 414 void ParseTopLevel(); |
| 409 void ParseEnumDeclaration(const GrowableObjectArray& pending_classes, | 415 void ParseEnumDeclaration(const GrowableObjectArray& pending_classes, |
| 410 const Object& tl_owner, | 416 const Object& tl_owner, |
| 411 intptr_t metadata_pos); | 417 TokenPosition metadata_pos); |
| 412 void ParseEnumDefinition(const Class& cls); | 418 void ParseEnumDefinition(const Class& cls); |
| 413 void ParseClassDeclaration(const GrowableObjectArray& pending_classes, | 419 void ParseClassDeclaration(const GrowableObjectArray& pending_classes, |
| 414 const Object& tl_owner, | 420 const Object& tl_owner, |
| 415 intptr_t metadata_pos); | 421 TokenPosition metadata_pos); |
| 416 void ParseClassDefinition(const Class& cls); | 422 void ParseClassDefinition(const Class& cls); |
| 417 void ParseMixinAppAlias(const GrowableObjectArray& pending_classes, | 423 void ParseMixinAppAlias(const GrowableObjectArray& pending_classes, |
| 418 const Object& tl_owner, | 424 const Object& tl_owner, |
| 419 intptr_t metadata_pos); | 425 TokenPosition metadata_pos); |
| 420 void ParseTypedef(const GrowableObjectArray& pending_classes, | 426 void ParseTypedef(const GrowableObjectArray& pending_classes, |
| 421 const Object& tl_owner, | 427 const Object& tl_owner, |
| 422 intptr_t metadata_pos); | 428 TokenPosition metadata_pos); |
| 423 void ParseTopLevelVariable(TopLevel* top_level, | 429 void ParseTopLevelVariable(TopLevel* top_level, |
| 424 const Object& owner, intptr_t metadata_pos); | 430 const Object& owner, TokenPosition metadata_pos); |
| 425 void ParseTopLevelFunction(TopLevel* top_level, | 431 void ParseTopLevelFunction(TopLevel* top_level, |
| 426 const Object& owner, intptr_t metadata_pos); | 432 const Object& owner, TokenPosition metadata_pos); |
| 427 void ParseTopLevelAccessor(TopLevel* top_level, | 433 void ParseTopLevelAccessor(TopLevel* top_level, |
| 428 const Object& owner, intptr_t metadata_pos); | 434 const Object& owner, TokenPosition metadata_pos); |
| 429 RawArray* EvaluateMetadata(); | 435 RawArray* EvaluateMetadata(); |
| 430 | 436 |
| 431 RawFunction::AsyncModifier ParseFunctionModifier(); | 437 RawFunction::AsyncModifier ParseFunctionModifier(); |
| 432 | 438 |
| 433 // Support for parsing libraries. | 439 // Support for parsing libraries. |
| 434 RawObject* CallLibraryTagHandler(Dart_LibraryTag tag, | 440 RawObject* CallLibraryTagHandler(Dart_LibraryTag tag, |
| 435 intptr_t token_pos, | 441 TokenPosition token_pos, |
| 436 const String& url); | 442 const String& url); |
| 437 void ParseIdentList(GrowableObjectArray* names); | 443 void ParseIdentList(GrowableObjectArray* names); |
| 438 void ParseLibraryDefinition(const Object& tl_owner); | 444 void ParseLibraryDefinition(const Object& tl_owner); |
| 439 void ParseLibraryName(); | 445 void ParseLibraryName(); |
| 440 void ParseLibraryImportExport(const Object& tl_owner, | 446 void ParseLibraryImportExport(const Object& tl_owner, |
| 441 intptr_t metadata_pos); | 447 TokenPosition metadata_pos); |
| 442 void ParseLibraryPart(); | 448 void ParseLibraryPart(); |
| 443 void ParsePartHeader(); | 449 void ParsePartHeader(); |
| 444 void ParseLibraryNameObsoleteSyntax(); | 450 void ParseLibraryNameObsoleteSyntax(); |
| 445 void ParseLibraryImportObsoleteSyntax(); | 451 void ParseLibraryImportObsoleteSyntax(); |
| 446 void ParseLibraryIncludeObsoleteSyntax(); | 452 void ParseLibraryIncludeObsoleteSyntax(); |
| 447 | 453 |
| 448 void ResolveTypeFromClass(const Class& cls, | 454 void ResolveTypeFromClass(const Class& cls, |
| 449 ClassFinalizer::FinalizationKind finalization, | 455 ClassFinalizer::FinalizationKind finalization, |
| 450 AbstractType* type); | 456 AbstractType* type); |
| 451 RawAbstractType* ParseType(ClassFinalizer::FinalizationKind finalization, | 457 RawAbstractType* ParseType(ClassFinalizer::FinalizationKind finalization, |
| 452 bool allow_deferred_type = false, | 458 bool allow_deferred_type = false, |
| 453 bool consume_unresolved_prefix = true); | 459 bool consume_unresolved_prefix = true); |
| 454 RawAbstractType* ParseType( | 460 RawAbstractType* ParseType( |
| 455 ClassFinalizer::FinalizationKind finalization, | 461 ClassFinalizer::FinalizationKind finalization, |
| 456 bool allow_deferred_type, | 462 bool allow_deferred_type, |
| 457 bool consume_unresolved_prefix, | 463 bool consume_unresolved_prefix, |
| 458 LibraryPrefix* prefix); | 464 LibraryPrefix* prefix); |
| 459 | 465 |
| 460 void ParseTypeParameters(const Class& cls); | 466 void ParseTypeParameters(const Class& cls); |
| 461 RawTypeArguments* ParseTypeArguments( | 467 RawTypeArguments* ParseTypeArguments( |
| 462 ClassFinalizer::FinalizationKind finalization); | 468 ClassFinalizer::FinalizationKind finalization); |
| 463 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method); | 469 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method); |
| 464 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); | 470 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); |
| 465 void CheckMemberNameConflict(ClassDesc* members, MemberDesc* member); | 471 void CheckMemberNameConflict(ClassDesc* members, MemberDesc* member); |
| 466 void ParseClassMemberDefinition(ClassDesc* members, | 472 void ParseClassMemberDefinition(ClassDesc* members, |
| 467 intptr_t metadata_pos); | 473 TokenPosition metadata_pos); |
| 468 void ParseFormalParameter(bool allow_explicit_default_value, | 474 void ParseFormalParameter(bool allow_explicit_default_value, |
| 469 bool evaluate_metadata, | 475 bool evaluate_metadata, |
| 470 ParamList* params); | 476 ParamList* params); |
| 471 void ParseFormalParameters(bool allow_explicit_default_values, | 477 void ParseFormalParameters(bool allow_explicit_default_values, |
| 472 bool evaluate_metadata, | 478 bool evaluate_metadata, |
| 473 ParamList* params); | 479 ParamList* params); |
| 474 void ParseFormalParameterList(bool allow_explicit_default_values, | 480 void ParseFormalParameterList(bool allow_explicit_default_values, |
| 475 bool evaluate_metadata, | 481 bool evaluate_metadata, |
| 476 ParamList* params); | 482 ParamList* params); |
| 477 void CheckFieldsInitialized(const Class& cls); | 483 void CheckFieldsInitialized(const Class& cls); |
| 478 void AddImplicitConstructor(const Class& cls); | 484 void AddImplicitConstructor(const Class& cls); |
| 479 void CheckConstructors(ClassDesc* members); | 485 void CheckConstructors(ClassDesc* members); |
| 480 AstNode* ParseExternalInitializedField(const Field& field); | 486 AstNode* ParseExternalInitializedField(const Field& field); |
| 481 void ParseInitializedInstanceFields( | 487 void ParseInitializedInstanceFields( |
| 482 const Class& cls, | 488 const Class& cls, |
| 483 LocalVariable* receiver, | 489 LocalVariable* receiver, |
| 484 GrowableArray<Field*>* initialized_fields); | 490 GrowableArray<Field*>* initialized_fields); |
| 485 AstNode* CheckDuplicateFieldInit( | 491 AstNode* CheckDuplicateFieldInit( |
| 486 intptr_t init_pos, | 492 TokenPosition init_pos, |
| 487 GrowableArray<Field*>* initialized_fields, | 493 GrowableArray<Field*>* initialized_fields, |
| 488 AstNode* instance, | 494 AstNode* instance, |
| 489 Field* field, | 495 Field* field, |
| 490 AstNode* init_value); | 496 AstNode* init_value); |
| 491 StaticCallNode* GenerateSuperConstructorCall( | 497 StaticCallNode* GenerateSuperConstructorCall( |
| 492 const Class& cls, | 498 const Class& cls, |
| 493 intptr_t supercall_pos, | 499 TokenPosition supercall_pos, |
| 494 LocalVariable* receiver, | 500 LocalVariable* receiver, |
| 495 ArgumentListNode* forwarding_args); | 501 ArgumentListNode* forwarding_args); |
| 496 StaticCallNode* ParseSuperInitializer( | 502 StaticCallNode* ParseSuperInitializer( |
| 497 const Class& cls, | 503 const Class& cls, |
| 498 LocalVariable* receiver); | 504 LocalVariable* receiver); |
| 499 AstNode* ParseInitializer(const Class& cls, | 505 AstNode* ParseInitializer(const Class& cls, |
| 500 LocalVariable* receiver, | 506 LocalVariable* receiver, |
| 501 GrowableArray<Field*>* initialized_fields); | 507 GrowableArray<Field*>* initialized_fields); |
| 502 void ParseConstructorRedirection(const Class& cls, LocalVariable* receiver); | 508 void ParseConstructorRedirection(const Class& cls, LocalVariable* receiver); |
| 503 void ParseInitializers(const Class& cls, | 509 void ParseInitializers(const Class& cls, |
| 504 LocalVariable* receiver, | 510 LocalVariable* receiver, |
| 505 GrowableArray<Field*>* initialized_fields); | 511 GrowableArray<Field*>* initialized_fields); |
| 506 String& ParseNativeDeclaration(); | 512 String& ParseNativeDeclaration(); |
| 507 void ParseInterfaceList(const Class& cls); | 513 void ParseInterfaceList(const Class& cls); |
| 508 RawAbstractType* ParseMixins(const AbstractType& super_type); | 514 RawAbstractType* ParseMixins(const AbstractType& super_type); |
| 509 static StaticCallNode* BuildInvocationMirrorAllocation( | 515 static StaticCallNode* BuildInvocationMirrorAllocation( |
| 510 intptr_t call_pos, | 516 TokenPosition call_pos, |
| 511 const String& function_name, | 517 const String& function_name, |
| 512 const ArgumentListNode& function_args, | 518 const ArgumentListNode& function_args, |
| 513 const LocalVariable* temp, | 519 const LocalVariable* temp, |
| 514 bool is_super_invocation); | 520 bool is_super_invocation); |
| 515 // Build arguments for a NoSuchMethodCall. If LocalVariable temp is not NULL, | 521 // Build arguments for a NoSuchMethodCall. If LocalVariable temp is not NULL, |
| 516 // the last argument is stored in temp. | 522 // the last argument is stored in temp. |
| 517 static ArgumentListNode* BuildNoSuchMethodArguments( | 523 static ArgumentListNode* BuildNoSuchMethodArguments( |
| 518 intptr_t call_pos, | 524 TokenPosition call_pos, |
| 519 const String& function_name, | 525 const String& function_name, |
| 520 const ArgumentListNode& function_args, | 526 const ArgumentListNode& function_args, |
| 521 const LocalVariable* temp, | 527 const LocalVariable* temp, |
| 522 bool is_super_invocation); | 528 bool is_super_invocation); |
| 523 RawFunction* GetSuperFunction(intptr_t token_pos, | 529 RawFunction* GetSuperFunction(TokenPosition token_pos, |
| 524 const String& name, | 530 const String& name, |
| 525 ArgumentListNode* arguments, | 531 ArgumentListNode* arguments, |
| 526 bool resolve_getter, | 532 bool resolve_getter, |
| 527 bool* is_no_such_method); | 533 bool* is_no_such_method); |
| 528 AstNode* ParseSuperCall(const String& function_name); | 534 AstNode* ParseSuperCall(const String& function_name); |
| 529 AstNode* ParseSuperFieldAccess(const String& field_name, intptr_t field_pos); | 535 AstNode* ParseSuperFieldAccess(const String& field_name, |
| 536 TokenPosition field_pos); |
| 530 AstNode* ParseSuperOperator(); | 537 AstNode* ParseSuperOperator(); |
| 531 AstNode* BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super); | 538 AstNode* BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super); |
| 532 | 539 |
| 533 static bool ParseFormalParameters(const Function& func, ParamList* params); | 540 static bool ParseFormalParameters(const Function& func, ParamList* params); |
| 534 | 541 |
| 535 void SetupDefaultsForOptionalParams(const ParamList& params); | 542 void SetupDefaultsForOptionalParams(const ParamList& params); |
| 536 ClosureNode* CreateImplicitClosureNode(const Function& func, | 543 ClosureNode* CreateImplicitClosureNode(const Function& func, |
| 537 intptr_t token_pos, | 544 TokenPosition token_pos, |
| 538 AstNode* receiver); | 545 AstNode* receiver); |
| 539 static void AddFormalParamsToFunction(const ParamList* params, | 546 static void AddFormalParamsToFunction(const ParamList* params, |
| 540 const Function& func); | 547 const Function& func); |
| 541 void AddFormalParamsToScope(const ParamList* params, LocalScope* scope); | 548 void AddFormalParamsToScope(const ParamList* params, LocalScope* scope); |
| 542 | 549 |
| 543 SequenceNode* ParseConstructor(const Function& func); | 550 SequenceNode* ParseConstructor(const Function& func); |
| 544 SequenceNode* ParseFunc(const Function& func, bool check_semicolon); | 551 SequenceNode* ParseFunc(const Function& func, bool check_semicolon); |
| 545 | 552 |
| 546 void ParseNativeFunctionBlock(const ParamList* params, const Function& func); | 553 void ParseNativeFunctionBlock(const ParamList* params, const Function& func); |
| 547 | 554 |
| 548 SequenceNode* ParseInstanceGetter(const Function& func); | 555 SequenceNode* ParseInstanceGetter(const Function& func); |
| 549 SequenceNode* ParseInstanceSetter(const Function& func); | 556 SequenceNode* ParseInstanceSetter(const Function& func); |
| 550 SequenceNode* ParseStaticFinalGetter(const Function& func); | 557 SequenceNode* ParseStaticFinalGetter(const Function& func); |
| 551 SequenceNode* ParseStaticInitializer(); | 558 SequenceNode* ParseStaticInitializer(); |
| 552 SequenceNode* ParseMethodExtractor(const Function& func); | 559 SequenceNode* ParseMethodExtractor(const Function& func); |
| 553 SequenceNode* ParseNoSuchMethodDispatcher(const Function& func); | 560 SequenceNode* ParseNoSuchMethodDispatcher(const Function& func); |
| 554 SequenceNode* ParseInvokeFieldDispatcher(const Function& func); | 561 SequenceNode* ParseInvokeFieldDispatcher(const Function& func); |
| 555 SequenceNode* ParseImplicitClosure(const Function& func); | 562 SequenceNode* ParseImplicitClosure(const Function& func); |
| 556 SequenceNode* ParseConstructorClosure(const Function& func); | 563 SequenceNode* ParseConstructorClosure(const Function& func); |
| 557 | 564 |
| 558 void BuildDispatcherScope(const Function& func, | 565 void BuildDispatcherScope(const Function& func, |
| 559 const ArgumentsDescriptor& desc); | 566 const ArgumentsDescriptor& desc); |
| 560 | 567 |
| 561 void EnsureHasReturnStatement(SequenceNode* seq, intptr_t return_pos); | 568 void EnsureHasReturnStatement(SequenceNode* seq, TokenPosition return_pos); |
| 562 void ChainNewBlock(LocalScope* outer_scope); | 569 void ChainNewBlock(LocalScope* outer_scope); |
| 563 void OpenBlock(); | 570 void OpenBlock(); |
| 564 void OpenLoopBlock(); | 571 void OpenLoopBlock(); |
| 565 void OpenFunctionBlock(const Function& func); | 572 void OpenFunctionBlock(const Function& func); |
| 566 void OpenAsyncClosure(); | 573 void OpenAsyncClosure(); |
| 567 RawFunction* OpenAsyncFunction(intptr_t formal_param_pos); | 574 RawFunction* OpenAsyncFunction(TokenPosition formal_param_pos); |
| 568 RawFunction* OpenSyncGeneratorFunction(intptr_t func_pos); | 575 RawFunction* OpenSyncGeneratorFunction(TokenPosition func_pos); |
| 569 SequenceNode* CloseSyncGenFunction(const Function& closure, | 576 SequenceNode* CloseSyncGenFunction(const Function& closure, |
| 570 SequenceNode* closure_node); | 577 SequenceNode* closure_node); |
| 571 void AddSyncGenClosureParameters(ParamList* params); | 578 void AddSyncGenClosureParameters(ParamList* params); |
| 572 void AddAsyncGenClosureParameters(ParamList* params); | 579 void AddAsyncGenClosureParameters(ParamList* params); |
| 573 | 580 |
| 574 // Support for async* functions. | 581 // Support for async* functions. |
| 575 RawFunction* OpenAsyncGeneratorFunction(intptr_t func_pos); | 582 RawFunction* OpenAsyncGeneratorFunction(TokenPosition func_pos); |
| 576 SequenceNode* CloseAsyncGeneratorFunction(const Function& closure, | 583 SequenceNode* CloseAsyncGeneratorFunction(const Function& closure, |
| 577 SequenceNode* closure_node); | 584 SequenceNode* closure_node); |
| 578 void OpenAsyncGeneratorClosure(); | 585 void OpenAsyncGeneratorClosure(); |
| 579 SequenceNode* CloseAsyncGeneratorClosure(SequenceNode* body); | 586 SequenceNode* CloseAsyncGeneratorClosure(SequenceNode* body); |
| 580 | 587 |
| 581 void OpenAsyncTryBlock(); | 588 void OpenAsyncTryBlock(); |
| 582 SequenceNode* CloseBlock(); | 589 SequenceNode* CloseBlock(); |
| 583 SequenceNode* CloseAsyncFunction(const Function& closure, | 590 SequenceNode* CloseAsyncFunction(const Function& closure, |
| 584 SequenceNode* closure_node); | 591 SequenceNode* closure_node); |
| 585 | 592 |
| 586 SequenceNode* CloseAsyncClosure(SequenceNode* body); | 593 SequenceNode* CloseAsyncClosure(SequenceNode* body); |
| 587 SequenceNode* CloseAsyncTryBlock(SequenceNode* try_block); | 594 SequenceNode* CloseAsyncTryBlock(SequenceNode* try_block); |
| 588 SequenceNode* CloseAsyncGeneratorTryBlock(SequenceNode *body); | 595 SequenceNode* CloseAsyncGeneratorTryBlock(SequenceNode *body); |
| 589 | 596 |
| 590 void AddAsyncClosureParameters(ParamList* params); | 597 void AddAsyncClosureParameters(ParamList* params); |
| 591 void AddContinuationVariables(); | 598 void AddContinuationVariables(); |
| 592 void AddAsyncClosureVariables(); | 599 void AddAsyncClosureVariables(); |
| 593 void AddAsyncGeneratorVariables(); | 600 void AddAsyncGeneratorVariables(); |
| 594 | 601 |
| 595 LocalVariable* LookupReceiver(LocalScope* from_scope, bool test_only); | 602 LocalVariable* LookupReceiver(LocalScope* from_scope, bool test_only); |
| 596 LocalVariable* LookupTypeArgumentsParameter(LocalScope* from_scope, | 603 LocalVariable* LookupTypeArgumentsParameter(LocalScope* from_scope, |
| 597 bool test_only); | 604 bool test_only); |
| 598 void CaptureInstantiator(); | 605 void CaptureInstantiator(); |
| 599 AstNode* LoadReceiver(intptr_t token_pos); | 606 AstNode* LoadReceiver(TokenPosition token_pos); |
| 600 AstNode* LoadFieldIfUnresolved(AstNode* node); | 607 AstNode* LoadFieldIfUnresolved(AstNode* node); |
| 601 AstNode* LoadClosure(PrimaryNode* primary); | 608 AstNode* LoadClosure(PrimaryNode* primary); |
| 602 InstanceGetterNode* CallGetter(intptr_t token_pos, | 609 InstanceGetterNode* CallGetter(TokenPosition token_pos, |
| 603 AstNode* object, | 610 AstNode* object, |
| 604 const String& name); | 611 const String& name); |
| 605 | 612 |
| 606 AstNode* ParseAssertStatement(); | 613 AstNode* ParseAssertStatement(); |
| 607 AstNode* ParseJump(String* label_name); | 614 AstNode* ParseJump(String* label_name); |
| 608 AstNode* ParseIfStatement(String* label_name); | 615 AstNode* ParseIfStatement(String* label_name); |
| 609 AstNode* ParseWhileStatement(String* label_name); | 616 AstNode* ParseWhileStatement(String* label_name); |
| 610 AstNode* ParseDoWhileStatement(String* label_name); | 617 AstNode* ParseDoWhileStatement(String* label_name); |
| 611 AstNode* ParseForStatement(String* label_name); | 618 AstNode* ParseForStatement(String* label_name); |
| 612 AstNode* ParseAwaitForStatement(String* label_name); | 619 AstNode* ParseAwaitForStatement(String* label_name); |
| 613 AstNode* ParseForInStatement(intptr_t forin_pos, SourceLabel* label); | 620 AstNode* ParseForInStatement(TokenPosition forin_pos, SourceLabel* label); |
| 614 RawClass* CheckCaseExpressions(const GrowableArray<LiteralNode*>& values); | 621 RawClass* CheckCaseExpressions(const GrowableArray<LiteralNode*>& values); |
| 615 CaseNode* ParseCaseClause(LocalVariable* switch_expr_value, | 622 CaseNode* ParseCaseClause(LocalVariable* switch_expr_value, |
| 616 GrowableArray<LiteralNode*>* case_expr_values, | 623 GrowableArray<LiteralNode*>* case_expr_values, |
| 617 SourceLabel* case_label); | 624 SourceLabel* case_label); |
| 618 AstNode* ParseSwitchStatement(String* label_name); | 625 AstNode* ParseSwitchStatement(String* label_name); |
| 619 | 626 |
| 620 // try/catch/finally parsing. | 627 // try/catch/finally parsing. |
| 621 void AddCatchParamsToScope(CatchParamDesc* exception_param, | 628 void AddCatchParamsToScope(CatchParamDesc* exception_param, |
| 622 CatchParamDesc* stack_trace_param, | 629 CatchParamDesc* stack_trace_param, |
| 623 LocalScope* scope); | 630 LocalScope* scope); |
| 624 void SetupExceptionVariables(LocalScope* try_scope, | 631 void SetupExceptionVariables(LocalScope* try_scope, |
| 625 bool is_async, | 632 bool is_async, |
| 626 LocalVariable** context_var, | 633 LocalVariable** context_var, |
| 627 LocalVariable** exception_var, | 634 LocalVariable** exception_var, |
| 628 LocalVariable** stack_trace_var, | 635 LocalVariable** stack_trace_var, |
| 629 LocalVariable** saved_exception_var, | 636 LocalVariable** saved_exception_var, |
| 630 LocalVariable** saved_stack_trace_var); | 637 LocalVariable** saved_stack_trace_var); |
| 631 void SaveExceptionAndStacktrace(SequenceNode* statements, | 638 void SaveExceptionAndStacktrace(SequenceNode* statements, |
| 632 LocalVariable* exception_var, | 639 LocalVariable* exception_var, |
| 633 LocalVariable* stack_trace_var, | 640 LocalVariable* stack_trace_var, |
| 634 LocalVariable* saved_exception_var, | 641 LocalVariable* saved_exception_var, |
| 635 LocalVariable* saved_stack_trace_var); | 642 LocalVariable* saved_stack_trace_var); |
| 636 // Parse all the catch clause of a try. | 643 // Parse all the catch clause of a try. |
| 637 SequenceNode* ParseCatchClauses(intptr_t handler_pos, | 644 SequenceNode* ParseCatchClauses(TokenPosition handler_pos, |
| 638 bool is_async, | 645 bool is_async, |
| 639 LocalVariable* exception_var, | 646 LocalVariable* exception_var, |
| 640 LocalVariable* stack_trace_var, | 647 LocalVariable* stack_trace_var, |
| 641 LocalVariable* rethrow_exception_var, | 648 LocalVariable* rethrow_exception_var, |
| 642 LocalVariable* rethrow_stack_trace_var, | 649 LocalVariable* rethrow_stack_trace_var, |
| 643 const GrowableObjectArray& handler_types, | 650 const GrowableObjectArray& handler_types, |
| 644 bool* needs_stack_trace); | 651 bool* needs_stack_trace); |
| 645 // Parse or generate a finally clause. | 652 // Parse or generate a finally clause. |
| 646 SequenceNode* EnsureFinallyClause(bool parse, | 653 SequenceNode* EnsureFinallyClause(bool parse, |
| 647 bool is_async, | 654 bool is_async, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 AstNode* ParseUnaryExpr(); | 717 AstNode* ParseUnaryExpr(); |
| 711 AstNode* ParsePostfixExpr(); | 718 AstNode* ParsePostfixExpr(); |
| 712 AstNode* ParseSelectors(AstNode* primary, bool is_cascade); | 719 AstNode* ParseSelectors(AstNode* primary, bool is_cascade); |
| 713 AstNode* ParseClosurization(AstNode* primary); | 720 AstNode* ParseClosurization(AstNode* primary); |
| 714 AstNode* ParseCascades(AstNode* expr); | 721 AstNode* ParseCascades(AstNode* expr); |
| 715 AstNode* ParsePrimary(); | 722 AstNode* ParsePrimary(); |
| 716 AstNode* ParseStringLiteral(bool allow_interpolation); | 723 AstNode* ParseStringLiteral(bool allow_interpolation); |
| 717 String* ParseImportStringLiteral(); | 724 String* ParseImportStringLiteral(); |
| 718 AstNode* ParseCompoundLiteral(); | 725 AstNode* ParseCompoundLiteral(); |
| 719 AstNode* ParseSymbolLiteral(); | 726 AstNode* ParseSymbolLiteral(); |
| 720 AstNode* ParseListLiteral(intptr_t type_pos, | 727 AstNode* ParseListLiteral(TokenPosition type_pos, |
| 721 bool is_const, | 728 bool is_const, |
| 722 const TypeArguments& type_arguments); | 729 const TypeArguments& type_arguments); |
| 723 AstNode* ParseMapLiteral(intptr_t type_pos, | 730 AstNode* ParseMapLiteral(TokenPosition type_pos, |
| 724 bool is_const, | 731 bool is_const, |
| 725 const TypeArguments& type_arguments); | 732 const TypeArguments& type_arguments); |
| 726 | 733 |
| 727 RawFunction* BuildConstructorClosureFunction(const Function& ctr, | 734 RawFunction* BuildConstructorClosureFunction(const Function& ctr, |
| 728 intptr_t token_pos); | 735 TokenPosition token_pos); |
| 729 AstNode* ParseNewOperator(Token::Kind op_kind); | 736 AstNode* ParseNewOperator(Token::Kind op_kind); |
| 730 void ParseConstructorClosurization(Function* constructor, | 737 void ParseConstructorClosurization(Function* constructor, |
| 731 TypeArguments* type_arguments); | 738 TypeArguments* type_arguments); |
| 732 | 739 |
| 733 // An implicit argument, if non-null, is prepended to the returned list. | 740 // An implicit argument, if non-null, is prepended to the returned list. |
| 734 ArgumentListNode* ParseActualParameters(ArgumentListNode* implicit_arguments, | 741 ArgumentListNode* ParseActualParameters(ArgumentListNode* implicit_arguments, |
| 735 bool require_const); | 742 bool require_const); |
| 736 AstNode* ParseStaticCall(const Class& cls, | 743 AstNode* ParseStaticCall(const Class& cls, |
| 737 const String& method_name, | 744 const String& method_name, |
| 738 intptr_t ident_pos); | 745 TokenPosition ident_pos); |
| 739 AstNode* ParseInstanceCall(AstNode* receiver, | 746 AstNode* ParseInstanceCall(AstNode* receiver, |
| 740 const String& method_name, | 747 const String& method_name, |
| 741 intptr_t ident_pos, | 748 TokenPosition ident_pos, |
| 742 bool is_conditional); | 749 bool is_conditional); |
| 743 AstNode* ParseClosureCall(AstNode* closure); | 750 AstNode* ParseClosureCall(AstNode* closure); |
| 744 AstNode* GenerateStaticFieldLookup(const Field& field, | 751 AstNode* GenerateStaticFieldLookup(const Field& field, |
| 745 intptr_t ident_pos); | 752 TokenPosition ident_pos); |
| 746 AstNode* GenerateStaticFieldAccess(const Class& cls, | 753 AstNode* GenerateStaticFieldAccess(const Class& cls, |
| 747 const String& field_name, | 754 const String& field_name, |
| 748 intptr_t ident_pos); | 755 TokenPosition ident_pos); |
| 749 | 756 |
| 750 LocalVariable* LookupLocalScope(const String& ident); | 757 LocalVariable* LookupLocalScope(const String& ident); |
| 751 void CheckInstanceFieldAccess(intptr_t field_pos, const String& field_name); | 758 void CheckInstanceFieldAccess(TokenPosition field_pos, |
| 759 const String& field_name); |
| 752 bool ParsingStaticMember() const; | 760 bool ParsingStaticMember() const; |
| 753 const AbstractType* ReceiverType(const Class& cls); | 761 const AbstractType* ReceiverType(const Class& cls); |
| 754 bool IsInstantiatorRequired() const; | 762 bool IsInstantiatorRequired() const; |
| 755 bool ResolveIdentInLocalScope(intptr_t ident_pos, | 763 bool ResolveIdentInLocalScope(TokenPosition ident_pos, |
| 756 const String &ident, | 764 const String &ident, |
| 757 AstNode** node); | 765 AstNode** node); |
| 758 static const bool kResolveLocally = true; | 766 static const bool kResolveLocally = true; |
| 759 static const bool kResolveIncludingImports = false; | 767 static const bool kResolveIncludingImports = false; |
| 760 | 768 |
| 761 // Resolve a primary identifier in the library or prefix scope and | 769 // Resolve a primary identifier in the library or prefix scope and |
| 762 // generate the corresponding AstNode. | 770 // generate the corresponding AstNode. |
| 763 AstNode* ResolveIdentInCurrentLibraryScope(intptr_t ident_pos, | 771 AstNode* ResolveIdentInCurrentLibraryScope(TokenPosition ident_pos, |
| 764 const String& ident); | 772 const String& ident); |
| 765 AstNode* ResolveIdentInPrefixScope(intptr_t ident_pos, | 773 AstNode* ResolveIdentInPrefixScope(TokenPosition ident_pos, |
| 766 const LibraryPrefix& prefix, | 774 const LibraryPrefix& prefix, |
| 767 const String& ident); | 775 const String& ident); |
| 768 | 776 |
| 769 AstNode* ResolveIdent(intptr_t ident_pos, | 777 AstNode* ResolveIdent(TokenPosition ident_pos, |
| 770 const String& ident, | 778 const String& ident, |
| 771 bool allow_closure_names); | 779 bool allow_closure_names); |
| 772 RawString* ResolveImportVar(intptr_t ident_pos, const String& ident); | 780 RawString* ResolveImportVar(TokenPosition ident_pos, const String& ident); |
| 773 AstNode* OptimizeBinaryOpNode(intptr_t op_pos, | 781 AstNode* OptimizeBinaryOpNode(TokenPosition op_pos, |
| 774 Token::Kind binary_op, | 782 Token::Kind binary_op, |
| 775 AstNode* lhs, | 783 AstNode* lhs, |
| 776 AstNode* rhs); | 784 AstNode* rhs); |
| 777 AstNode* ExpandAssignableOp(intptr_t op_pos, | 785 AstNode* ExpandAssignableOp(TokenPosition op_pos, |
| 778 Token::Kind assignment_op, | 786 Token::Kind assignment_op, |
| 779 AstNode* lhs, | 787 AstNode* lhs, |
| 780 AstNode* rhs); | 788 AstNode* rhs); |
| 781 LetNode* PrepareCompoundAssignmentNodes(AstNode** expr); | 789 LetNode* PrepareCompoundAssignmentNodes(AstNode** expr); |
| 782 LocalVariable* CreateTempConstVariable(intptr_t token_pos, const char* s); | 790 LocalVariable* CreateTempConstVariable(TokenPosition token_pos, |
| 791 const char* s); |
| 783 | 792 |
| 784 static SequenceNode* NodeAsSequenceNode(intptr_t sequence_pos, | 793 static SequenceNode* NodeAsSequenceNode(TokenPosition sequence_pos, |
| 785 AstNode* node, | 794 AstNode* node, |
| 786 LocalScope* scope); | 795 LocalScope* scope); |
| 787 | 796 |
| 788 SequenceNode* MakeImplicitConstructor(const Function& func); | 797 SequenceNode* MakeImplicitConstructor(const Function& func); |
| 789 AstNode* MakeStaticCall(const String& cls_name, | 798 AstNode* MakeStaticCall(const String& cls_name, |
| 790 const String& func_name, | 799 const String& func_name, |
| 791 ArgumentListNode* arguments); | 800 ArgumentListNode* arguments); |
| 792 String& Interpolate(const GrowableArray<AstNode*>& values); | 801 String& Interpolate(const GrowableArray<AstNode*>& values); |
| 793 AstNode* MakeAssertCall(intptr_t begin, intptr_t end); | 802 AstNode* MakeAssertCall(TokenPosition begin, TokenPosition end); |
| 794 AstNode* ThrowTypeError(intptr_t type_pos, const AbstractType& type, | 803 AstNode* ThrowTypeError(TokenPosition type_pos, |
| 795 LibraryPrefix* prefix = NULL); | 804 const AbstractType& type, |
| 796 AstNode* ThrowNoSuchMethodError(intptr_t call_pos, | 805 LibraryPrefix* prefix = NULL); |
| 806 AstNode* ThrowNoSuchMethodError(TokenPosition call_pos, |
| 797 const Class& cls, | 807 const Class& cls, |
| 798 const String& function_name, | 808 const String& function_name, |
| 799 ArgumentListNode* function_arguments, | 809 ArgumentListNode* function_arguments, |
| 800 InvocationMirror::Call call, | 810 InvocationMirror::Call call, |
| 801 InvocationMirror::Type type, | 811 InvocationMirror::Type type, |
| 802 const Function* func, | 812 const Function* func, |
| 803 const LibraryPrefix* prefix = NULL); | 813 const LibraryPrefix* prefix = NULL); |
| 804 | 814 |
| 805 void SetupSavedTryContext(LocalVariable* saved_try_context); | 815 void SetupSavedTryContext(LocalVariable* saved_try_context); |
| 806 | 816 |
| 807 void CheckOperatorArity(const MemberDesc& member); | 817 void CheckOperatorArity(const MemberDesc& member); |
| 808 | 818 |
| 809 void EnsureExpressionTemp(); | 819 void EnsureExpressionTemp(); |
| 810 bool IsLegalAssignableSyntax(AstNode* expr, intptr_t end_pos); | 820 bool IsLegalAssignableSyntax(AstNode* expr, TokenPosition end_pos); |
| 811 AstNode* CreateAssignmentNode(AstNode* original, | 821 AstNode* CreateAssignmentNode(AstNode* original, |
| 812 AstNode* rhs, | 822 AstNode* rhs, |
| 813 const String* left_ident, | 823 const String* left_ident, |
| 814 intptr_t left_pos, | 824 TokenPosition left_pos, |
| 815 bool is_compound = false); | 825 bool is_compound = false); |
| 816 AstNode* InsertClosureCallNodes(AstNode* condition); | 826 AstNode* InsertClosureCallNodes(AstNode* condition); |
| 817 | 827 |
| 818 ConstructorCallNode* CreateConstructorCallNode( | 828 ConstructorCallNode* CreateConstructorCallNode( |
| 819 intptr_t token_pos, | 829 TokenPosition token_pos, |
| 820 const TypeArguments& type_arguments, | 830 const TypeArguments& type_arguments, |
| 821 const Function& constructor, | 831 const Function& constructor, |
| 822 ArgumentListNode* arguments); | 832 ArgumentListNode* arguments); |
| 823 | 833 |
| 824 void AddEqualityNullCheck(); | 834 void AddEqualityNullCheck(); |
| 825 | 835 |
| 826 AstNode* BuildClosureCall(intptr_t token_pos, | 836 AstNode* BuildClosureCall(TokenPosition token_pos, |
| 827 AstNode* closure, | 837 AstNode* closure, |
| 828 ArgumentListNode* arguments); | 838 ArgumentListNode* arguments); |
| 829 | 839 |
| 830 RawInstance* TryCanonicalize(const Instance& instance, intptr_t token_pos); | 840 RawInstance* TryCanonicalize(const Instance& instance, |
| 831 void CacheConstantValue(intptr_t token_pos, const Instance& value); | 841 TokenPosition token_pos); |
| 832 bool GetCachedConstant(intptr_t token_pos, Instance* value); | 842 void CacheConstantValue(TokenPosition token_pos, const Instance& value); |
| 843 bool GetCachedConstant(TokenPosition token_pos, Instance* value); |
| 833 | 844 |
| 834 Thread* thread() const { return thread_; } | 845 Thread* thread() const { return thread_; } |
| 835 Isolate* isolate() const { return isolate_; } | 846 Isolate* isolate() const { return isolate_; } |
| 836 Zone* zone() const { return thread_->zone(); } | 847 Zone* zone() const { return thread_->zone(); } |
| 837 | 848 |
| 838 Isolate* isolate_; // Cached current isolate. | 849 Isolate* isolate_; // Cached current isolate. |
| 839 Thread* thread_; | 850 Thread* thread_; |
| 840 | 851 |
| 841 Script& script_; | 852 Script& script_; |
| 842 TokenStream::Iterator tokens_iterator_; | 853 TokenStream::Iterator tokens_iterator_; |
| 843 Token::Kind token_kind_; // Cached token kind for current token. | 854 Token::Kind token_kind_; // Cached token kind for current token. |
| 844 intptr_t prev_token_pos_; | 855 TokenPosition prev_token_pos_; |
| 845 Block* current_block_; | 856 Block* current_block_; |
| 846 | 857 |
| 847 // is_top_level_ is true if parsing the "top level" of a compilation unit, | 858 // is_top_level_ is true if parsing the "top level" of a compilation unit, |
| 848 // that is class definitions, function type aliases, global functions, | 859 // that is class definitions, function type aliases, global functions, |
| 849 // global variables. | 860 // global variables. |
| 850 bool is_top_level_; | 861 bool is_top_level_; |
| 851 | 862 |
| 852 // await_is_keyword_ is true if we are parsing an async or generator | 863 // await_is_keyword_ is true if we are parsing an async or generator |
| 853 // function. In this context the identifiers await, async and yield | 864 // function. In this context the identifiers await, async and yield |
| 854 // are treated as keywords. | 865 // are treated as keywords. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 | 911 |
| 901 intptr_t recursion_counter_; | 912 intptr_t recursion_counter_; |
| 902 friend class RecursionChecker; | 913 friend class RecursionChecker; |
| 903 | 914 |
| 904 DISALLOW_COPY_AND_ASSIGN(Parser); | 915 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 905 }; | 916 }; |
| 906 | 917 |
| 907 } // namespace dart | 918 } // namespace dart |
| 908 | 919 |
| 909 #endif // VM_PARSER_H_ | 920 #endif // VM_PARSER_H_ |
| OLD | NEW |