| Index: runtime/vm/parser.cc
|
| diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
|
| index bd6eec9734317bf05ff31c53df9acc3f6d5f20bc..36c5a33d919ce5388bbf93543476dc30f860c6f6 100644
|
| --- a/runtime/vm/parser.cc
|
| +++ b/runtime/vm/parser.cc
|
| @@ -124,7 +124,6 @@ class TraceParser : public ValueObject {
|
| intptr_t* indent_;
|
| };
|
|
|
| -
|
| #define TRACE_PARSER(s) \
|
| TraceParser __p__(this->TokenPos(), this->script_, &this->trace_indent_, s)
|
|
|
| @@ -132,7 +131,6 @@ class TraceParser : public ValueObject {
|
| #define TRACE_PARSER(s)
|
| #endif // DEBUG
|
|
|
| -
|
| class BoolScope : public ValueObject {
|
| public:
|
| BoolScope(bool* addr, bool new_value) : _addr(addr), _saved_value(*addr) {
|
| @@ -145,7 +143,6 @@ class BoolScope : public ValueObject {
|
| bool _saved_value;
|
| };
|
|
|
| -
|
| // Helper class to save and restore token position.
|
| class Parser::TokenPosScope : public ValueObject {
|
| public:
|
| @@ -159,7 +156,6 @@ class Parser::TokenPosScope : public ValueObject {
|
| DISALLOW_COPY_AND_ASSIGN(TokenPosScope);
|
| };
|
|
|
| -
|
| class RecursionChecker : public ValueObject {
|
| public:
|
| explicit RecursionChecker(Parser* p) : parser_(p) {
|
| @@ -178,7 +174,6 @@ class RecursionChecker : public ValueObject {
|
| Parser* parser_;
|
| };
|
|
|
| -
|
| static RawTypeArguments* NewTypeArguments(
|
| const GrowableArray<AbstractType*>& objs) {
|
| const TypeArguments& a =
|
| @@ -191,7 +186,6 @@ static RawTypeArguments* NewTypeArguments(
|
| return a.raw();
|
| }
|
|
|
| -
|
| void ParsedFunction::AddToGuardedFields(const Field* field) const {
|
| if ((field->guarded_cid() == kDynamicCid) ||
|
| (field->guarded_cid() == kIllegalCid)) {
|
| @@ -223,7 +217,6 @@ void ParsedFunction::AddToGuardedFields(const Field* field) const {
|
| guarded_fields_->Add(&Field::ZoneHandle(Z, field->raw()));
|
| }
|
|
|
| -
|
| void ParsedFunction::Bailout(const char* origin, const char* reason) const {
|
| Report::MessageF(Report::kBailout, Script::Handle(function_.script()),
|
| function_.token_pos(), Report::AtLocation,
|
| @@ -232,7 +225,6 @@ void ParsedFunction::Bailout(const char* origin, const char* reason) const {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| kernel::ScopeBuildingResult* ParsedFunction::EnsureKernelScopes() {
|
| if (kernel_scopes_ == NULL) {
|
| intptr_t kernel_offset = function().kernel_offset();
|
| @@ -244,7 +236,6 @@ kernel::ScopeBuildingResult* ParsedFunction::EnsureKernelScopes() {
|
| return kernel_scopes_;
|
| }
|
|
|
| -
|
| LocalVariable* ParsedFunction::EnsureExpressionTemp() {
|
| if (!has_expression_temp_var()) {
|
| LocalVariable* temp =
|
| @@ -257,7 +248,6 @@ LocalVariable* ParsedFunction::EnsureExpressionTemp() {
|
| return expression_temp_var();
|
| }
|
|
|
| -
|
| void ParsedFunction::EnsureFinallyReturnTemp(bool is_async) {
|
| if (!has_finally_return_temp_var()) {
|
| LocalVariable* temp =
|
| @@ -273,14 +263,12 @@ void ParsedFunction::EnsureFinallyReturnTemp(bool is_async) {
|
| ASSERT(has_finally_return_temp_var());
|
| }
|
|
|
| -
|
| void ParsedFunction::SetNodeSequence(SequenceNode* node_sequence) {
|
| ASSERT(node_sequence_ == NULL);
|
| ASSERT(node_sequence != NULL);
|
| node_sequence_ = node_sequence;
|
| }
|
|
|
| -
|
| void ParsedFunction::SetRegExpCompileData(
|
| RegExpCompileData* regexp_compile_data) {
|
| ASSERT(regexp_compile_data_ == NULL);
|
| @@ -288,7 +276,6 @@ void ParsedFunction::SetRegExpCompileData(
|
| regexp_compile_data_ = regexp_compile_data;
|
| }
|
|
|
| -
|
| void ParsedFunction::AddDeferredPrefix(const LibraryPrefix& prefix) {
|
| // 'deferred_prefixes_' are used to invalidate code, but no invalidation is
|
| // needed if --load_deferred_eagerly.
|
| @@ -303,7 +290,6 @@ void ParsedFunction::AddDeferredPrefix(const LibraryPrefix& prefix) {
|
| deferred_prefixes_->Add(&LibraryPrefix::ZoneHandle(Z, prefix.raw()));
|
| }
|
|
|
| -
|
| void ParsedFunction::AllocateVariables() {
|
| ASSERT(!function().IsIrregexpFunction());
|
| LocalScope* scope = node_sequence()->scope();
|
| @@ -338,7 +324,6 @@ void ParsedFunction::AllocateVariables() {
|
| num_stack_locals_ = first_stack_local_index_ - next_free_frame_index;
|
| }
|
|
|
| -
|
| struct CatchParamDesc {
|
| CatchParamDesc()
|
| : token_pos(TokenPosition::kNoSource),
|
| @@ -351,7 +336,6 @@ struct CatchParamDesc {
|
| LocalVariable* var;
|
| };
|
|
|
| -
|
| void ParsedFunction::AllocateIrregexpVariables(intptr_t num_stack_locals) {
|
| ASSERT(function().IsIrregexpFunction());
|
| ASSERT(function().NumOptionalParameters() == 0);
|
| @@ -369,7 +353,6 @@ void ParsedFunction::AllocateIrregexpVariables(intptr_t num_stack_locals) {
|
| num_stack_locals_ = num_stack_locals;
|
| }
|
|
|
| -
|
| struct Parser::Block : public ZoneAllocated {
|
| Block(Block* outer_block, LocalScope* local_scope, SequenceNode* seq)
|
| : parent(outer_block), scope(local_scope), statements(seq) {
|
| @@ -381,7 +364,6 @@ struct Parser::Block : public ZoneAllocated {
|
| SequenceNode* statements;
|
| };
|
|
|
| -
|
| // Class which describes an inlined finally block which is used to generate
|
| // inlined code for the finally blocks when there is an exit from a try
|
| // block using 'return', 'break' or 'continue'.
|
| @@ -425,12 +407,10 @@ class Parser::TryStack : public ZoneAllocated {
|
| DISALLOW_COPY_AND_ASSIGN(TryStack);
|
| };
|
|
|
| -
|
| void Parser::TryStack::AddNodeForFinallyInlining(AstNode* node) {
|
| inlined_finally_nodes_.Add(node);
|
| }
|
|
|
| -
|
| void Parser::TryStack::RemoveJumpToLabel(SourceLabel* label) {
|
| int i = 0;
|
| while (i < inlined_finally_nodes_.length()) {
|
| @@ -449,7 +429,6 @@ void Parser::TryStack::RemoveJumpToLabel(SourceLabel* label) {
|
| }
|
| }
|
|
|
| -
|
| // For parsing a compilation unit.
|
| Parser::Parser(const Script& script,
|
| const Library& library,
|
| @@ -482,7 +461,6 @@ Parser::Parser(const Script& script,
|
| ASSERT(!library.IsNull());
|
| }
|
|
|
| -
|
| // For parsing a function.
|
| Parser::Parser(const Script& script,
|
| ParsedFunction* parsed_function,
|
| @@ -521,7 +499,6 @@ Parser::Parser(const Script& script,
|
| EnsureExpressionTemp();
|
| }
|
|
|
| -
|
| Parser::~Parser() {
|
| if (unregister_pending_function_) {
|
| const GrowableObjectArray& pending_functions =
|
| @@ -534,7 +511,6 @@ Parser::~Parser() {
|
| }
|
| }
|
|
|
| -
|
| // Each try in this function gets its own try index.
|
| // See definition of RawPcDescriptors::PcDescriptor.
|
| int16_t Parser::AllocateTryIndex() {
|
| @@ -544,7 +520,6 @@ int16_t Parser::AllocateTryIndex() {
|
| return last_used_try_index_++;
|
| }
|
|
|
| -
|
| void Parser::SetScript(const Script& script, TokenPosition token_pos) {
|
| script_ = script.raw();
|
| tokens_iterator_.SetStream(TokenStream::Handle(Z, script.tokens()),
|
| @@ -552,25 +527,21 @@ void Parser::SetScript(const Script& script, TokenPosition token_pos) {
|
| token_kind_ = Token::kILLEGAL;
|
| }
|
|
|
| -
|
| bool Parser::SetAllowFunctionLiterals(bool value) {
|
| bool current_value = allow_function_literals_;
|
| allow_function_literals_ = value;
|
| return current_value;
|
| }
|
|
|
| -
|
| const Function& Parser::current_function() const {
|
| ASSERT(parsed_function() != NULL);
|
| return parsed_function()->function();
|
| }
|
|
|
| -
|
| const Function& Parser::innermost_function() const {
|
| return innermost_function_;
|
| }
|
|
|
| -
|
| int Parser::FunctionLevel() const {
|
| if (current_block_ != NULL) {
|
| return current_block_->scope->function_level();
|
| @@ -578,24 +549,20 @@ int Parser::FunctionLevel() const {
|
| return 0;
|
| }
|
|
|
| -
|
| const Class& Parser::current_class() const {
|
| return current_class_;
|
| }
|
|
|
| -
|
| void Parser::set_current_class(const Class& value) {
|
| current_class_ = value.raw();
|
| }
|
|
|
| -
|
| void Parser::SetPosition(TokenPosition position) {
|
| tokens_iterator_.SetCurrentPosition(position);
|
| token_kind_ = Token::kILLEGAL;
|
| prev_token_pos_ = position;
|
| }
|
|
|
| -
|
| // Set state and increments generational count so that thge background compiler
|
| // can detect if loading/top-level-parsing occured during compilation.
|
| class TopLevelParsingScope : public StackResource {
|
| @@ -609,7 +576,6 @@ class TopLevelParsingScope : public StackResource {
|
| }
|
| };
|
|
|
| -
|
| void Parser::ParseCompilationUnit(const Library& library,
|
| const Script& script) {
|
| Thread* thread = Thread::Current();
|
| @@ -630,7 +596,6 @@ void Parser::ParseCompilationUnit(const Library& library,
|
| parser.ParseTopLevel();
|
| }
|
|
|
| -
|
| void Parser::ComputeCurrentToken() {
|
| ASSERT(token_kind_ == Token::kILLEGAL);
|
| token_kind_ = tokens_iterator_.CurrentTokenKind();
|
| @@ -639,25 +604,21 @@ void Parser::ComputeCurrentToken() {
|
| }
|
| }
|
|
|
| -
|
| Token::Kind Parser::LookaheadToken(int num_tokens) {
|
| return tokens_iterator_.LookaheadTokenKind(num_tokens);
|
| }
|
|
|
| -
|
| String* Parser::CurrentLiteral() const {
|
| String& result = String::ZoneHandle(Z, tokens_iterator_.CurrentLiteral());
|
| return &result;
|
| }
|
|
|
| -
|
| RawDouble* Parser::CurrentDoubleLiteral() const {
|
| literal_token_ ^= tokens_iterator_.CurrentToken();
|
| ASSERT(literal_token_.kind() == Token::kDOUBLE);
|
| return Double::RawCast(literal_token_.value());
|
| }
|
|
|
| -
|
| RawInteger* Parser::CurrentIntegerLiteral() const {
|
| literal_token_ ^= tokens_iterator_.CurrentToken();
|
| ASSERT(literal_token_.kind() == Token::kINTEGER);
|
| @@ -665,7 +626,6 @@ RawInteger* Parser::CurrentIntegerLiteral() const {
|
| return ri;
|
| }
|
|
|
| -
|
| struct ParamDesc {
|
| ParamDesc()
|
| : type(NULL),
|
| @@ -690,7 +650,6 @@ struct ParamDesc {
|
| bool is_covariant;
|
| };
|
|
|
| -
|
| struct ParamList {
|
| ParamList() { Clear(); }
|
|
|
| @@ -769,7 +728,6 @@ struct ParamList {
|
| ZoneGrowableArray<ParamDesc>* parameters;
|
| };
|
|
|
| -
|
| struct MemberDesc {
|
| MemberDesc() { Clear(); }
|
|
|
| @@ -852,7 +810,6 @@ struct MemberDesc {
|
| Field* field_;
|
| };
|
|
|
| -
|
| class ClassDesc : public ValueObject {
|
| public:
|
| ClassDesc(Zone* zone,
|
| @@ -927,7 +884,6 @@ class ClassDesc : public ValueObject {
|
| GrowableArray<MemberDesc> members_;
|
| };
|
|
|
| -
|
| class TopLevel : public ValueObject {
|
| public:
|
| explicit TopLevel(Zone* zone)
|
| @@ -951,7 +907,6 @@ class TopLevel : public ValueObject {
|
| GrowableArray<const Function*> functions_;
|
| };
|
|
|
| -
|
| void Parser::ParseClass(const Class& cls) {
|
| Thread* thread = Thread::Current();
|
| Zone* zone = thread->zone();
|
| @@ -983,7 +938,6 @@ void Parser::ParseClass(const Class& cls) {
|
| INC_STAT(thread, num_class_tokens, num_tokes_after - num_tokes_before);
|
| }
|
|
|
| -
|
| bool Parser::FieldHasFunctionLiteralInitializer(const Field& field,
|
| TokenPosition* start,
|
| TokenPosition* end) {
|
| @@ -1020,7 +974,6 @@ bool Parser::GetFunctionLiteralInitializerRange(const Field& field,
|
| return false;
|
| }
|
|
|
| -
|
| RawObject* Parser::ParseFunctionParameters(const Function& func) {
|
| ASSERT(!func.IsNull());
|
| LongJumpScope jump;
|
| @@ -1075,7 +1028,6 @@ RawObject* Parser::ParseFunctionParameters(const Function& func) {
|
| return Object::null();
|
| }
|
|
|
| -
|
| bool Parser::ParseFormalParameters(const Function& func, ParamList* params) {
|
| ASSERT(!func.IsNull());
|
| // This is currently only used for constructors. To handle all kinds
|
| @@ -1112,7 +1064,6 @@ bool Parser::ParseFormalParameters(const Function& func, ParamList* params) {
|
| return false;
|
| }
|
|
|
| -
|
| void Parser::ParseFunction(ParsedFunction* parsed_function) {
|
| Thread* thread = parsed_function->thread();
|
| ASSERT(thread == Thread::Current());
|
| @@ -1221,7 +1172,6 @@ void Parser::ParseFunction(ParsedFunction* parsed_function) {
|
| (parsed_function->function_type_arguments() != NULL));
|
| }
|
|
|
| -
|
| RawObject* Parser::ParseMetadata(const Field& meta_data) {
|
| LongJumpScope jump;
|
| if (setjmp(*jump.Set()) == 0) {
|
| @@ -1265,7 +1215,6 @@ RawObject* Parser::ParseMetadata(const Field& meta_data) {
|
| return Object::null();
|
| }
|
|
|
| -
|
| RawArray* Parser::EvaluateMetadata() {
|
| CheckToken(Token::kAT, "Metadata character '@' expected");
|
| GrowableObjectArray& meta_values =
|
| @@ -1339,7 +1288,6 @@ RawArray* Parser::EvaluateMetadata() {
|
| return Array::MakeFixedLength(meta_values);
|
| }
|
|
|
| -
|
| SequenceNode* Parser::ParseStaticInitializer() {
|
| ExpectIdentifier("field name expected");
|
| CheckToken(Token::kASSIGN, "field initialier expected");
|
| @@ -1352,7 +1300,6 @@ SequenceNode* Parser::ParseStaticInitializer() {
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| ParsedFunction* Parser::ParseStaticFieldInitializer(const Field& field) {
|
| ASSERT(field.is_static());
|
| Thread* thread = Thread::Current();
|
| @@ -1409,7 +1356,6 @@ ParsedFunction* Parser::ParseStaticFieldInitializer(const Field& field) {
|
| return parsed_function;
|
| }
|
|
|
| -
|
| SequenceNode* Parser::ParseStaticFinalGetter(const Function& func) {
|
| TRACE_PARSER("ParseStaticFinalGetter");
|
| ASSERT(func.num_fixed_parameters() == 0); // static.
|
| @@ -1454,7 +1400,6 @@ SequenceNode* Parser::ParseStaticFinalGetter(const Function& func) {
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| // Create AstNodes for an implicit instance getter method:
|
| // LoadLocalNode 0 ('this');
|
| // LoadInstanceFieldNode (field_name);
|
| @@ -1493,7 +1438,6 @@ SequenceNode* Parser::ParseInstanceGetter(const Function& func) {
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| // Create AstNodes for an implicit instance setter method:
|
| // LoadLocalNode 0 ('this')
|
| // LoadLocalNode 1 ('value')
|
| @@ -1535,7 +1479,6 @@ SequenceNode* Parser::ParseInstanceSetter(const Function& func) {
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| SequenceNode* Parser::ParseConstructorClosure(const Function& func) {
|
| TRACE_PARSER("ParseConstructorClosure");
|
| const TokenPosition token_pos = func.token_pos();
|
| @@ -1588,7 +1531,6 @@ SequenceNode* Parser::ParseConstructorClosure(const Function& func) {
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| SequenceNode* Parser::ParseImplicitClosure(const Function& func) {
|
| TRACE_PARSER("ParseImplicitClosure");
|
| TokenPosition token_pos = func.token_pos();
|
| @@ -1735,7 +1677,6 @@ SequenceNode* Parser::ParseImplicitClosure(const Function& func) {
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| SequenceNode* Parser::ParseMethodExtractor(const Function& func) {
|
| TRACE_PARSER("ParseMethodExtractor");
|
|
|
| @@ -1765,7 +1706,6 @@ SequenceNode* Parser::ParseMethodExtractor(const Function& func) {
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| void Parser::BuildDispatcherScope(const Function& func,
|
| const ArgumentsDescriptor& desc) {
|
| ParamList params;
|
| @@ -1816,7 +1756,6 @@ void Parser::BuildDispatcherScope(const Function& func,
|
| }
|
| }
|
|
|
| -
|
| SequenceNode* Parser::ParseNoSuchMethodDispatcher(const Function& func) {
|
| TRACE_PARSER("ParseNoSuchMethodDispatcher");
|
| ASSERT(FLAG_lazy_dispatchers);
|
| @@ -1874,7 +1813,6 @@ SequenceNode* Parser::ParseNoSuchMethodDispatcher(const Function& func) {
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| SequenceNode* Parser::ParseInvokeFieldDispatcher(const Function& func) {
|
| TRACE_PARSER("ParseInvokeFieldDispatcher");
|
| ASSERT(func.IsInvokeFieldDispatcher());
|
| @@ -1942,14 +1880,12 @@ SequenceNode* Parser::ParseInvokeFieldDispatcher(const Function& func) {
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| AstNode* Parser::BuildClosureCall(TokenPosition token_pos,
|
| AstNode* closure,
|
| ArgumentListNode* arguments) {
|
| return new InstanceCallNode(token_pos, closure, Symbols::Call(), arguments);
|
| }
|
|
|
| -
|
| void Parser::SkipToMatching() {
|
| Token::Kind opening_token = CurrentToken();
|
| ASSERT((opening_token == Token::kLBRACE) ||
|
| @@ -2014,13 +1950,11 @@ void Parser::SkipToMatching() {
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipBlock() {
|
| ASSERT(CurrentToken() == Token::kLBRACE);
|
| SkipToMatching();
|
| }
|
|
|
| -
|
| // Skips tokens up to and including matching closing parenthesis.
|
| void Parser::SkipToMatchingParenthesis() {
|
| ASSERT(CurrentToken() == Token::kLPAREN);
|
| @@ -2029,7 +1963,6 @@ void Parser::SkipToMatchingParenthesis() {
|
| ConsumeToken();
|
| }
|
|
|
| -
|
| // Parses a parameter type as defined by the 'parameterTypeList' production.
|
| void Parser::ParseParameterType(ParamList* params) {
|
| TRACE_PARSER("ParseParameterType");
|
| @@ -2100,7 +2033,6 @@ void Parser::ParseParameterType(ParamList* params) {
|
| }
|
| }
|
|
|
| -
|
| // Parses a formal parameter as defined by the 'formalParameterList' production.
|
| void Parser::ParseFormalParameter(bool allow_explicit_default_value,
|
| bool evaluate_metadata,
|
| @@ -2331,7 +2263,6 @@ void Parser::ParseFormalParameter(bool allow_explicit_default_value,
|
| }
|
| }
|
|
|
| -
|
| // Parses a sequence of normal or optional formal parameters.
|
| void Parser::ParseFormalParameters(bool use_function_type_syntax,
|
| bool allow_explicit_default_values,
|
| @@ -2377,7 +2308,6 @@ void Parser::ParseFormalParameters(bool use_function_type_syntax,
|
| } while (CurrentToken() == Token::kCOMMA);
|
| }
|
|
|
| -
|
| void Parser::ParseFormalParameterList(bool use_function_type_syntax,
|
| bool allow_explicit_default_values,
|
| bool evaluate_metadata,
|
| @@ -2414,7 +2344,6 @@ void Parser::ParseFormalParameterList(bool use_function_type_syntax,
|
| ExpectToken(Token::kRPAREN);
|
| }
|
|
|
| -
|
| String& Parser::ParseNativeDeclaration() {
|
| TRACE_PARSER("ParseNativeDeclaration");
|
| ASSERT(IsSymbol(Symbols::Native()));
|
| @@ -2425,7 +2354,6 @@ String& Parser::ParseNativeDeclaration() {
|
| return native_name;
|
| }
|
|
|
| -
|
| // Resolve and return the dynamic function of the given name in the superclass.
|
| // If it is not found, and resolve_getter is true, try to resolve a getter of
|
| // the same name. If it is still not found, return noSuchMethod and
|
| @@ -2467,7 +2395,6 @@ RawFunction* Parser::GetSuperFunction(TokenPosition token_pos,
|
| return super_func.raw();
|
| }
|
|
|
| -
|
| StaticCallNode* Parser::BuildInvocationMirrorAllocation(
|
| TokenPosition call_pos,
|
| const String& function_name,
|
| @@ -2521,7 +2448,6 @@ StaticCallNode* Parser::BuildInvocationMirrorAllocation(
|
| return new StaticCallNode(call_pos, allocation_function, arguments);
|
| }
|
|
|
| -
|
| ArgumentListNode* Parser::BuildNoSuchMethodArguments(
|
| TokenPosition call_pos,
|
| const String& function_name,
|
| @@ -2539,7 +2465,6 @@ ArgumentListNode* Parser::BuildNoSuchMethodArguments(
|
| return arguments;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseSuperCall(const String& function_name,
|
| const TypeArguments& func_type_args) {
|
| TRACE_PARSER("ParseSuperCall");
|
| @@ -2579,13 +2504,11 @@ AstNode* Parser::ParseSuperCall(const String& function_name,
|
| return new StaticCallNode(supercall_pos, super_function, arguments);
|
| }
|
|
|
| -
|
| // Simple test if a node is side effect free.
|
| static bool IsSimpleLocalOrLiteralNode(AstNode* node) {
|
| return node->IsLiteralNode() || node->IsLoadLocalNode();
|
| }
|
|
|
| -
|
| AstNode* Parser::BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super) {
|
| ASSERT(super->IsSuper());
|
| AstNode* super_op = NULL;
|
| @@ -2612,7 +2535,6 @@ AstNode* Parser::BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super) {
|
| return super_op;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseSuperOperator() {
|
| TRACE_PARSER("ParseSuperOperator");
|
| AstNode* super_op = NULL;
|
| @@ -2667,7 +2589,6 @@ AstNode* Parser::ParseSuperOperator() {
|
| return super_op;
|
| }
|
|
|
| -
|
| ClosureNode* Parser::CreateImplicitClosureNode(const Function& func,
|
| TokenPosition token_pos,
|
| AstNode* receiver) {
|
| @@ -2676,7 +2597,6 @@ ClosureNode* Parser::CreateImplicitClosureNode(const Function& func,
|
| return new ClosureNode(token_pos, implicit_closure_function, receiver, NULL);
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseSuperFieldAccess(const String& field_name,
|
| TokenPosition field_pos) {
|
| TRACE_PARSER("ParseSuperFieldAccess");
|
| @@ -2722,7 +2642,6 @@ AstNode* Parser::ParseSuperFieldAccess(const String& field_name,
|
| StaticGetterNode(field_pos, implicit_argument, super_class, field_name);
|
| }
|
|
|
| -
|
| StaticCallNode* Parser::GenerateSuperConstructorCall(
|
| const Class& cls,
|
| TokenPosition supercall_pos,
|
| @@ -2792,7 +2711,6 @@ StaticCallNode* Parser::GenerateSuperConstructorCall(
|
| return new StaticCallNode(supercall_pos, super_ctor, arguments);
|
| }
|
|
|
| -
|
| StaticCallNode* Parser::ParseSuperInitializer(const Class& cls,
|
| LocalVariable* receiver) {
|
| TRACE_PARSER("ParseSuperInitializer");
|
| @@ -2847,7 +2765,6 @@ StaticCallNode* Parser::ParseSuperInitializer(const Class& cls,
|
| return new StaticCallNode(supercall_pos, super_ctor, arguments);
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseInitializer(const Class& cls,
|
| LocalVariable* receiver,
|
| GrowableArray<Field*>* initialized_fields) {
|
| @@ -2901,7 +2818,6 @@ AstNode* Parser::ParseInitializer(const Class& cls,
|
| return initializer;
|
| }
|
|
|
| -
|
| void Parser::CheckFieldsInitialized(const Class& cls) {
|
| const Array& fields = Array::Handle(Z, cls.fields());
|
| Field& field = Field::Handle(Z);
|
| @@ -2932,7 +2848,6 @@ void Parser::CheckFieldsInitialized(const Class& cls) {
|
| }
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseExternalInitializedField(const Field& field) {
|
| // Only use this function if the initialized field originates
|
| // from a different class. We need to save and restore the
|
| @@ -2966,7 +2881,6 @@ AstNode* Parser::ParseExternalInitializedField(const Field& field) {
|
| return init_expr;
|
| }
|
|
|
| -
|
| void Parser::ParseInitializedInstanceFields(
|
| const Class& cls,
|
| LocalVariable* receiver,
|
| @@ -3019,7 +2933,6 @@ void Parser::ParseInitializedInstanceFields(
|
| SetPosition(saved_pos);
|
| }
|
|
|
| -
|
| AstNode* Parser::CheckDuplicateFieldInit(
|
| TokenPosition init_pos,
|
| GrowableArray<Field*>* initialized_fields,
|
| @@ -3122,7 +3035,6 @@ AstNode* Parser::CheckDuplicateFieldInit(
|
| return result;
|
| }
|
|
|
| -
|
| void Parser::ParseInitializers(const Class& cls,
|
| LocalVariable* receiver,
|
| GrowableArray<Field*>* initialized_fields) {
|
| @@ -3194,7 +3106,6 @@ void Parser::ParseInitializers(const Class& cls,
|
| CheckFieldsInitialized(cls);
|
| }
|
|
|
| -
|
| void Parser::ParseConstructorRedirection(const Class& cls,
|
| LocalVariable* receiver) {
|
| TRACE_PARSER("ParseConstructorRedirection");
|
| @@ -3249,7 +3160,6 @@ void Parser::ParseConstructorRedirection(const Class& cls,
|
| new StaticCallNode(call_pos, redirect_ctor, arguments));
|
| }
|
|
|
| -
|
| SequenceNode* Parser::MakeImplicitConstructor(const Function& func) {
|
| ASSERT(func.IsGenerativeConstructor());
|
| ASSERT(func.Owner() == current_class().raw());
|
| @@ -3325,7 +3235,6 @@ SequenceNode* Parser::MakeImplicitConstructor(const Function& func) {
|
| return statements;
|
| }
|
|
|
| -
|
| // Returns a zone allocated string.
|
| static char* DumpPendingFunctions(
|
| Zone* zone,
|
| @@ -3341,7 +3250,6 @@ static char* DumpPendingFunctions(
|
| return result;
|
| }
|
|
|
| -
|
| void Parser::CheckRecursiveInvocation() {
|
| const GrowableObjectArray& pending_functions =
|
| GrowableObjectArray::Handle(Z, T->pending_functions());
|
| @@ -3366,7 +3274,6 @@ void Parser::CheckRecursiveInvocation() {
|
| unregister_pending_function_ = true;
|
| }
|
|
|
| -
|
| // Parser is at the opening parenthesis of the formal parameter declaration
|
| // of function. Parse the formal parameters, initializers and code.
|
| SequenceNode* Parser::ParseConstructor(const Function& func) {
|
| @@ -3541,7 +3448,6 @@ SequenceNode* Parser::ParseConstructor(const Function& func) {
|
| return statements;
|
| }
|
|
|
| -
|
| // Parser is at the opening parenthesis of the formal parameter
|
| // declaration of the function or constructor.
|
| // Parse the formal parameters and code.
|
| @@ -3845,7 +3751,6 @@ SequenceNode* Parser::ParseFunc(const Function& func, bool check_semicolon) {
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| void Parser::AddEqualityNullCheck() {
|
| AstNode* argument = new LoadLocalNode(
|
| TokenPosition::kNoSource, current_block_->scope->parent()->VariableAt(1));
|
| @@ -3864,14 +3769,12 @@ void Parser::AddEqualityNullCheck() {
|
| current_block_->statements->Add(if_arg_null);
|
| }
|
|
|
| -
|
| void Parser::SkipIf(Token::Kind token) {
|
| if (CurrentToken() == token) {
|
| ConsumeToken();
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipInitializers() {
|
| ASSERT(CurrentToken() == Token::kCOLON);
|
| do {
|
| @@ -3900,7 +3803,6 @@ void Parser::SkipInitializers() {
|
| } while (CurrentToken() == Token::kCOMMA);
|
| }
|
|
|
| -
|
| // If the current identifier is a library prefix followed by a period,
|
| // consume the identifier and period, and return the resolved library
|
| // prefix.
|
| @@ -3947,7 +3849,6 @@ RawLibraryPrefix* Parser::ParsePrefix() {
|
| return prefix.raw();
|
| }
|
|
|
| -
|
| void Parser::ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method) {
|
| TRACE_PARSER("ParseMethodOrConstructor");
|
| // We are at the beginning of the formal parameters list.
|
| @@ -4309,7 +4210,6 @@ void Parser::ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method) {
|
| members->AddFunction(func);
|
| }
|
|
|
| -
|
| void Parser::ParseFieldDefinition(ClassDesc* members, MemberDesc* field) {
|
| TRACE_PARSER("ParseFieldDefinition");
|
| // The parser has read the first field name and is now at the token
|
| @@ -4482,7 +4382,6 @@ void Parser::ParseFieldDefinition(ClassDesc* members, MemberDesc* field) {
|
| ExpectSemicolon();
|
| }
|
|
|
| -
|
| void Parser::CheckOperatorArity(const MemberDesc& member) {
|
| intptr_t expected_num_parameters; // Includes receiver.
|
| Token::Kind op = member.operator_token;
|
| @@ -4503,7 +4402,6 @@ void Parser::CheckOperatorArity(const MemberDesc& member) {
|
| }
|
| }
|
|
|
| -
|
| void Parser::CheckMemberNameConflict(ClassDesc* members, MemberDesc* member) {
|
| const String& name = *member->DictName();
|
| if (name.Equals(members->class_name())) {
|
| @@ -4524,7 +4422,6 @@ void Parser::CheckMemberNameConflict(ClassDesc* members, MemberDesc* member) {
|
| }
|
| }
|
|
|
| -
|
| void Parser::ParseClassMemberDefinition(ClassDesc* members,
|
| TokenPosition metadata_pos) {
|
| TRACE_PARSER("ParseClassMemberDefinition");
|
| @@ -4740,7 +4637,6 @@ void Parser::ParseClassMemberDefinition(ClassDesc* members,
|
| members->AddMember(member);
|
| }
|
|
|
| -
|
| void Parser::ParseEnumDeclaration(const GrowableObjectArray& pending_classes,
|
| const Object& tl_owner,
|
| TokenPosition metadata_pos) {
|
| @@ -4789,7 +4685,6 @@ void Parser::ParseEnumDeclaration(const GrowableObjectArray& pending_classes,
|
| pending_classes.Add(cls, Heap::kOld);
|
| }
|
|
|
| -
|
| void Parser::ParseClassDeclaration(const GrowableObjectArray& pending_classes,
|
| const Object& tl_owner,
|
| TokenPosition metadata_pos) {
|
| @@ -4975,7 +4870,6 @@ void Parser::ParseClassDeclaration(const GrowableObjectArray& pending_classes,
|
| }
|
| }
|
|
|
| -
|
| void Parser::ParseClassDefinition(const Class& cls) {
|
| TRACE_PARSER("ParseClassDefinition");
|
| INC_STAT(thread(), num_classes_parsed, 1);
|
| @@ -5043,7 +4937,6 @@ void Parser::ParseClassDefinition(const Class& cls) {
|
| }
|
| }
|
|
|
| -
|
| void Parser::ParseEnumDefinition(const Class& cls) {
|
| TRACE_PARSER("ParseEnumDefinition");
|
| INC_STAT(thread(), num_classes_parsed, 1);
|
| @@ -5234,7 +5127,6 @@ void Parser::ParseEnumDefinition(const Class& cls) {
|
| cls.SetFunctions(functions);
|
| }
|
|
|
| -
|
| // Add an implicit constructor to the given class.
|
| void Parser::AddImplicitConstructor(const Class& cls) {
|
| // The implicit constructor is unnamed, has no explicit parameter.
|
| @@ -5270,7 +5162,6 @@ void Parser::AddImplicitConstructor(const Class& cls) {
|
| cls.AddFunction(ctor);
|
| }
|
|
|
| -
|
| void Parser::CheckFinalInitializationConflicts(const ClassDesc* class_desc,
|
| const MemberDesc* member) {
|
| const ParamList* params = &member->params;
|
| @@ -5305,7 +5196,6 @@ void Parser::CheckFinalInitializationConflicts(const ClassDesc* class_desc,
|
| }
|
| }
|
|
|
| -
|
| // Check for cycles in constructor redirection.
|
| void Parser::CheckConstructors(ClassDesc* class_desc) {
|
| // Check for cycles in constructor redirection.
|
| @@ -5341,7 +5231,6 @@ void Parser::CheckConstructors(ClassDesc* class_desc) {
|
| }
|
| }
|
|
|
| -
|
| void Parser::ParseMixinAppAlias(const GrowableObjectArray& pending_classes,
|
| const Object& tl_owner,
|
| TokenPosition metadata_pos) {
|
| @@ -5399,7 +5288,6 @@ void Parser::ParseMixinAppAlias(const GrowableObjectArray& pending_classes,
|
| }
|
| }
|
|
|
| -
|
| // Look ahead to detect if we are seeing ident [ TypeParameters ] ("(" | "=").
|
| // We need this lookahead to distinguish between the optional return type
|
| // and the alias name of a function type alias.
|
| @@ -5427,7 +5315,6 @@ bool Parser::IsFunctionTypeAliasName(bool* use_function_type_syntax) {
|
| return false;
|
| }
|
|
|
| -
|
| void Parser::ParseTypedef(const GrowableObjectArray& pending_classes,
|
| const Object& tl_owner,
|
| TokenPosition metadata_pos) {
|
| @@ -5546,7 +5433,6 @@ void Parser::ParseTypedef(const GrowableObjectArray& pending_classes,
|
| }
|
| }
|
|
|
| -
|
| // Consumes exactly one right angle bracket. If the current token is
|
| // a single bracket token, it is consumed normally. However, if it is
|
| // a double bracket, it is replaced by a single bracket token without
|
| @@ -5561,7 +5447,6 @@ void Parser::ConsumeRightAngleBracket() {
|
| }
|
| }
|
|
|
| -
|
| bool Parser::IsPatchAnnotation(TokenPosition pos) {
|
| if (pos == TokenPosition::kNoSource) {
|
| return false;
|
| @@ -5572,7 +5457,6 @@ bool Parser::IsPatchAnnotation(TokenPosition pos) {
|
| return IsSymbol(Symbols::Patch());
|
| }
|
|
|
| -
|
| TokenPosition Parser::SkipMetadata() {
|
| if (CurrentToken() != Token::kAT) {
|
| return TokenPosition::kNoSource;
|
| @@ -5596,7 +5480,6 @@ TokenPosition Parser::SkipMetadata() {
|
| return metadata_pos;
|
| }
|
|
|
| -
|
| void Parser::SkipTypeArguments() {
|
| if (CurrentToken() == Token::kLT) {
|
| do {
|
| @@ -5612,7 +5495,6 @@ void Parser::SkipTypeArguments() {
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipTypeParameters() {
|
| // Function already parsed, no need to check FLAG_generic_method_syntax.
|
| if (IsTypeParameters()) {
|
| @@ -5621,7 +5503,6 @@ void Parser::SkipTypeParameters() {
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipType(bool allow_void) {
|
| if (CurrentToken() == Token::kVOID) {
|
| if (!allow_void) {
|
| @@ -5638,7 +5519,6 @@ void Parser::SkipType(bool allow_void) {
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipTypeOrFunctionType(bool allow_void) {
|
| if (CurrentToken() == Token::kVOID) {
|
| TokenPosition void_pos = TokenPos();
|
| @@ -5662,7 +5542,6 @@ void Parser::SkipTypeOrFunctionType(bool allow_void) {
|
| }
|
| }
|
|
|
| -
|
| void Parser::ParseTypeParameters(bool parameterizing_class) {
|
| TRACE_PARSER("ParseTypeParameters");
|
| if (CurrentToken() == Token::kLT) {
|
| @@ -5747,7 +5626,6 @@ void Parser::ParseTypeParameters(bool parameterizing_class) {
|
| }
|
| }
|
|
|
| -
|
| RawTypeArguments* Parser::ParseTypeArguments(
|
| ClassFinalizer::FinalizationKind finalization) {
|
| TRACE_PARSER("ParseTypeArguments");
|
| @@ -5780,7 +5658,6 @@ RawTypeArguments* Parser::ParseTypeArguments(
|
| return TypeArguments::null();
|
| }
|
|
|
| -
|
| // Parse interface list and add to class cls.
|
| void Parser::ParseInterfaceList(const Class& cls) {
|
| TRACE_PARSER("ParseInterfaceList");
|
| @@ -5810,7 +5687,6 @@ void Parser::ParseInterfaceList(const Class& cls) {
|
| cls.set_interfaces(cls_interfaces);
|
| }
|
|
|
| -
|
| RawAbstractType* Parser::ParseMixins(const AbstractType& super_type) {
|
| TRACE_PARSER("ParseMixins");
|
| ASSERT(CurrentToken() == Token::kWITH);
|
| @@ -5836,7 +5712,6 @@ RawAbstractType* Parser::ParseMixins(const AbstractType& super_type) {
|
| super_type, Array::Handle(Z, Array::MakeFixedLength(mixin_types)));
|
| }
|
|
|
| -
|
| void Parser::ParseTopLevelVariable(TopLevel* top_level,
|
| const Object& owner,
|
| TokenPosition metadata_pos) {
|
| @@ -5927,7 +5802,6 @@ void Parser::ParseTopLevelVariable(TopLevel* top_level,
|
| }
|
| }
|
|
|
| -
|
| RawFunction::AsyncModifier Parser::ParseFunctionModifier() {
|
| if (IsSymbol(Symbols::Async())) {
|
| ConsumeToken();
|
| @@ -5953,7 +5827,6 @@ RawFunction::AsyncModifier Parser::ParseFunctionModifier() {
|
| return RawFunction::kNoModifier;
|
| }
|
|
|
| -
|
| void Parser::ParseTopLevelFunction(TopLevel* top_level,
|
| const Object& owner,
|
| TokenPosition metadata_pos) {
|
| @@ -6086,7 +5959,6 @@ void Parser::ParseTopLevelFunction(TopLevel* top_level,
|
| }
|
| }
|
|
|
| -
|
| void Parser::ParseTopLevelAccessor(TopLevel* top_level,
|
| const Object& owner,
|
| TokenPosition metadata_pos) {
|
| @@ -6206,8 +6078,9 @@ void Parser::ParseTopLevelAccessor(TopLevel* top_level,
|
| ReportError("function block expected");
|
| }
|
| Function& func = Function::Handle(
|
| - Z, Function::New(accessor_name, is_getter ? RawFunction::kGetterFunction
|
| - : RawFunction::kSetterFunction,
|
| + Z, Function::New(accessor_name,
|
| + is_getter ? RawFunction::kGetterFunction
|
| + : RawFunction::kSetterFunction,
|
| is_static,
|
| /* is_const = */ false,
|
| /* is_abstract = */ false, is_external, is_native, owner,
|
| @@ -6243,7 +6116,6 @@ void Parser::ParseTopLevelAccessor(TopLevel* top_level,
|
| }
|
| }
|
|
|
| -
|
| RawObject* Parser::CallLibraryTagHandler(Dart_LibraryTag tag,
|
| TokenPosition token_pos,
|
| const String& url) {
|
| @@ -6283,7 +6155,6 @@ RawObject* Parser::CallLibraryTagHandler(Dart_LibraryTag tag,
|
| return result.raw();
|
| }
|
|
|
| -
|
| void Parser::ParseLibraryName() {
|
| ASSERT(CurrentToken() == Token::kLIBRARY);
|
| ConsumeToken();
|
| @@ -6302,7 +6173,6 @@ void Parser::ParseLibraryName() {
|
| ExpectSemicolon();
|
| }
|
|
|
| -
|
| void Parser::ParseIdentList(GrowableObjectArray* names) {
|
| if (!IsIdentifier()) {
|
| ReportError("identifier expected");
|
| @@ -6317,7 +6187,6 @@ void Parser::ParseIdentList(GrowableObjectArray* names) {
|
| }
|
| }
|
|
|
| -
|
| void Parser::ParseLibraryImportExport(const Object& tl_owner,
|
| TokenPosition metadata_pos) {
|
| ASSERT(Thread::Current()->IsMutatorThread());
|
| @@ -6499,7 +6368,6 @@ void Parser::ParseLibraryImportExport(const Object& tl_owner,
|
| }
|
| }
|
|
|
| -
|
| void Parser::ParseLibraryPart() {
|
| const TokenPosition source_pos = TokenPos();
|
| ConsumeToken(); // Consume "part".
|
| @@ -6517,7 +6385,6 @@ void Parser::ParseLibraryPart() {
|
| CallLibraryTagHandler(Dart_kSourceTag, source_pos, canon_url);
|
| }
|
|
|
| -
|
| void Parser::ParseLibraryDefinition(const Object& tl_owner) {
|
| TRACE_PARSER("ParseLibraryDefinition");
|
|
|
| @@ -6570,7 +6437,6 @@ void Parser::ParseLibraryDefinition(const Object& tl_owner) {
|
| SetPosition(rewind_pos);
|
| }
|
|
|
| -
|
| void Parser::ParsePartHeader() {
|
| SkipMetadata();
|
| CheckToken(Token::kPART, "'part of' expected");
|
| @@ -6593,7 +6459,6 @@ void Parser::ParsePartHeader() {
|
| ExpectSemicolon();
|
| }
|
|
|
| -
|
| void Parser::ParseTopLevel() {
|
| TRACE_PARSER("ParseTopLevel");
|
| // Collect the classes found at the top level in this growable array.
|
| @@ -6668,7 +6533,6 @@ void Parser::ParseTopLevel() {
|
| pending_classes.Add(toplevel_class, Heap::kOld);
|
| }
|
|
|
| -
|
| void Parser::CheckStack() {
|
| volatile uword c_stack_pos = Thread::GetCurrentStackPointer();
|
| volatile uword c_stack_base = OSThread::Current()->stack_base();
|
| @@ -6680,14 +6544,12 @@ void Parser::CheckStack() {
|
| }
|
| }
|
|
|
| -
|
| void Parser::ChainNewBlock(LocalScope* outer_scope) {
|
| Block* block = new (Z) Block(current_block_, outer_scope,
|
| new (Z) SequenceNode(TokenPos(), outer_scope));
|
| current_block_ = block;
|
| }
|
|
|
| -
|
| void Parser::OpenBlock() {
|
| ASSERT(current_block_ != NULL);
|
| LocalScope* outer_scope = current_block_->scope;
|
| @@ -6695,7 +6557,6 @@ void Parser::OpenBlock() {
|
| outer_scope->loop_level()));
|
| }
|
|
|
| -
|
| void Parser::OpenLoopBlock() {
|
| ASSERT(current_block_ != NULL);
|
| LocalScope* outer_scope = current_block_->scope;
|
| @@ -6703,7 +6564,6 @@ void Parser::OpenLoopBlock() {
|
| outer_scope->loop_level() + 1));
|
| }
|
|
|
| -
|
| void Parser::OpenFunctionBlock(const Function& func) {
|
| LocalScope* outer_scope;
|
| if (current_block_ == NULL) {
|
| @@ -6727,14 +6587,12 @@ void Parser::OpenFunctionBlock(const Function& func) {
|
| ChainNewBlock(outer_scope);
|
| }
|
|
|
| -
|
| void Parser::OpenAsyncClosure() {
|
| TRACE_PARSER("OpenAsyncClosure");
|
| async_temp_scope_ = current_block_->scope;
|
| OpenAsyncTryBlock();
|
| }
|
|
|
| -
|
| SequenceNode* Parser::CloseAsyncGeneratorTryBlock(SequenceNode* body) {
|
| TRACE_PARSER("CloseAsyncGeneratorTryBlock");
|
| // The generated try-catch-finally that wraps the async generator function
|
| @@ -6890,7 +6748,6 @@ SequenceNode* Parser::CloseAsyncGeneratorTryBlock(SequenceNode* body) {
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| SequenceNode* Parser::CloseAsyncTryBlock(SequenceNode* try_block,
|
| TokenPosition func_end_pos) {
|
| // This is the outermost try-catch of the function.
|
| @@ -6991,7 +6848,6 @@ SequenceNode* Parser::CloseAsyncTryBlock(SequenceNode* try_block,
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| // Wrap the body of the async or async* closure in a try/catch block.
|
| void Parser::OpenAsyncTryBlock() {
|
| ASSERT(innermost_function().IsAsyncClosure() ||
|
| @@ -7016,7 +6872,6 @@ void Parser::OpenAsyncTryBlock() {
|
| SetupSavedTryContext(context_var);
|
| }
|
|
|
| -
|
| void Parser::AddSyncGenClosureParameters(ParamList* params) {
|
| // Create the parameter list for the body closure of a sync generator:
|
| // 1) Implicit closure parameter;
|
| @@ -7034,14 +6889,12 @@ void Parser::AddSyncGenClosureParameters(ParamList* params) {
|
| params->num_fixed_parameters++;
|
| }
|
|
|
| -
|
| void Parser::AddAsyncGenClosureParameters(ParamList* params) {
|
| // Create the parameter list for the body closure of an async generator.
|
| // The closure has the same parameters as an asynchronous non-generator.
|
| AddAsyncClosureParameters(params);
|
| }
|
|
|
| -
|
| RawFunction* Parser::OpenSyncGeneratorFunction(TokenPosition func_pos) {
|
| Function& body = Function::Handle(Z);
|
| String& body_closure_name = String::Handle(Z);
|
| @@ -7137,7 +6990,6 @@ SequenceNode* Parser::CloseSyncGenFunction(const Function& closure,
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| void Parser::AddAsyncClosureParameters(ParamList* params) {
|
| // Async closures have three optional parameters:
|
| // * A continuation result.
|
| @@ -7169,7 +7021,6 @@ void Parser::AddAsyncClosureParameters(ParamList* params) {
|
| params->num_optional_parameters += 3;
|
| }
|
|
|
| -
|
| RawFunction* Parser::OpenAsyncFunction(TokenPosition async_func_pos) {
|
| TRACE_PARSER("OpenAsyncFunction");
|
| AddContinuationVariables();
|
| @@ -7220,7 +7071,6 @@ RawFunction* Parser::OpenAsyncFunction(TokenPosition async_func_pos) {
|
| return closure.raw();
|
| }
|
|
|
| -
|
| void Parser::AddContinuationVariables() {
|
| // Add to current block's scope:
|
| // var :await_jump_var;
|
| @@ -7235,7 +7085,6 @@ void Parser::AddContinuationVariables() {
|
| current_block_->scope->AddVariable(await_ctx_var);
|
| }
|
|
|
| -
|
| void Parser::AddAsyncClosureVariables() {
|
| // Add to current block's scope:
|
| // var :async_op;
|
| @@ -7265,7 +7114,6 @@ void Parser::AddAsyncClosureVariables() {
|
| current_block_->scope->AddVariable(async_stack_trace);
|
| }
|
|
|
| -
|
| void Parser::AddAsyncGeneratorVariables() {
|
| // Add to current block's scope:
|
| // var :controller;
|
| @@ -7305,7 +7153,6 @@ void Parser::AddAsyncGeneratorVariables() {
|
| current_block_->scope->AddVariable(controller_stream);
|
| }
|
|
|
| -
|
| RawFunction* Parser::OpenAsyncGeneratorFunction(TokenPosition async_func_pos) {
|
| TRACE_PARSER("OpenAsyncGeneratorFunction");
|
| AddContinuationVariables();
|
| @@ -7359,7 +7206,6 @@ RawFunction* Parser::OpenAsyncGeneratorFunction(TokenPosition async_func_pos) {
|
| return closure.raw();
|
| }
|
|
|
| -
|
| // Generate the Ast nodes for the implicit code of the async* function.
|
| //
|
| // f(...) async* {
|
| @@ -7429,7 +7275,6 @@ SequenceNode* Parser::CloseAsyncGeneratorFunction(const Function& closure_func,
|
|
|
| TokenPosition token_pos = TokenPosition::kNoSource;
|
|
|
| -
|
| // Add to AST:
|
| // :async_op = <closure>; (containing the original body)
|
| LocalVariable* async_op_var =
|
| @@ -7544,13 +7389,11 @@ SequenceNode* Parser::CloseAsyncGeneratorFunction(const Function& closure_func,
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| void Parser::OpenAsyncGeneratorClosure() {
|
| async_temp_scope_ = current_block_->scope;
|
| OpenAsyncTryBlock();
|
| }
|
|
|
| -
|
| SequenceNode* Parser::CloseAsyncGeneratorClosure(SequenceNode* body) {
|
| // We need a temporary expression to store intermediate return values.
|
| parsed_function()->EnsureExpressionTemp();
|
| @@ -7561,7 +7404,6 @@ SequenceNode* Parser::CloseAsyncGeneratorClosure(SequenceNode* body) {
|
| return new_body;
|
| }
|
|
|
| -
|
| // Add a return node to the sequence if necessary.
|
| void Parser::EnsureHasReturnStatement(SequenceNode* seq,
|
| TokenPosition return_pos) {
|
| @@ -7578,7 +7420,6 @@ void Parser::EnsureHasReturnStatement(SequenceNode* seq,
|
| }
|
| }
|
|
|
| -
|
| SequenceNode* Parser::CloseBlock() {
|
| SequenceNode* statements = current_block_->statements;
|
| if (current_block_->scope != NULL) {
|
| @@ -7591,7 +7432,6 @@ SequenceNode* Parser::CloseBlock() {
|
| return statements;
|
| }
|
|
|
| -
|
| SequenceNode* Parser::CloseAsyncFunction(const Function& closure,
|
| SequenceNode* closure_body) {
|
| TRACE_PARSER("CloseAsyncFunction");
|
| @@ -7744,7 +7584,6 @@ SequenceNode* Parser::CloseAsyncFunction(const Function& closure,
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| SequenceNode* Parser::CloseAsyncClosure(SequenceNode* body,
|
| TokenPosition func_end_pos) {
|
| // We need a temporary expression to store intermediate return values.
|
| @@ -7756,7 +7595,6 @@ SequenceNode* Parser::CloseAsyncClosure(SequenceNode* body,
|
| return new_body;
|
| }
|
|
|
| -
|
| // Set up default values for all optional parameters to the function.
|
| void Parser::SetupDefaultsForOptionalParams(const ParamList& params) {
|
| if ((current_function().raw() == innermost_function().raw()) &&
|
| @@ -7776,7 +7614,6 @@ void Parser::SetupDefaultsForOptionalParams(const ParamList& params) {
|
| }
|
| }
|
|
|
| -
|
| void Parser::FinalizeFormalParameterTypes(const ParamList* params) {
|
| ASSERT((params != NULL) && (params->parameters != NULL));
|
| const int num_parameters = params->parameters->length();
|
| @@ -7792,7 +7629,6 @@ void Parser::FinalizeFormalParameterTypes(const ParamList* params) {
|
| }
|
| }
|
|
|
| -
|
| // Populate the parameter type array and parameter name array of the function
|
| // with the formal parameter types and names.
|
| void Parser::AddFormalParamsToFunction(const ParamList* params,
|
| @@ -7838,7 +7674,6 @@ void Parser::AddFormalParamsToFunction(const ParamList* params,
|
| }
|
| }
|
|
|
| -
|
| // Populate local scope with the formal parameters.
|
| void Parser::AddFormalParamsToScope(const ParamList* params,
|
| LocalScope* scope) {
|
| @@ -7867,7 +7702,6 @@ void Parser::AddFormalParamsToScope(const ParamList* params,
|
| }
|
| }
|
|
|
| -
|
| // Builds ReturnNode/NativeBodyNode for a native function.
|
| void Parser::ParseNativeFunctionBlock(const ParamList* params,
|
| const Function& func) {
|
| @@ -7886,13 +7720,11 @@ void Parser::ParseNativeFunctionBlock(const ParamList* params,
|
| FLAG_link_natives_lazily)));
|
| }
|
|
|
| -
|
| LocalVariable* Parser::LookupReceiver(LocalScope* from_scope, bool test_only) {
|
| ASSERT(!current_function().is_static());
|
| return from_scope->LookupVariable(Symbols::This(), test_only);
|
| }
|
|
|
| -
|
| LocalVariable* Parser::LookupTypeArgumentsParameter(LocalScope* from_scope,
|
| bool test_only) {
|
| ASSERT(current_function().IsInFactoryScope());
|
| @@ -7900,7 +7732,6 @@ LocalVariable* Parser::LookupTypeArgumentsParameter(LocalScope* from_scope,
|
| test_only);
|
| }
|
|
|
| -
|
| void Parser::CaptureInstantiator() {
|
| ASSERT(FunctionLevel() > 0);
|
| const String* variable_name = current_function().IsInFactoryScope()
|
| @@ -7910,7 +7741,6 @@ void Parser::CaptureInstantiator() {
|
| current_block_->scope->LookupVariable(*variable_name, true));
|
| }
|
|
|
| -
|
| void Parser::CaptureFunctionTypeArguments() {
|
| ASSERT(InGenericFunctionScope());
|
| ASSERT(FunctionLevel() > 0);
|
| @@ -7922,7 +7752,6 @@ void Parser::CaptureFunctionTypeArguments() {
|
| current_block_->scope->LookupVariable(*variable_name, true));
|
| }
|
|
|
| -
|
| void Parser::CaptureAllInstantiators() {
|
| if (IsInstantiatorRequired()) {
|
| CaptureInstantiator();
|
| @@ -7932,7 +7761,6 @@ void Parser::CaptureAllInstantiators() {
|
| }
|
| }
|
|
|
| -
|
| AstNode* Parser::LoadReceiver(TokenPosition token_pos) {
|
| // A nested function may access 'this', referring to the receiver of the
|
| // outermost enclosing function.
|
| @@ -7944,14 +7772,12 @@ AstNode* Parser::LoadReceiver(TokenPosition token_pos) {
|
| return new (Z) LoadLocalNode(TokenPos(), receiver);
|
| }
|
|
|
| -
|
| InstanceGetterNode* Parser::CallGetter(TokenPosition token_pos,
|
| AstNode* object,
|
| const String& name) {
|
| return new (Z) InstanceGetterNode(token_pos, object, name);
|
| }
|
|
|
| -
|
| // Returns ast nodes of the variable initialization.
|
| AstNode* Parser::ParseVariableDeclaration(const AbstractType& type,
|
| bool is_final,
|
| @@ -8022,7 +7848,6 @@ AstNode* Parser::ParseVariableDeclaration(const AbstractType& type,
|
| return initialization;
|
| }
|
|
|
| -
|
| // Parses ('var' | 'final' [type] | 'const' [type] | type).
|
| // The presence of 'final' or 'const' must be detected and remembered
|
| // before the call. If a type is parsed, it may be resolved and finalized
|
| @@ -8063,7 +7888,6 @@ RawAbstractType* Parser::ParseConstFinalVarOrType(
|
| return ParseTypeOrFunctionType(false, finalization);
|
| }
|
|
|
| -
|
| // Returns ast nodes of the variable initialization. Variables without an
|
| // explicit initializer are initialized to null. If several variables are
|
| // declared, the individual initializers are collected in a sequence node.
|
| @@ -8109,7 +7933,6 @@ AstNode* Parser::ParseVariableDeclarationList() {
|
| return initializers;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseFunctionStatement(bool is_literal) {
|
| TRACE_PARSER("ParseFunctionStatement");
|
| AbstractType& result_type = AbstractType::Handle(Z, Type::DynamicType());
|
| @@ -8316,11 +8139,11 @@ AstNode* Parser::ParseFunctionStatement(bool is_literal) {
|
|
|
| ASSERT(innermost_function_.raw() == function.raw());
|
| innermost_function_ = function.parent_function();
|
| - return is_literal ? closure : new (Z) StoreLocalNode(
|
| - function_pos, function_variable, closure);
|
| + return is_literal
|
| + ? closure
|
| + : new (Z) StoreLocalNode(function_pos, function_variable, closure);
|
| }
|
|
|
| -
|
| // Returns true if the current and next tokens can be parsed as type
|
| // parameters. Current token position is not saved and restored.
|
| bool Parser::TryParseTypeParameters() {
|
| @@ -8353,7 +8176,6 @@ bool Parser::TryParseTypeParameters() {
|
| return true;
|
| }
|
|
|
| -
|
| // Returns true if the next tokens can be parsed as type parameters.
|
| bool Parser::IsTypeParameters() {
|
| if (CurrentToken() == Token::kLT) {
|
| @@ -8366,7 +8188,6 @@ bool Parser::IsTypeParameters() {
|
| return false;
|
| }
|
|
|
| -
|
| // Returns true if the next tokens are [ typeParameters ] '('.
|
| bool Parser::IsParameterPart() {
|
| if (CurrentToken() == Token::kLPAREN) {
|
| @@ -8382,7 +8203,6 @@ bool Parser::IsParameterPart() {
|
| return false;
|
| }
|
|
|
| -
|
| // Returns true if the current and next tokens can be parsed as type
|
| // arguments. Current token position is not saved and restored.
|
| bool Parser::TryParseTypeArguments() {
|
| @@ -8420,7 +8240,6 @@ bool Parser::TryParseTypeArguments() {
|
| return true;
|
| }
|
|
|
| -
|
| // Returns true if the next tokens are [ typeArguments ] '('.
|
| bool Parser::IsArgumentPart() {
|
| if (CurrentToken() == Token::kLPAREN) {
|
| @@ -8436,7 +8255,6 @@ bool Parser::IsArgumentPart() {
|
| return false;
|
| }
|
|
|
| -
|
| bool Parser::IsSimpleLiteral(const AbstractType& type, Instance* value) {
|
| // Assigning null never causes a type error.
|
| if (CurrentToken() == Token::kNULL) {
|
| @@ -8476,7 +8294,6 @@ bool Parser::IsSimpleLiteral(const AbstractType& type, Instance* value) {
|
| return false;
|
| }
|
|
|
| -
|
| // Returns true if the current token is kIDENT or a pseudo-keyword.
|
| bool Parser::IsIdentifier() {
|
| return Token::IsIdentifier(CurrentToken()) &&
|
| @@ -8486,13 +8303,11 @@ bool Parser::IsIdentifier() {
|
| (CurrentLiteral()->raw() == Symbols::YieldKw().raw())));
|
| }
|
|
|
| -
|
| bool Parser::IsSymbol(const String& symbol) {
|
| return (CurrentLiteral()->raw() == symbol.raw()) &&
|
| (CurrentToken() == Token::kIDENT);
|
| }
|
|
|
| -
|
| // Returns true if the current token is 'Function' followed by '<' or '('.
|
| // 'Function' not followed by '<' or '(' denotes the Function class.
|
| bool Parser::IsFunctionTypeSymbol() {
|
| @@ -8501,7 +8316,6 @@ bool Parser::IsFunctionTypeSymbol() {
|
| (LookaheadToken(1) == Token::kLT));
|
| }
|
|
|
| -
|
| // Returns true if the next tokens can be parsed as a an optionally
|
| // qualified identifier: [ident '.'] ident.
|
| // Current token position is not restored.
|
| @@ -8520,7 +8334,6 @@ bool Parser::TryParseQualIdent() {
|
| return true;
|
| }
|
|
|
| -
|
| // Returns true if the next tokens can be parsed as a type with optional
|
| // type parameters. Current token position is not restored.
|
| // Allow 'void' as type if 'allow_void' is true.
|
| @@ -8560,7 +8373,6 @@ bool Parser::TryParseType(bool allow_void) {
|
| return found;
|
| }
|
|
|
| -
|
| // Look ahead to detect whether the next tokens should be parsed as
|
| // a variable declaration. Ignores optional metadata.
|
| // Returns true if we detect the token pattern:
|
| @@ -8624,7 +8436,6 @@ bool Parser::IsVariableDeclaration() {
|
| return is_var_decl;
|
| }
|
|
|
| -
|
| // Look ahead to see if the following tokens are a return type followed
|
| // by an identifier.
|
| bool Parser::IsFunctionReturnType() {
|
| @@ -8638,7 +8449,6 @@ bool Parser::IsFunctionReturnType() {
|
| return false;
|
| }
|
|
|
| -
|
| // Look ahead to detect whether the next tokens should be parsed as
|
| // a function declaration. Token position remains unchanged.
|
| bool Parser::IsFunctionDeclaration() {
|
| @@ -8682,7 +8492,6 @@ bool Parser::IsFunctionDeclaration() {
|
| return false;
|
| }
|
|
|
| -
|
| bool Parser::IsTopLevelAccessor() {
|
| const TokenPosScope saved_pos(this);
|
| if (CurrentToken() == Token::kEXTERNAL) {
|
| @@ -8701,7 +8510,6 @@ bool Parser::IsTopLevelAccessor() {
|
| return false;
|
| }
|
|
|
| -
|
| bool Parser::IsFunctionLiteral() {
|
| if (!allow_function_literals_) {
|
| return false;
|
| @@ -8724,7 +8532,6 @@ bool Parser::IsFunctionLiteral() {
|
| return false;
|
| }
|
|
|
| -
|
| // Current token position is the token after the opening ( of the for
|
| // statement. Returns true if we recognize a for ( .. in expr)
|
| // statement.
|
| @@ -8750,7 +8557,6 @@ bool Parser::IsForInStatement() {
|
| return false;
|
| }
|
|
|
| -
|
| static bool ContainsAbruptCompletingStatement(SequenceNode* seq);
|
|
|
| static bool IsAbruptCompleting(AstNode* statement) {
|
| @@ -8760,7 +8566,6 @@ static bool IsAbruptCompleting(AstNode* statement) {
|
| ContainsAbruptCompletingStatement(statement->AsSequenceNode()));
|
| }
|
|
|
| -
|
| static bool ContainsAbruptCompletingStatement(SequenceNode* seq) {
|
| for (int i = 0; i < seq->length(); i++) {
|
| if (IsAbruptCompleting(seq->NodeAt(i))) {
|
| @@ -8770,7 +8575,6 @@ static bool ContainsAbruptCompletingStatement(SequenceNode* seq) {
|
| return false;
|
| }
|
|
|
| -
|
| void Parser::ParseStatementSequence() {
|
| TRACE_PARSER("ParseStatementSequence");
|
| const bool dead_code_allowed = true;
|
| @@ -8795,7 +8599,6 @@ void Parser::ParseStatementSequence() {
|
| }
|
| }
|
|
|
| -
|
| // Parse nested statement of if, while, for, etc. We automatically generate
|
| // a sequence of one statement if there are no curly braces.
|
| // The argument 'parsing_loop_body' indicates the parsing of a loop statement.
|
| @@ -8825,7 +8628,6 @@ SequenceNode* Parser::ParseNestedStatement(bool parsing_loop_body,
|
| return sequence;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseIfStatement(String* label_name) {
|
| TRACE_PARSER("ParseIfStatement");
|
| ASSERT(CurrentToken() == Token::kIF);
|
| @@ -8858,7 +8660,6 @@ AstNode* Parser::ParseIfStatement(String* label_name) {
|
| return if_node;
|
| }
|
|
|
| -
|
| // Return true if the type class of the given value implements the
|
| // == operator.
|
| static bool ImplementsEqualOperator(Zone* zone, const Instance& value) {
|
| @@ -8871,7 +8672,6 @@ static bool ImplementsEqualOperator(Zone* zone, const Instance& value) {
|
| return !cls.IsObjectClass();
|
| }
|
|
|
| -
|
| // Check that all case expressions are of the same type, either int, String,
|
| // or any other class that does not override the == operator.
|
| // The expressions are compile-time constants and are thus in the form
|
| @@ -8927,7 +8727,6 @@ RawClass* Parser::CheckCaseExpressions(
|
| return first_value.clazz();
|
| }
|
|
|
| -
|
| CaseNode* Parser::ParseCaseClause(LocalVariable* switch_expr_value,
|
| GrowableArray<LiteralNode*>* case_expr_values,
|
| SourceLabel* case_label) {
|
| @@ -9005,7 +8804,6 @@ CaseNode* Parser::ParseCaseClause(LocalVariable* switch_expr_value,
|
| switch_expr_value, statements);
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseSwitchStatement(String* label_name) {
|
| TRACE_PARSER("ParseSwitchStatement");
|
| ASSERT(CurrentToken() == Token::kSWITCH);
|
| @@ -9104,7 +8902,6 @@ AstNode* Parser::ParseSwitchStatement(String* label_name) {
|
| return new (Z) SwitchNode(switch_pos, label, switch_body);
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseWhileStatement(String* label_name) {
|
| TRACE_PARSER("ParseWhileStatement");
|
| const TokenPosition while_pos = TokenPos();
|
| @@ -9123,7 +8920,6 @@ AstNode* Parser::ParseWhileStatement(String* label_name) {
|
| return while_node;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseDoWhileStatement(String* label_name) {
|
| TRACE_PARSER("ParseDoWhileStatement");
|
| const TokenPosition do_pos = TokenPos();
|
| @@ -9150,7 +8946,6 @@ AstNode* Parser::ParseDoWhileStatement(String* label_name) {
|
| return new (Z) DoWhileNode(do_pos, label, cond_expr, dowhile_body);
|
| }
|
|
|
| -
|
| static LocalVariable* LookupSavedTryContextVar(LocalScope* scope) {
|
| LocalVariable* var =
|
| scope->LocalLookupVariable(Symbols::SavedTryContextVar());
|
| @@ -9158,7 +8953,6 @@ static LocalVariable* LookupSavedTryContextVar(LocalScope* scope) {
|
| return var;
|
| }
|
|
|
| -
|
| static LocalVariable* LookupAsyncSavedTryContextVar(Thread* thread,
|
| LocalScope* scope,
|
| uint16_t try_index) {
|
| @@ -9172,7 +8966,6 @@ static LocalVariable* LookupAsyncSavedTryContextVar(Thread* thread,
|
| return var;
|
| }
|
|
|
| -
|
| // If the await or yield being parsed is in a try block, the continuation code
|
| // needs to restore the corresponding stack-based variable :saved_try_ctx_var,
|
| // and the stack-based variable :saved_try_ctx_var of the outer try block.
|
| @@ -9228,7 +9021,6 @@ void Parser::CheckAsyncOpInTryBlock(
|
| innermost_function().IsSyncGenerator());
|
| }
|
|
|
| -
|
| // Build an AST node for static call to Dart function print(str).
|
| // Used during debugging to insert print in generated dart code.
|
| AstNode* Parser::DartPrint(const char* str) {
|
| @@ -9245,7 +9037,6 @@ AstNode* Parser::DartPrint(const char* str) {
|
| return print_call;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseAwaitForStatement(String* label_name) {
|
| TRACE_PARSER("ParseAwaitForStatement");
|
| ASSERT(IsAwaitKeyword());
|
| @@ -9563,7 +9354,6 @@ AstNode* Parser::ParseAwaitForStatement(String* label_name) {
|
| return CloseBlock(); // Implicit block around while loop.
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseForInStatement(TokenPosition forin_pos,
|
| SourceLabel* label) {
|
| TRACE_PARSER("ParseForInStatement");
|
| @@ -9684,7 +9474,6 @@ AstNode* Parser::ParseForInStatement(TokenPosition forin_pos,
|
| return CloseBlock(); // Implicit block around while loop.
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseForStatement(String* label_name) {
|
| TRACE_PARSER("ParseForStatement");
|
| const TokenPosition for_pos = TokenPos();
|
| @@ -9748,7 +9537,6 @@ AstNode* Parser::ParseForStatement(String* label_name) {
|
| return CloseBlock();
|
| }
|
|
|
| -
|
| // Calling VM-internal helpers, uses implementation core library.
|
| AstNode* Parser::MakeStaticCall(const String& cls_name,
|
| const String& func_name,
|
| @@ -9763,7 +9551,6 @@ AstNode* Parser::MakeStaticCall(const String& cls_name,
|
| return new (Z) StaticCallNode(arguments->token_pos(), func, arguments);
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseAssertStatement(bool is_const) {
|
| TRACE_PARSER("ParseAssertStatement");
|
| ConsumeToken(); // Consume assert keyword.
|
| @@ -9870,7 +9657,6 @@ AstNode* Parser::ParseAssertStatement(bool is_const) {
|
| return assertion_check;
|
| }
|
|
|
| -
|
| // Populate local scope of the catch block with the catch parameters.
|
| void Parser::AddCatchParamsToScope(CatchParamDesc* exception_param,
|
| CatchParamDesc* stack_trace_param,
|
| @@ -9900,7 +9686,6 @@ void Parser::AddCatchParamsToScope(CatchParamDesc* exception_param,
|
| }
|
| }
|
|
|
| -
|
| // Generate code to load the exception object (:exception_var) into
|
| // the saved exception variable (:saved_exception_var) used to rethrow.
|
| // Generate code to load the stack trace object (:stack_trace_var) into
|
| @@ -9930,7 +9715,6 @@ void Parser::SaveExceptionAndStackTrace(SequenceNode* statements,
|
| new (Z) LoadLocalNode(TokenPosition::kNoSource, stack_trace_var)));
|
| }
|
|
|
| -
|
| SequenceNode* Parser::EnsureFinallyClause(
|
| bool parse,
|
| bool is_async,
|
| @@ -9994,20 +9778,17 @@ SequenceNode* Parser::EnsureFinallyClause(
|
| return finally_clause;
|
| }
|
|
|
| -
|
| void Parser::PushTry(Block* try_block) {
|
| intptr_t try_index = AllocateTryIndex();
|
| try_stack_ = new (Z) TryStack(try_block, try_stack_, try_index);
|
| }
|
|
|
| -
|
| Parser::TryStack* Parser::PopTry() {
|
| TryStack* innermost_try = try_stack_;
|
| try_stack_ = try_stack_->outer_try();
|
| return innermost_try;
|
| }
|
|
|
| -
|
| void Parser::AddNodeForFinallyInlining(AstNode* node) {
|
| if (node == NULL) {
|
| return;
|
| @@ -10041,7 +9822,6 @@ void Parser::AddNodeForFinallyInlining(AstNode* node) {
|
| }
|
| }
|
|
|
| -
|
| void Parser::RemoveNodesForFinallyInlining(SourceLabel* label) {
|
| TryStack* iterator = try_stack_;
|
| const intptr_t func_level = FunctionLevel();
|
| @@ -10052,7 +9832,6 @@ void Parser::RemoveNodesForFinallyInlining(SourceLabel* label) {
|
| }
|
| }
|
|
|
| -
|
| // Add the inlined finally clause to the specified node.
|
| void Parser::AddFinallyClauseToNode(bool is_async,
|
| AstNode* node,
|
| @@ -10070,7 +9849,6 @@ void Parser::AddFinallyClauseToNode(bool is_async,
|
| jump_node->AddInlinedFinallyNode(finally_clause);
|
| }
|
|
|
| -
|
| SequenceNode* Parser::ParseCatchClauses(
|
| TokenPosition handler_pos,
|
| bool is_async,
|
| @@ -10272,7 +10050,6 @@ SequenceNode* Parser::ParseCatchClauses(
|
| return current;
|
| }
|
|
|
| -
|
| void Parser::SetupSavedTryContext(LocalVariable* saved_try_context) {
|
| const String& async_saved_try_ctx_name = String::ZoneHandle(
|
| Z, Symbols::NewFormatted(T, "%s%d",
|
| @@ -10289,7 +10066,6 @@ void Parser::SetupSavedTryContext(LocalVariable* saved_try_context) {
|
| new (Z) LoadLocalNode(TokenPosition::kNoSource, saved_try_context)));
|
| }
|
|
|
| -
|
| // We create three variables for exceptions:
|
| // ':saved_try_context_var' - Used to save the context before the start of
|
| // the try block. The context register is
|
| @@ -10356,7 +10132,6 @@ void Parser::SetupExceptionVariables(LocalScope* try_scope,
|
| }
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseTryStatement(String* label_name) {
|
| TRACE_PARSER("ParseTryStatement");
|
|
|
| @@ -10494,7 +10269,6 @@ AstNode* Parser::ParseTryStatement(String* label_name) {
|
| return try_catch_node;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseJump(String* label_name) {
|
| TRACE_PARSER("ParseJump");
|
| ASSERT(CurrentToken() == Token::kBREAK || CurrentToken() == Token::kCONTINUE);
|
| @@ -10561,7 +10335,6 @@ AstNode* Parser::ParseJump(String* label_name) {
|
| return new (Z) JumpNode(jump_pos, jump_kind, target);
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseYieldStatement() {
|
| bool is_yield_each = false;
|
| const TokenPosition yield_pos = TokenPos();
|
| @@ -10700,7 +10473,6 @@ AstNode* Parser::ParseYieldStatement() {
|
| return yield;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseStatement() {
|
| TRACE_PARSER("ParseStatement");
|
| AstNode* statement = NULL;
|
| @@ -10888,13 +10660,11 @@ AstNode* Parser::ParseStatement() {
|
| return statement;
|
| }
|
|
|
| -
|
| void Parser::ReportError(const Error& error) {
|
| Report::LongJump(error);
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void Parser::ReportErrors(const Error& prev_error,
|
| const Script& script,
|
| TokenPosition token_pos,
|
| @@ -10907,7 +10677,6 @@ void Parser::ReportErrors(const Error& prev_error,
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void Parser::ReportError(TokenPosition token_pos,
|
| const char* format,
|
| ...) const {
|
| @@ -10919,7 +10688,6 @@ void Parser::ReportError(TokenPosition token_pos,
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void Parser::ReportErrorBefore(const char* format, ...) {
|
| va_list args;
|
| va_start(args, format);
|
| @@ -10929,7 +10697,6 @@ void Parser::ReportErrorBefore(const char* format, ...) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void Parser::ReportError(const char* format, ...) const {
|
| va_list args;
|
| va_start(args, format);
|
| @@ -10939,7 +10706,6 @@ void Parser::ReportError(const char* format, ...) const {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void Parser::ReportWarning(TokenPosition token_pos,
|
| const char* format,
|
| ...) const {
|
| @@ -10950,7 +10716,6 @@ void Parser::ReportWarning(TokenPosition token_pos,
|
| va_end(args);
|
| }
|
|
|
| -
|
| void Parser::ReportWarning(const char* format, ...) const {
|
| va_list args;
|
| va_start(args, format);
|
| @@ -10959,7 +10724,6 @@ void Parser::ReportWarning(const char* format, ...) const {
|
| va_end(args);
|
| }
|
|
|
| -
|
| void Parser::CheckToken(Token::Kind token_expected, const char* msg) {
|
| if (CurrentToken() != token_expected) {
|
| if (msg != NULL) {
|
| @@ -10970,7 +10734,6 @@ void Parser::CheckToken(Token::Kind token_expected, const char* msg) {
|
| }
|
| }
|
|
|
| -
|
| void Parser::ExpectToken(Token::Kind token_expected) {
|
| if (CurrentToken() != token_expected) {
|
| ReportError("'%s' expected", Token::Str(token_expected));
|
| @@ -10978,7 +10741,6 @@ void Parser::ExpectToken(Token::Kind token_expected) {
|
| ConsumeToken();
|
| }
|
|
|
| -
|
| void Parser::ExpectSemicolon() {
|
| if (CurrentToken() != Token::kSEMICOLON) {
|
| ReportErrorBefore("semicolon expected");
|
| @@ -10986,14 +10748,12 @@ void Parser::ExpectSemicolon() {
|
| ConsumeToken();
|
| }
|
|
|
| -
|
| void Parser::UnexpectedToken() {
|
| ReportError("unexpected token '%s'", CurrentToken() == Token::kIDENT
|
| ? CurrentLiteral()->ToCString()
|
| : Token::Str(CurrentToken()));
|
| }
|
|
|
| -
|
| String* Parser::ExpectUserDefinedTypeIdentifier(const char* msg) {
|
| if (CurrentToken() != Token::kIDENT) {
|
| ReportError("%s", msg);
|
| @@ -11006,7 +10766,6 @@ String* Parser::ExpectUserDefinedTypeIdentifier(const char* msg) {
|
| return ident;
|
| }
|
|
|
| -
|
| // Check whether current token is an identifier or a built-in identifier.
|
| String* Parser::ExpectIdentifier(const char* msg) {
|
| if (!IsIdentifier()) {
|
| @@ -11017,30 +10776,25 @@ String* Parser::ExpectIdentifier(const char* msg) {
|
| return ident;
|
| }
|
|
|
| -
|
| bool Parser::IsAwaitKeyword() {
|
| return (FLAG_await_is_keyword || await_is_keyword_) &&
|
| IsSymbol(Symbols::Await());
|
| }
|
|
|
| -
|
| bool Parser::IsYieldKeyword() {
|
| return (FLAG_await_is_keyword || await_is_keyword_) &&
|
| IsSymbol(Symbols::YieldKw());
|
| }
|
|
|
| -
|
| static bool IsIncrementOperator(Token::Kind token) {
|
| return token == Token::kINCR || token == Token::kDECR;
|
| }
|
|
|
| -
|
| static bool IsPrefixOperator(Token::Kind token) {
|
| return (token == Token::kSUB) || (token == Token::kNOT) ||
|
| (token == Token::kBIT_NOT);
|
| }
|
|
|
| -
|
| SequenceNode* Parser::NodeAsSequenceNode(TokenPosition sequence_pos,
|
| AstNode* node,
|
| LocalScope* scope) {
|
| @@ -11054,7 +10808,6 @@ SequenceNode* Parser::NodeAsSequenceNode(TokenPosition sequence_pos,
|
| return node->AsSequenceNode();
|
| }
|
|
|
| -
|
| // Call _throwNewIfNotLoaded if prefix is not NULL, otherwise call _throwNew.
|
| AstNode* Parser::ThrowTypeError(TokenPosition type_pos,
|
| const AbstractType& type,
|
| @@ -11084,7 +10837,6 @@ AstNode* Parser::ThrowTypeError(TokenPosition type_pos,
|
| return MakeStaticCall(Symbols::TypeError(), method_name, arguments);
|
| }
|
|
|
| -
|
| // Call _throwNewIfNotLoaded if prefix is not NULL, otherwise call _throwNew.
|
| AstNode* Parser::ThrowNoSuchMethodError(TokenPosition call_pos,
|
| const Class& cls,
|
| @@ -11178,7 +10930,6 @@ AstNode* Parser::ThrowNoSuchMethodError(TokenPosition call_pos,
|
| return MakeStaticCall(Symbols::NoSuchMethodError(), method_name, arguments);
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseBinaryExpr(int min_preced) {
|
| TRACE_PARSER("ParseBinaryExpr");
|
| ASSERT(min_preced >= Token::Precedence(Token::kIFNULL));
|
| @@ -11241,7 +10992,6 @@ AstNode* Parser::ParseBinaryExpr(int min_preced) {
|
| return left_operand;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseAwaitableExprList() {
|
| TRACE_PARSER("ParseAwaitableExprList");
|
| SequenceNode* preamble = NULL;
|
| @@ -11270,13 +11020,11 @@ AstNode* Parser::ParseAwaitableExprList() {
|
| return expressions;
|
| }
|
|
|
| -
|
| void Parser::EnsureExpressionTemp() {
|
| // Temporary used later by the flow_graph_builder.
|
| parsed_function()->EnsureExpressionTemp();
|
| }
|
|
|
| -
|
| LocalVariable* Parser::CreateTempConstVariable(TokenPosition token_pos,
|
| const char* s) {
|
| char name[64];
|
| @@ -11289,7 +11037,6 @@ LocalVariable* Parser::CreateTempConstVariable(TokenPosition token_pos,
|
| return temp;
|
| }
|
|
|
| -
|
| AstNode* Parser::OptimizeBinaryOpNode(TokenPosition op_pos,
|
| Token::Kind binary_op,
|
| AstNode* lhs,
|
| @@ -11344,7 +11091,6 @@ AstNode* Parser::OptimizeBinaryOpNode(TokenPosition op_pos,
|
| return new (Z) BinaryOpNode(op_pos, binary_op, lhs, rhs);
|
| }
|
|
|
| -
|
| AstNode* Parser::ExpandAssignableOp(TokenPosition op_pos,
|
| Token::Kind assignment_op,
|
| AstNode* lhs,
|
| @@ -11386,7 +11132,6 @@ AstNode* Parser::ExpandAssignableOp(TokenPosition op_pos,
|
| }
|
| }
|
|
|
| -
|
| // Evaluates the value of the compile time constant expression
|
| // and returns a literal node for the value.
|
| LiteralNode* Parser::FoldConstExpr(TokenPosition expr_pos, AstNode* expr) {
|
| @@ -11399,7 +11144,6 @@ LiteralNode* Parser::FoldConstExpr(TokenPosition expr_pos, AstNode* expr) {
|
| return new (Z) LiteralNode(expr_pos, EvaluateConstExpr(expr_pos, expr));
|
| }
|
|
|
| -
|
| LetNode* Parser::PrepareCompoundAssignmentNodes(AstNode** expr) {
|
| AstNode* node = *expr;
|
| TokenPosition token_pos = node->token_pos();
|
| @@ -11434,7 +11178,6 @@ LetNode* Parser::PrepareCompoundAssignmentNodes(AstNode** expr) {
|
| return result;
|
| }
|
|
|
| -
|
| // Check whether the syntax of expression expr is a grammatically legal
|
| // assignable expression. This check is used to detect situations where
|
| // the expression itself is assignable, but the source is grammatically
|
| @@ -11456,7 +11199,6 @@ bool Parser::IsLegalAssignableSyntax(AstNode* expr, TokenPosition end_pos) {
|
| return Token::IsIdentifier(token) || (token == Token::kRBRACK);
|
| }
|
|
|
| -
|
| AstNode* Parser::CreateAssignmentNode(AstNode* original,
|
| AstNode* rhs,
|
| const String* left_ident,
|
| @@ -11507,7 +11249,6 @@ AstNode* Parser::CreateAssignmentNode(AstNode* original,
|
| return result;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseCascades(AstNode* expr) {
|
| TokenPosition cascade_pos = TokenPos();
|
| LetNode* cascade = new (Z) LetNode(cascade_pos);
|
| @@ -11564,7 +11305,6 @@ AstNode* Parser::ParseCascades(AstNode* expr) {
|
| return cascade;
|
| }
|
|
|
| -
|
| // Convert loading of a static const field into a literal node.
|
| static AstNode* LiteralIfStaticConst(Zone* zone, AstNode* expr) {
|
| if (expr->IsLoadStaticFieldNode()) {
|
| @@ -11580,7 +11320,6 @@ static AstNode* LiteralIfStaticConst(Zone* zone, AstNode* expr) {
|
| return expr;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseAwaitableExpr(bool require_compiletime_const,
|
| bool consume_cascades,
|
| SequenceNode** await_preamble) {
|
| @@ -11606,7 +11345,6 @@ AstNode* Parser::ParseAwaitableExpr(bool require_compiletime_const,
|
| return expr;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseExpr(bool require_compiletime_const,
|
| bool consume_cascades) {
|
| TRACE_PARSER("ParseExpr");
|
| @@ -11681,7 +11419,6 @@ AstNode* Parser::ParseExpr(bool require_compiletime_const,
|
| }
|
| }
|
|
|
| -
|
| LiteralNode* Parser::ParseConstExpr() {
|
| TRACE_PARSER("ParseConstExpr");
|
| TokenPosition expr_pos = TokenPos();
|
| @@ -11692,7 +11429,6 @@ LiteralNode* Parser::ParseConstExpr() {
|
| return expr->AsLiteralNode();
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseConditionalExpr() {
|
| TRACE_PARSER("ParseConditionalExpr");
|
| const TokenPosition expr_pos = TokenPos();
|
| @@ -11708,7 +11444,6 @@ AstNode* Parser::ParseConditionalExpr() {
|
| return expr;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseUnaryExpr() {
|
| TRACE_PARSER("ParseUnaryExpr");
|
| AstNode* expr = NULL;
|
| @@ -11773,7 +11508,6 @@ AstNode* Parser::ParseUnaryExpr() {
|
| return expr;
|
| }
|
|
|
| -
|
| ArgumentListNode* Parser::ParseActualParameters(
|
| ArgumentListNode* implicit_arguments,
|
| const TypeArguments& func_type_args,
|
| @@ -11835,7 +11569,6 @@ ArgumentListNode* Parser::ParseActualParameters(
|
| return arguments;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseStaticCall(const Class& cls,
|
| const String& func_name,
|
| TokenPosition ident_pos,
|
| @@ -11914,7 +11647,6 @@ AstNode* Parser::ParseStaticCall(const Class& cls,
|
| return new (Z) StaticCallNode(ident_pos, func, arguments);
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseInstanceCall(AstNode* receiver,
|
| const String& func_name,
|
| TokenPosition ident_pos,
|
| @@ -11928,7 +11660,6 @@ AstNode* Parser::ParseInstanceCall(AstNode* receiver,
|
| is_conditional);
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseClosureCall(AstNode* closure,
|
| const TypeArguments& func_type_args) {
|
| TRACE_PARSER("ParseClosureCall");
|
| @@ -11939,7 +11670,6 @@ AstNode* Parser::ParseClosureCall(AstNode* closure,
|
| return BuildClosureCall(call_pos, closure, arguments);
|
| }
|
|
|
| -
|
| AstNode* Parser::GenerateStaticFieldLookup(const Field& field,
|
| TokenPosition ident_pos) {
|
| // If the static field has an initializer, initialize the field at compile
|
| @@ -11970,7 +11700,6 @@ AstNode* Parser::GenerateStaticFieldLookup(const Field& field,
|
| }
|
| }
|
|
|
| -
|
| // Reference to 'field_name' with explicit class as primary.
|
| AstNode* Parser::GenerateStaticFieldAccess(const Class& cls,
|
| const String& field_name,
|
| @@ -12007,7 +11736,6 @@ AstNode* Parser::GenerateStaticFieldAccess(const Class& cls,
|
| return access;
|
| }
|
|
|
| -
|
| AstNode* Parser::LoadFieldIfUnresolved(AstNode* node) {
|
| if (!node->IsPrimaryNode()) {
|
| return node;
|
| @@ -12046,7 +11774,6 @@ AstNode* Parser::LoadFieldIfUnresolved(AstNode* node) {
|
| return primary;
|
| }
|
|
|
| -
|
| AstNode* Parser::LoadClosure(PrimaryNode* primary) {
|
| ASSERT(primary->primary().IsFunction());
|
| const Function& func =
|
| @@ -12073,7 +11800,6 @@ AstNode* Parser::LoadClosure(PrimaryNode* primary) {
|
| return NULL;
|
| }
|
|
|
| -
|
| AstNode* Parser::LoadTypeParameter(PrimaryNode* primary) {
|
| const TokenPosition primary_pos = primary->token_pos();
|
| TypeParameter& type_parameter = TypeParameter::ZoneHandle(Z);
|
| @@ -12107,7 +11833,6 @@ AstNode* Parser::LoadTypeParameter(PrimaryNode* primary) {
|
| return new (Z) TypeNode(primary_pos, type_parameter);
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseSelectors(AstNode* primary, bool is_cascade) {
|
| AstNode* left = primary;
|
| while (true) {
|
| @@ -12355,7 +12080,6 @@ AstNode* Parser::ParseSelectors(AstNode* primary, bool is_cascade) {
|
| }
|
| }
|
|
|
| -
|
| // Closurization e#m of getter, setter, method or operator.
|
| AstNode* Parser::ParseClosurization(AstNode* primary) {
|
| if (!FLAG_support_deprecated_tearoff_syntax) {
|
| @@ -12511,7 +12235,6 @@ AstNode* Parser::ParseClosurization(AstNode* primary) {
|
| return new (Z) InstanceGetterNode(property_pos, primary, extractor_name);
|
| }
|
|
|
| -
|
| AstNode* Parser::ParsePostfixExpr() {
|
| TRACE_PARSER("ParsePostfixExpr");
|
| String* expr_ident =
|
| @@ -12552,7 +12275,6 @@ AstNode* Parser::ParsePostfixExpr() {
|
| return expr;
|
| }
|
|
|
| -
|
| // Resolve the type parameters that may appear in the given signature from the
|
| // signature function and current class.
|
| // Unresolved type classes get resolved later by the class finalizer.
|
| @@ -12588,7 +12310,6 @@ void Parser::ResolveSignature(const Function& signature) {
|
| innermost_function_ = saved_innermost_function.raw();
|
| }
|
|
|
| -
|
| // Resolve the type parameters that may appear in the given type and in its type
|
| // arguments from the current function and current class.
|
| // Unresolved type classes get resolved later by the class finalizer.
|
| @@ -12688,7 +12409,6 @@ void Parser::ResolveType(AbstractType* type) {
|
| }
|
| }
|
|
|
| -
|
| RawAbstractType* Parser::CanonicalizeType(const AbstractType& type) {
|
| // If the current class is the result of a mixin application, we must
|
| // use the class scope of the class from which the function originates.
|
| @@ -12699,7 +12419,6 @@ RawAbstractType* Parser::CanonicalizeType(const AbstractType& type) {
|
| return ClassFinalizer::FinalizeType(current_class(), type);
|
| }
|
|
|
| -
|
| LocalVariable* Parser::LookupLocalScope(const String& ident) {
|
| if (current_block_ == NULL) {
|
| return NULL;
|
| @@ -12709,7 +12428,6 @@ LocalVariable* Parser::LookupLocalScope(const String& ident) {
|
| return current_block_->scope->LookupVariable(ident, kTestOnly);
|
| }
|
|
|
| -
|
| void Parser::CheckInstanceFieldAccess(TokenPosition field_pos,
|
| const String& field_name) {
|
| // Fields are not accessible from a static function, except from a
|
| @@ -12721,7 +12439,6 @@ void Parser::CheckInstanceFieldAccess(TokenPosition field_pos,
|
| }
|
| }
|
|
|
| -
|
| bool Parser::ParsingStaticMember() const {
|
| if (is_top_level_) {
|
| return (current_member_ != NULL) && current_member_->has_static &&
|
| @@ -12732,7 +12449,6 @@ bool Parser::ParsingStaticMember() const {
|
| !current_function().IsInFactoryScope();
|
| }
|
|
|
| -
|
| const AbstractType* Parser::ReceiverType(const Class& cls) {
|
| ASSERT(!cls.IsNull());
|
| ASSERT(!cls.IsTypedefClass());
|
| @@ -12752,7 +12468,6 @@ const AbstractType* Parser::ReceiverType(const Class& cls) {
|
| return &type;
|
| }
|
|
|
| -
|
| bool Parser::IsInstantiatorRequired() const {
|
| ASSERT(!current_function().IsNull());
|
| if (current_function().is_static() &&
|
| @@ -12762,7 +12477,6 @@ bool Parser::IsInstantiatorRequired() const {
|
| return current_class().IsGeneric();
|
| }
|
|
|
| -
|
| bool Parser::InGenericFunctionScope() const {
|
| if (!innermost_function().IsNull()) {
|
| // With one more free tag bit in Function, we could cache this information.
|
| @@ -12774,7 +12488,6 @@ bool Parser::InGenericFunctionScope() const {
|
| return false;
|
| }
|
|
|
| -
|
| void Parser::InsertCachedConstantValue(const Script& script,
|
| TokenPosition token_pos,
|
| const Instance& value) {
|
| @@ -12791,7 +12504,6 @@ void Parser::InsertCachedConstantValue(const Script& script,
|
| script.set_compile_time_constants(constants.Release());
|
| }
|
|
|
| -
|
| void Parser::CacheConstantValue(TokenPosition token_pos,
|
| const Instance& value) {
|
| if (current_function().kind() == RawFunction::kImplicitStaticFinalGetter) {
|
| @@ -12803,7 +12515,6 @@ void Parser::CacheConstantValue(TokenPosition token_pos,
|
| INC_STAT(thread_, num_cached_consts, 1);
|
| }
|
|
|
| -
|
| bool Parser::GetCachedConstant(TokenPosition token_pos, Instance* value) {
|
| bool is_present = false;
|
| ASSERT(!script_.InVMHeap());
|
| @@ -12822,7 +12533,6 @@ bool Parser::GetCachedConstant(TokenPosition token_pos, Instance* value) {
|
| return is_present;
|
| }
|
|
|
| -
|
| RawInstance* Parser::TryCanonicalize(const Instance& instance,
|
| TokenPosition token_pos) {
|
| if (instance.IsNull()) {
|
| @@ -12837,7 +12547,6 @@ RawInstance* Parser::TryCanonicalize(const Instance& instance,
|
| return result.raw();
|
| }
|
|
|
| -
|
| // If the field is already initialized, return no ast (NULL).
|
| // Otherwise, if the field is constant, initialize the field and return no ast.
|
| // If the field is not initialized and not const, return the ast for the getter.
|
| @@ -12916,7 +12625,6 @@ StaticGetterNode* Parser::RunStaticFieldInitializer(
|
| return new (Z) StaticGetterNode(field_ref_pos, NULL, field_owner, field_name);
|
| }
|
|
|
| -
|
| RawObject* Parser::EvaluateConstConstructorCall(
|
| const Class& type_class,
|
| const TypeArguments& type_arguments,
|
| @@ -12980,7 +12688,6 @@ RawObject* Parser::EvaluateConstConstructorCall(
|
| }
|
| }
|
|
|
| -
|
| // Do a lookup for the identifier in the block scope and the class scope
|
| // return true if the identifier is found, false otherwise.
|
| // If node is non NULL return an AST node corresponding to the identifier.
|
| @@ -13088,7 +12795,6 @@ bool Parser::ResolveIdentInLocalScope(TokenPosition ident_pos,
|
| return false;
|
| }
|
|
|
| -
|
| // Resolve an identifier by checking the global scope of the current
|
| // library. If not found in the current library, then look in the scopes
|
| // of all libraries that are imported without a library prefix.
|
| @@ -13132,7 +12838,6 @@ AstNode* Parser::ResolveIdentInCurrentLibraryScope(TokenPosition ident_pos,
|
| return new (Z) PrimaryNode(ident_pos, ident);
|
| }
|
|
|
| -
|
| // Do a lookup for the identifier in the scope of the specified
|
| // library prefix. This means trying to resolve it locally in all of the
|
| // libraries present in the library prefix.
|
| @@ -13211,7 +12916,6 @@ AstNode* Parser::ResolveIdentInPrefixScope(TokenPosition ident_pos,
|
| return NULL;
|
| }
|
|
|
| -
|
| // Resolve identifier. Issue an error message if
|
| // the ident refers to a method and allow_closure_names is false.
|
| // If the name cannot be resolved, turn it into an instance field access
|
| @@ -13302,7 +13006,6 @@ AstNode* Parser::ResolveIdent(TokenPosition ident_pos,
|
| return resolved;
|
| }
|
|
|
| -
|
| RawAbstractType* Parser::ParseType(
|
| ClassFinalizer::FinalizationKind finalization,
|
| bool allow_deferred_type,
|
| @@ -13312,7 +13015,6 @@ RawAbstractType* Parser::ParseType(
|
| &prefix);
|
| }
|
|
|
| -
|
| // Parses and returns a type or a function type.
|
| RawAbstractType* Parser::ParseTypeOrFunctionType(
|
| bool allow_void,
|
| @@ -13353,7 +13055,6 @@ RawAbstractType* Parser::ParseTypeOrFunctionType(
|
| return type.raw();
|
| }
|
|
|
| -
|
| // Parses and returns a function type.
|
| // If 'result_type' is not null, parsing of the result type is skipped.
|
| RawType* Parser::ParseFunctionType(
|
| @@ -13430,7 +13131,6 @@ RawType* Parser::ParseFunctionType(
|
| return Type::RawCast(type.raw());
|
| }
|
|
|
| -
|
| // Parses type = [ident "."] ident ["<" type { "," type } ">"], then resolve and
|
| // finalize it according to the given type finalization mode.
|
| // Returns type and sets prefix.
|
| @@ -13517,9 +13217,10 @@ RawAbstractType* Parser::ParseType(
|
| ParseTypeArguments(ClassFinalizer::kIgnore);
|
| return ClassFinalizer::NewFinalizedMalformedType(
|
| Error::Handle(Z), // No previous error.
|
| - script_, ident_pos, !prefix->is_loaded() && allow_deferred_type
|
| - ? "deferred type '%s.%s' is not yet loaded"
|
| - : "using deferred type '%s.%s' is invalid",
|
| + script_, ident_pos,
|
| + !prefix->is_loaded() && allow_deferred_type
|
| + ? "deferred type '%s.%s' is not yet loaded"
|
| + : "using deferred type '%s.%s' is invalid",
|
| String::Handle(Z, prefix->name()).ToCString(),
|
| type_name.ToCString());
|
| }
|
| @@ -13546,7 +13247,6 @@ RawAbstractType* Parser::ParseType(
|
| return type.raw();
|
| }
|
|
|
| -
|
| void Parser::CheckConstructorCallTypeArguments(
|
| TokenPosition pos,
|
| const Function& constructor,
|
| @@ -13564,7 +13264,6 @@ void Parser::CheckConstructorCallTypeArguments(
|
| }
|
| }
|
|
|
| -
|
| // Parse "[" [ expr { "," expr } ["," ] "]".
|
| // Note: if the list literal is empty and the brackets have no whitespace
|
| // between them, the scanner recognizes the opening and closing bracket
|
| @@ -13727,7 +13426,6 @@ AstNode* Parser::ParseListLiteral(TokenPosition type_pos,
|
| }
|
| }
|
|
|
| -
|
| ConstructorCallNode* Parser::CreateConstructorCallNode(
|
| TokenPosition token_pos,
|
| const TypeArguments& type_arguments,
|
| @@ -13740,7 +13438,6 @@ ConstructorCallNode* Parser::CreateConstructorCallNode(
|
| ConstructorCallNode(token_pos, type_arguments, constructor, arguments);
|
| }
|
|
|
| -
|
| static void AddKeyValuePair(GrowableArray<AstNode*>* pairs,
|
| bool is_const,
|
| AstNode* key,
|
| @@ -13765,7 +13462,6 @@ static void AddKeyValuePair(GrowableArray<AstNode*>* pairs,
|
| pairs->Add(value);
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseMapLiteral(TokenPosition type_pos,
|
| bool is_const,
|
| const TypeArguments& type_arguments) {
|
| @@ -13985,7 +13681,6 @@ AstNode* Parser::ParseMapLiteral(TokenPosition type_pos,
|
| return NULL;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseCompoundLiteral() {
|
| TRACE_PARSER("ParseCompoundLiteral");
|
| bool is_const = false;
|
| @@ -14011,7 +13706,6 @@ AstNode* Parser::ParseCompoundLiteral() {
|
| return primary;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseSymbolLiteral() {
|
| ASSERT(CurrentToken() == Token::kHASH);
|
| ConsumeToken();
|
| @@ -14061,7 +13755,6 @@ AstNode* Parser::ParseSymbolLiteral() {
|
| return new (Z) LiteralNode(symbol_pos, symbol_instance);
|
| }
|
|
|
| -
|
| RawFunction* Parser::BuildConstructorClosureFunction(const Function& ctr,
|
| TokenPosition token_pos) {
|
| ASSERT(ctr.kind() == RawFunction::kConstructor);
|
| @@ -14104,7 +13797,6 @@ RawFunction* Parser::BuildConstructorClosureFunction(const Function& ctr,
|
| return closure.raw();
|
| }
|
|
|
| -
|
| static String& BuildConstructorName(Thread* thread,
|
| const String& type_class_name,
|
| const String* named_constructor) {
|
| @@ -14122,7 +13814,6 @@ static String& BuildConstructorName(Thread* thread,
|
| return constructor_name;
|
| }
|
|
|
| -
|
| // Parse a primary expression of the form new T# or new T#m.
|
| // Current token position is after the keyword new. Extracts the
|
| // anonymous or named constructor and type arguments.
|
| @@ -14185,7 +13876,6 @@ void Parser::ParseConstructorClosurization(Function* constructor,
|
| }
|
| }
|
|
|
| -
|
| AstNode* Parser::ParseNewOperator(Token::Kind op_kind) {
|
| TRACE_PARSER("ParseNewOperator");
|
| const TokenPosition new_pos = TokenPos();
|
| @@ -14539,7 +14229,6 @@ AstNode* Parser::ParseNewOperator(Token::Kind op_kind) {
|
| return new_object;
|
| }
|
|
|
| -
|
| String& Parser::Interpolate(const GrowableArray<AstNode*>& values) {
|
| NoReloadScope no_reload_scope(isolate(), thread());
|
| NoOOBMessageScope no_msg_scope(thread());
|
| @@ -14575,7 +14264,6 @@ String& Parser::Interpolate(const GrowableArray<AstNode*>& values) {
|
| return concatenated;
|
| }
|
|
|
| -
|
| // A string literal consists of the concatenation of the next n tokens
|
| // that satisfy the EBNF grammar:
|
| // literal = kSTRING {{ interpol } kSTRING }
|
| @@ -14680,7 +14368,6 @@ AstNode* Parser::ParseStringLiteral(bool allow_interpolation) {
|
| return primary;
|
| }
|
|
|
| -
|
| AstNode* Parser::ParsePrimary() {
|
| TRACE_PARSER("ParsePrimary");
|
| ASSERT(!is_top_level_);
|
| @@ -14893,7 +14580,6 @@ AstNode* Parser::ParsePrimary() {
|
| return primary;
|
| }
|
|
|
| -
|
| // Evaluate expression in expr and return the value. The expression must
|
| // be a compile time constant.
|
| const Instance& Parser::EvaluateConstExpr(TokenPosition expr_pos,
|
| @@ -14951,7 +14637,6 @@ const Instance& Parser::EvaluateConstExpr(TokenPosition expr_pos,
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipFunctionLiteral() {
|
| if (IsIdentifier()) {
|
| if (LookaheadToken(1) != Token::kLPAREN) {
|
| @@ -14974,7 +14659,6 @@ void Parser::SkipFunctionLiteral() {
|
| }
|
| }
|
|
|
| -
|
| // Skips function/method/constructor/getter/setter preambles until the formal
|
| // parameter list. It is enough to skip the tokens, since we have already
|
| // previously parsed the function.
|
| @@ -15011,7 +14695,6 @@ void Parser::SkipFunctionPreamble() {
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipListLiteral() {
|
| if (CurrentToken() == Token::kINDEX) {
|
| // Empty list literal.
|
| @@ -15030,7 +14713,6 @@ void Parser::SkipListLiteral() {
|
| ExpectToken(Token::kRBRACK);
|
| }
|
|
|
| -
|
| void Parser::SkipMapLiteral() {
|
| ExpectToken(Token::kLBRACE);
|
| while (CurrentToken() != Token::kRBRACE) {
|
| @@ -15046,7 +14728,6 @@ void Parser::SkipMapLiteral() {
|
| ExpectToken(Token::kRBRACE);
|
| }
|
|
|
| -
|
| void Parser::SkipActualParameters() {
|
| if (CurrentToken() == Token::kLT) {
|
| SkipTypeArguments();
|
| @@ -15066,7 +14747,6 @@ void Parser::SkipActualParameters() {
|
| ExpectToken(Token::kRPAREN);
|
| }
|
|
|
| -
|
| void Parser::SkipCompoundLiteral() {
|
| if (CurrentToken() == Token::kLT) {
|
| SkipTypeArguments();
|
| @@ -15078,7 +14758,6 @@ void Parser::SkipCompoundLiteral() {
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipSymbolLiteral() {
|
| ConsumeToken(); // Hash sign.
|
| if (IsIdentifier()) {
|
| @@ -15094,7 +14773,6 @@ void Parser::SkipSymbolLiteral() {
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipNewOperator() {
|
| ConsumeToken(); // Skip new or const keyword.
|
| if (IsIdentifier()) {
|
| @@ -15116,7 +14794,6 @@ void Parser::SkipNewOperator() {
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipStringLiteral() {
|
| ASSERT(CurrentToken() == Token::kSTRING);
|
| while (CurrentToken() == Token::kSTRING) {
|
| @@ -15137,7 +14814,6 @@ void Parser::SkipStringLiteral() {
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipPrimary() {
|
| if (IsFunctionLiteral()) {
|
| SkipFunctionLiteral();
|
| @@ -15198,7 +14874,6 @@ void Parser::SkipPrimary() {
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipSelectors() {
|
| while (true) {
|
| const Token::Kind current_token = CurrentToken();
|
| @@ -15244,7 +14919,6 @@ void Parser::SkipPostfixExpr() {
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipUnaryExpr() {
|
| if (IsPrefixOperator(CurrentToken()) || IsIncrementOperator(CurrentToken()) ||
|
| IsAwaitKeyword()) {
|
| @@ -15255,7 +14929,6 @@ void Parser::SkipUnaryExpr() {
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipBinaryExpr() {
|
| SkipUnaryExpr();
|
| const int min_prec = Token::Precedence(Token::kIFNULL);
|
| @@ -15278,7 +14951,6 @@ void Parser::SkipBinaryExpr() {
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipConditionalExpr() {
|
| SkipBinaryExpr();
|
| if (CurrentToken() == Token::kCONDITIONAL) {
|
| @@ -15289,7 +14961,6 @@ void Parser::SkipConditionalExpr() {
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipExpr() {
|
| while (CurrentToken() == Token::kTHROW) {
|
| ConsumeToken();
|
| @@ -15304,14 +14975,12 @@ void Parser::SkipExpr() {
|
| }
|
| }
|
|
|
| -
|
| void Parser::SkipNestedExpr() {
|
| const bool saved_mode = SetAllowFunctionLiterals(true);
|
| SkipExpr();
|
| SetAllowFunctionLiterals(saved_mode);
|
| }
|
|
|
| -
|
| void Parser::SkipQualIdent() {
|
| ASSERT(IsIdentifier());
|
| ConsumeToken();
|
| @@ -15323,96 +14992,79 @@ void Parser::SkipQualIdent() {
|
|
|
| } // namespace dart
|
|
|
| -
|
| #else // DART_PRECOMPILED_RUNTIME
|
|
|
| -
|
| namespace dart {
|
|
|
| void ParsedFunction::AddToGuardedFields(const Field* field) const {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| kernel::ScopeBuildingResult* ParsedFunction::EnsureKernelScopes() {
|
| UNREACHABLE();
|
| return NULL;
|
| }
|
|
|
| -
|
| LocalVariable* ParsedFunction::EnsureExpressionTemp() {
|
| UNREACHABLE();
|
| return NULL;
|
| }
|
|
|
| -
|
| void ParsedFunction::SetNodeSequence(SequenceNode* node_sequence) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void ParsedFunction::SetRegExpCompileData(
|
| RegExpCompileData* regexp_compile_data) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void ParsedFunction::AllocateVariables() {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void ParsedFunction::AllocateIrregexpVariables(intptr_t num_stack_locals) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void ParsedFunction::Bailout(const char* origin, const char* reason) const {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void Parser::ParseCompilationUnit(const Library& library,
|
| const Script& script) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void Parser::ParseClass(const Class& cls) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| RawObject* Parser::ParseFunctionParameters(const Function& func) {
|
| UNREACHABLE();
|
| return Object::null();
|
| }
|
|
|
| -
|
| void Parser::ParseFunction(ParsedFunction* parsed_function) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| RawObject* Parser::ParseMetadata(const Field& meta_data) {
|
| UNREACHABLE();
|
| return Object::null();
|
| }
|
|
|
| -
|
| ParsedFunction* Parser::ParseStaticFieldInitializer(const Field& field) {
|
| UNREACHABLE();
|
| return NULL;
|
| }
|
|
|
| -
|
| void Parser::InsertCachedConstantValue(const Script& script,
|
| TokenPosition token_pos,
|
| const Instance& value) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| ArgumentListNode* Parser::BuildNoSuchMethodArguments(
|
| TokenPosition call_pos,
|
| const String& function_name,
|
| @@ -15430,7 +15082,6 @@ bool Parser::FieldHasFunctionLiteralInitializer(const Field& field,
|
| return false;
|
| }
|
|
|
| -
|
| } // namespace dart
|
|
|
| #endif // DART_PRECOMPILED_RUNTIME
|
|
|