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

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

Issue 2419013004: Add local variable declaration token position to service protocol (Closed)
Patch Set: test closure variables Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/parser.h" 5 #include "vm/parser.h"
6 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 String::Handle(function_.name()).ToCString(), 223 String::Handle(function_.name()).ToCString(),
224 reason); 224 reason);
225 UNREACHABLE(); 225 UNREACHABLE();
226 } 226 }
227 227
228 228
229 LocalVariable* ParsedFunction::EnsureExpressionTemp() { 229 LocalVariable* ParsedFunction::EnsureExpressionTemp() {
230 if (!has_expression_temp_var()) { 230 if (!has_expression_temp_var()) {
231 LocalVariable* temp = 231 LocalVariable* temp =
232 new (Z) LocalVariable(function_.token_pos(), 232 new (Z) LocalVariable(function_.token_pos(),
233 function_.token_pos(),
233 Symbols::ExprTemp(), 234 Symbols::ExprTemp(),
234 Object::dynamic_type()); 235 Object::dynamic_type());
235 ASSERT(temp != NULL); 236 ASSERT(temp != NULL);
236 set_expression_temp_var(temp); 237 set_expression_temp_var(temp);
237 } 238 }
238 ASSERT(has_expression_temp_var()); 239 ASSERT(has_expression_temp_var());
239 return expression_temp_var(); 240 return expression_temp_var();
240 } 241 }
241 242
242 243
243 void ParsedFunction::EnsureFinallyReturnTemp(bool is_async) { 244 void ParsedFunction::EnsureFinallyReturnTemp(bool is_async) {
244 if (!has_finally_return_temp_var()) { 245 if (!has_finally_return_temp_var()) {
245 LocalVariable* temp = new(Z) LocalVariable( 246 LocalVariable* temp = new(Z) LocalVariable(
246 function_.token_pos(), 247 function_.token_pos(),
248 function_.token_pos(),
247 Symbols::FinallyRetVal(), 249 Symbols::FinallyRetVal(),
248 Object::dynamic_type()); 250 Object::dynamic_type());
249 ASSERT(temp != NULL); 251 ASSERT(temp != NULL);
250 temp->set_is_final(); 252 temp->set_is_final();
251 if (is_async) { 253 if (is_async) {
252 temp->set_is_captured(); 254 temp->set_is_captured();
253 } 255 }
254 set_finally_return_temp_var(temp); 256 set_finally_return_temp_var(temp);
255 } 257 }
256 ASSERT(has_finally_return_temp_var()); 258 ASSERT(has_finally_return_temp_var());
(...skipping 2857 matching lines...) Expand 10 before | Expand all | Expand 10 after
3114 3116
3115 3117
3116 SequenceNode* Parser::MakeImplicitConstructor(const Function& func) { 3118 SequenceNode* Parser::MakeImplicitConstructor(const Function& func) {
3117 ASSERT(func.IsGenerativeConstructor()); 3119 ASSERT(func.IsGenerativeConstructor());
3118 ASSERT(func.Owner() == current_class().raw()); 3120 ASSERT(func.Owner() == current_class().raw());
3119 const TokenPosition ctor_pos = TokenPos(); 3121 const TokenPosition ctor_pos = TokenPos();
3120 OpenFunctionBlock(func); 3122 OpenFunctionBlock(func);
3121 3123
3122 LocalVariable* receiver = new LocalVariable( 3124 LocalVariable* receiver = new LocalVariable(
3123 TokenPosition::kNoSource, 3125 TokenPosition::kNoSource,
3126 TokenPosition::kNoSource,
3124 Symbols::This(), 3127 Symbols::This(),
3125 *ReceiverType(current_class())); 3128 *ReceiverType(current_class()));
3126 current_block_->scope->InsertParameterAt(0, receiver); 3129 current_block_->scope->InsertParameterAt(0, receiver);
3127 3130
3128 // Parse expressions of instance fields that have an explicit 3131 // Parse expressions of instance fields that have an explicit
3129 // initializer expression. 3132 // initializer expression.
3130 // The receiver must not be visible to field initializer expressions. 3133 // The receiver must not be visible to field initializer expressions.
3131 receiver->set_invisible(true); 3134 receiver->set_invisible(true);
3132 GrowableArray<Field*> initialized_fields; 3135 GrowableArray<Field*> initialized_fields;
3133 ParseInitializedInstanceFields( 3136 ParseInitializedInstanceFields(
(...skipping 28 matching lines...) Expand all
3162 "constructor of the class extending the mixin application", 3165 "constructor of the class extending the mixin application",
3163 String::Handle(Z, super_class.Name()).ToCString()); 3166 String::Handle(Z, super_class.Name()).ToCString());
3164 } 3167 }
3165 3168
3166 // Prepare user-defined arguments to be forwarded to super call. 3169 // Prepare user-defined arguments to be forwarded to super call.
3167 // The first user-defined argument is at position 1. 3170 // The first user-defined argument is at position 1.
3168 forwarding_args = new ArgumentListNode(ST(ctor_pos)); 3171 forwarding_args = new ArgumentListNode(ST(ctor_pos));
3169 for (int i = 1; i < func.NumParameters(); i++) { 3172 for (int i = 1; i < func.NumParameters(); i++) {
3170 LocalVariable* param = new LocalVariable( 3173 LocalVariable* param = new LocalVariable(
3171 TokenPosition::kNoSource, 3174 TokenPosition::kNoSource,
3175 TokenPosition::kNoSource,
3172 String::ZoneHandle(Z, func.ParameterNameAt(i)), 3176 String::ZoneHandle(Z, func.ParameterNameAt(i)),
3173 Object::dynamic_type()); 3177 Object::dynamic_type());
3174 current_block_->scope->InsertParameterAt(i, param); 3178 current_block_->scope->InsertParameterAt(i, param);
3175 forwarding_args->Add(new LoadLocalNode(ST(ctor_pos), param)); 3179 forwarding_args->Add(new LoadLocalNode(ST(ctor_pos), param));
3176 } 3180 }
3177 } 3181 }
3178 3182
3179 AstNode* super_call = GenerateSuperConstructorCall( 3183 AstNode* super_call = GenerateSuperConstructorCall(
3180 current_class(), 3184 current_class(),
3181 ctor_pos, 3185 ctor_pos,
(...skipping 3896 matching lines...) Expand 10 before | Expand all | Expand 10 after
7078 return closure.raw(); 7082 return closure.raw();
7079 } 7083 }
7080 7084
7081 7085
7082 void Parser::AddContinuationVariables() { 7086 void Parser::AddContinuationVariables() {
7083 // Add to current block's scope: 7087 // Add to current block's scope:
7084 // var :await_jump_var; 7088 // var :await_jump_var;
7085 // var :await_ctx_var; 7089 // var :await_ctx_var;
7086 LocalVariable* await_jump_var = new (Z) LocalVariable( 7090 LocalVariable* await_jump_var = new (Z) LocalVariable(
7087 TokenPosition::kNoSource, 7091 TokenPosition::kNoSource,
7092 TokenPosition::kNoSource,
7088 Symbols::AwaitJumpVar(), 7093 Symbols::AwaitJumpVar(),
7089 Object::dynamic_type()); 7094 Object::dynamic_type());
7090 current_block_->scope->AddVariable(await_jump_var); 7095 current_block_->scope->AddVariable(await_jump_var);
7091 LocalVariable* await_ctx_var = new (Z) LocalVariable( 7096 LocalVariable* await_ctx_var = new (Z) LocalVariable(
7092 TokenPosition::kNoSource, 7097 TokenPosition::kNoSource,
7098 TokenPosition::kNoSource,
7093 Symbols::AwaitContextVar(), 7099 Symbols::AwaitContextVar(),
7094 Object::dynamic_type()); 7100 Object::dynamic_type());
7095 current_block_->scope->AddVariable(await_ctx_var); 7101 current_block_->scope->AddVariable(await_ctx_var);
7096 } 7102 }
7097 7103
7098 7104
7099 void Parser::AddAsyncClosureVariables() { 7105 void Parser::AddAsyncClosureVariables() {
7100 // Add to current block's scope: 7106 // Add to current block's scope:
7101 // var :async_op; 7107 // var :async_op;
7102 // var :async_then_callback; 7108 // var :async_then_callback;
7103 // var :async_catch_error_callback; 7109 // var :async_catch_error_callback;
7104 // var :async_completer; 7110 // var :async_completer;
7105 LocalVariable* async_op_var = new(Z) LocalVariable( 7111 LocalVariable* async_op_var = new(Z) LocalVariable(
7106 TokenPosition::kNoSource, 7112 TokenPosition::kNoSource,
7113 TokenPosition::kNoSource,
7107 Symbols::AsyncOperation(), 7114 Symbols::AsyncOperation(),
7108 Object::dynamic_type()); 7115 Object::dynamic_type());
7109 current_block_->scope->AddVariable(async_op_var); 7116 current_block_->scope->AddVariable(async_op_var);
7110 LocalVariable* async_then_callback_var = new(Z) LocalVariable( 7117 LocalVariable* async_then_callback_var = new(Z) LocalVariable(
7111 TokenPosition::kNoSource, 7118 TokenPosition::kNoSource,
7119 TokenPosition::kNoSource,
7112 Symbols::AsyncThenCallback(), 7120 Symbols::AsyncThenCallback(),
7113 Object::dynamic_type()); 7121 Object::dynamic_type());
7114 current_block_->scope->AddVariable(async_then_callback_var); 7122 current_block_->scope->AddVariable(async_then_callback_var);
7115 LocalVariable* async_catch_error_callback_var = new(Z) LocalVariable( 7123 LocalVariable* async_catch_error_callback_var = new(Z) LocalVariable(
7116 TokenPosition::kNoSource, 7124 TokenPosition::kNoSource,
7125 TokenPosition::kNoSource,
7117 Symbols::AsyncCatchErrorCallback(), 7126 Symbols::AsyncCatchErrorCallback(),
7118 Object::dynamic_type()); 7127 Object::dynamic_type());
7119 current_block_->scope->AddVariable(async_catch_error_callback_var); 7128 current_block_->scope->AddVariable(async_catch_error_callback_var);
7120 LocalVariable* async_completer = new(Z) LocalVariable( 7129 LocalVariable* async_completer = new(Z) LocalVariable(
7121 TokenPosition::kNoSource, 7130 TokenPosition::kNoSource,
7131 TokenPosition::kNoSource,
7122 Symbols::AsyncCompleter(), 7132 Symbols::AsyncCompleter(),
7123 Object::dynamic_type()); 7133 Object::dynamic_type());
7124 current_block_->scope->AddVariable(async_completer); 7134 current_block_->scope->AddVariable(async_completer);
7125 } 7135 }
7126 7136
7127 7137
7128 void Parser::AddAsyncGeneratorVariables() { 7138 void Parser::AddAsyncGeneratorVariables() {
7129 // Add to current block's scope: 7139 // Add to current block's scope:
7130 // var :controller; 7140 // var :controller;
7131 // The :controller variable is used by the async generator closure to 7141 // The :controller variable is used by the async generator closure to
7132 // store the StreamController object to which the yielded expressions 7142 // store the StreamController object to which the yielded expressions
7133 // are added. 7143 // are added.
7134 // var :async_op; 7144 // var :async_op;
7135 // var :async_then_callback; 7145 // var :async_then_callback;
7136 // var :async_catch_error_callback; 7146 // var :async_catch_error_callback;
7137 // These variables are used to store the async generator closure containing 7147 // These variables are used to store the async generator closure containing
7138 // the body of the async* function. They are used by the await operator. 7148 // the body of the async* function. They are used by the await operator.
7139 LocalVariable* controller_var = new(Z) LocalVariable( 7149 LocalVariable* controller_var = new(Z) LocalVariable(
7140 TokenPosition::kNoSource, 7150 TokenPosition::kNoSource,
7151 TokenPosition::kNoSource,
7141 Symbols::Controller(), 7152 Symbols::Controller(),
7142 Object::dynamic_type()); 7153 Object::dynamic_type());
7143 current_block_->scope->AddVariable(controller_var); 7154 current_block_->scope->AddVariable(controller_var);
7144 LocalVariable* async_op_var = new(Z) LocalVariable( 7155 LocalVariable* async_op_var = new(Z) LocalVariable(
7145 TokenPosition::kNoSource, 7156 TokenPosition::kNoSource,
7157 TokenPosition::kNoSource,
7146 Symbols::AsyncOperation(), 7158 Symbols::AsyncOperation(),
7147 Object::dynamic_type()); 7159 Object::dynamic_type());
7148 current_block_->scope->AddVariable(async_op_var); 7160 current_block_->scope->AddVariable(async_op_var);
7149 LocalVariable* async_then_callback_var = new(Z) LocalVariable( 7161 LocalVariable* async_then_callback_var = new(Z) LocalVariable(
7150 TokenPosition::kNoSource, 7162 TokenPosition::kNoSource,
7163 TokenPosition::kNoSource,
7151 Symbols::AsyncThenCallback(), 7164 Symbols::AsyncThenCallback(),
7152 Object::dynamic_type()); 7165 Object::dynamic_type());
7153 current_block_->scope->AddVariable(async_then_callback_var); 7166 current_block_->scope->AddVariable(async_then_callback_var);
7154 LocalVariable* async_catch_error_callback_var = new(Z) LocalVariable( 7167 LocalVariable* async_catch_error_callback_var = new(Z) LocalVariable(
7155 TokenPosition::kNoSource, 7168 TokenPosition::kNoSource,
7169 TokenPosition::kNoSource,
7156 Symbols::AsyncCatchErrorCallback(), 7170 Symbols::AsyncCatchErrorCallback(),
7157 Object::dynamic_type()); 7171 Object::dynamic_type());
7158 current_block_->scope->AddVariable(async_catch_error_callback_var); 7172 current_block_->scope->AddVariable(async_catch_error_callback_var);
7159 } 7173 }
7160 7174
7161 7175
7162 RawFunction* Parser::OpenAsyncGeneratorFunction( 7176 RawFunction* Parser::OpenAsyncGeneratorFunction(
7163 TokenPosition async_func_pos) { 7177 TokenPosition async_func_pos) {
7164 TRACE_PARSER("OpenAsyncGeneratorFunction"); 7178 TRACE_PARSER("OpenAsyncGeneratorFunction");
7165 AddContinuationVariables(); 7179 AddContinuationVariables();
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
7634 void Parser::AddFormalParamsToScope(const ParamList* params, 7648 void Parser::AddFormalParamsToScope(const ParamList* params,
7635 LocalScope* scope) { 7649 LocalScope* scope) {
7636 ASSERT((params != NULL) && (params->parameters != NULL)); 7650 ASSERT((params != NULL) && (params->parameters != NULL));
7637 ASSERT(scope != NULL); 7651 ASSERT(scope != NULL);
7638 const int num_parameters = params->parameters->length(); 7652 const int num_parameters = params->parameters->length();
7639 for (int i = 0; i < num_parameters; i++) { 7653 for (int i = 0; i < num_parameters; i++) {
7640 ParamDesc& param_desc = (*params->parameters)[i]; 7654 ParamDesc& param_desc = (*params->parameters)[i];
7641 ASSERT(!is_top_level_ || param_desc.type->IsResolved()); 7655 ASSERT(!is_top_level_ || param_desc.type->IsResolved());
7642 const String* name = param_desc.name; 7656 const String* name = param_desc.name;
7643 LocalVariable* parameter = new(Z) LocalVariable( 7657 LocalVariable* parameter = new(Z) LocalVariable(
7644 param_desc.name_pos, *name, *param_desc.type); 7658 param_desc.name_pos,
7659 param_desc.name_pos,
7660 *name,
7661 *param_desc.type);
7645 if (!scope->InsertParameterAt(i, parameter)) { 7662 if (!scope->InsertParameterAt(i, parameter)) {
7646 ReportError(param_desc.name_pos, 7663 ReportError(param_desc.name_pos,
7647 "name '%s' already exists in scope", 7664 "name '%s' already exists in scope",
7648 param_desc.name->ToCString()); 7665 param_desc.name->ToCString());
7649 } 7666 }
7650 param_desc.var = parameter; 7667 param_desc.var = parameter;
7651 if (param_desc.is_final) { 7668 if (param_desc.is_final) {
7652 parameter->set_is_final(); 7669 parameter->set_is_final();
7653 } 7670 }
7654 if (FLAG_initializing_formal_access) { 7671 if (FLAG_initializing_formal_access) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
7746 const TokenPosition assign_pos = TokenPos(); 7763 const TokenPosition assign_pos = TokenPos();
7747 AstNode* initialization = NULL; 7764 AstNode* initialization = NULL;
7748 LocalVariable* variable = NULL; 7765 LocalVariable* variable = NULL;
7749 if (CurrentToken() == Token::kASSIGN) { 7766 if (CurrentToken() == Token::kASSIGN) {
7750 // Variable initialization. 7767 // Variable initialization.
7751 ConsumeToken(); 7768 ConsumeToken();
7752 AstNode* expr = ParseAwaitableExpr( 7769 AstNode* expr = ParseAwaitableExpr(
7753 is_const, kConsumeCascades, await_preamble); 7770 is_const, kConsumeCascades, await_preamble);
7754 const TokenPosition expr_end_pos = TokenPos(); 7771 const TokenPosition expr_end_pos = TokenPos();
7755 variable = new(Z) LocalVariable( 7772 variable = new(Z) LocalVariable(
7756 expr_end_pos, ident, type); 7773 ident_pos,
7774 expr_end_pos,
7775 ident,
7776 type);
7757 initialization = new(Z) StoreLocalNode( 7777 initialization = new(Z) StoreLocalNode(
7758 assign_pos, variable, expr); 7778 assign_pos, variable, expr);
7759 if (is_const) { 7779 if (is_const) {
7760 ASSERT(expr->IsLiteralNode()); 7780 ASSERT(expr->IsLiteralNode());
7761 variable->SetConstValue(expr->AsLiteralNode()->literal()); 7781 variable->SetConstValue(expr->AsLiteralNode()->literal());
7762 } 7782 }
7763 } else if (is_final || is_const) { 7783 } else if (is_final || is_const) {
7764 ReportError(ident_pos, 7784 ReportError(ident_pos,
7765 "missing initialization of 'final' or 'const' variable"); 7785 "missing initialization of 'final' or 'const' variable");
7766 } else { 7786 } else {
7767 // Initialize variable with null. 7787 // Initialize variable with null.
7768 variable = new(Z) LocalVariable( 7788 variable = new(Z) LocalVariable(
7769 assign_pos, ident, type); 7789 ident_pos,
7790 assign_pos,
7791 ident,
7792 type);
7770 AstNode* null_expr = new(Z) LiteralNode(ident_pos, Object::null_instance()); 7793 AstNode* null_expr = new(Z) LiteralNode(ident_pos, Object::null_instance());
7771 initialization = new(Z) StoreLocalNode( 7794 initialization = new(Z) StoreLocalNode(
7772 ident_pos, variable, null_expr); 7795 ident_pos, variable, null_expr);
7773 } 7796 }
7774 7797
7775 ASSERT(current_block_ != NULL); 7798 ASSERT(current_block_ != NULL);
7776 const TokenPosition previous_pos = 7799 const TokenPosition previous_pos =
7777 current_block_->scope->PreviousReferencePos(ident); 7800 current_block_->scope->PreviousReferencePos(ident);
7778 if (previous_pos.IsReal()) { 7801 if (previous_pos.IsReal()) {
7779 ASSERT(!script_.IsNull()); 7802 ASSERT(!script_.IsNull());
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
7896 7919
7897 AstNode* Parser::ParseFunctionStatement(bool is_literal) { 7920 AstNode* Parser::ParseFunctionStatement(bool is_literal) {
7898 TRACE_PARSER("ParseFunctionStatement"); 7921 TRACE_PARSER("ParseFunctionStatement");
7899 AbstractType& result_type = AbstractType::Handle(Z); 7922 AbstractType& result_type = AbstractType::Handle(Z);
7900 const String* variable_name = NULL; 7923 const String* variable_name = NULL;
7901 const String* function_name = NULL; 7924 const String* function_name = NULL;
7902 7925
7903 result_type = Type::DynamicType(); 7926 result_type = Type::DynamicType();
7904 7927
7905 const TokenPosition function_pos = TokenPos(); 7928 const TokenPosition function_pos = TokenPos();
7929 TokenPosition function_name_pos = TokenPosition::kNoSource;
7906 TokenPosition metadata_pos = TokenPosition::kNoSource; 7930 TokenPosition metadata_pos = TokenPosition::kNoSource;
7907 if (is_literal) { 7931 if (is_literal) {
7908 ASSERT(CurrentToken() == Token::kLPAREN || CurrentToken() == Token::kLT); 7932 ASSERT(CurrentToken() == Token::kLPAREN || CurrentToken() == Token::kLT);
7909 function_name = &Symbols::AnonymousClosure(); 7933 function_name = &Symbols::AnonymousClosure();
7910 } else { 7934 } else {
7911 metadata_pos = SkipMetadata(); 7935 metadata_pos = SkipMetadata();
7912 if (CurrentToken() == Token::kVOID) { 7936 if (CurrentToken() == Token::kVOID) {
7913 ConsumeToken(); 7937 ConsumeToken();
7914 result_type = Type::VoidType(); 7938 result_type = Type::VoidType();
7915 } else if (IsFunctionReturnType()) { 7939 } else if (IsFunctionReturnType()) {
7916 // It is too early to resolve the type here, since it can be a result type 7940 // It is too early to resolve the type here, since it can be a result type
7917 // referring to a not yet declared function type parameter. 7941 // referring to a not yet declared function type parameter.
7918 result_type = ParseType(ClassFinalizer::kDoNotResolve); 7942 result_type = ParseType(ClassFinalizer::kDoNotResolve);
7919 } 7943 }
7920 const TokenPosition name_pos = TokenPos(); 7944 function_name_pos = TokenPos();
7921 variable_name = ExpectIdentifier("function name expected"); 7945 variable_name = ExpectIdentifier("function name expected");
7922 function_name = variable_name; 7946 function_name = variable_name;
7923 7947
7924 // Check that the function name has not been referenced 7948 // Check that the function name has not been referenced
7925 // before this declaration. 7949 // before this declaration.
7926 ASSERT(current_block_ != NULL); 7950 ASSERT(current_block_ != NULL);
7927 const TokenPosition previous_pos = 7951 const TokenPosition previous_pos =
7928 current_block_->scope->PreviousReferencePos(*function_name); 7952 current_block_->scope->PreviousReferencePos(*function_name);
7929 if (previous_pos.IsReal()) { 7953 if (previous_pos.IsReal()) {
7930 ASSERT(!script_.IsNull()); 7954 ASSERT(!script_.IsNull());
7931 intptr_t line_number; 7955 intptr_t line_number;
7932 script_.GetTokenLocation(previous_pos, &line_number, NULL); 7956 script_.GetTokenLocation(previous_pos, &line_number, NULL);
7933 ReportError(name_pos, 7957 ReportError(function_name_pos,
7934 "identifier '%s' previously used in line %" Pd "", 7958 "identifier '%s' previously used in line %" Pd "",
7935 function_name->ToCString(), 7959 function_name->ToCString(),
7936 line_number); 7960 line_number);
7937 } 7961 }
7938 } 7962 }
7939 7963
7940 // Check whether we have parsed this closure function before, in a previous 7964 // Check whether we have parsed this closure function before, in a previous
7941 // compilation. If so, reuse the function object, else create a new one 7965 // compilation. If so, reuse the function object, else create a new one
7942 // and register it in the current class. 7966 // and register it in the current class.
7943 // Note that we cannot share the same closure function between the closurized 7967 // Note that we cannot share the same closure function between the closurized
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
8002 const Class& unknown_scope_class = Class::Handle(Z, 8026 const Class& unknown_scope_class = Class::Handle(Z,
8003 I->object_store()->closure_class()); 8027 I->object_store()->closure_class());
8004 function_type = Type::New(unknown_scope_class, 8028 function_type = Type::New(unknown_scope_class,
8005 TypeArguments::Handle(Z), 8029 TypeArguments::Handle(Z),
8006 function_pos); 8030 function_pos);
8007 function_type.set_signature(function); 8031 function_type.set_signature(function);
8008 function_type.SetIsFinalized(); // No finalization needed. 8032 function_type.SetIsFinalized(); // No finalization needed.
8009 8033
8010 // Add the function variable to the scope before parsing the function in 8034 // Add the function variable to the scope before parsing the function in
8011 // order to allow self reference from inside the function. 8035 // order to allow self reference from inside the function.
8012 function_variable = new(Z) LocalVariable(function_pos, 8036 function_variable = new(Z) LocalVariable(function_name_pos,
8037 function_pos,
8013 *variable_name, 8038 *variable_name,
8014 function_type); 8039 function_type);
8015 function_variable->set_is_final(); 8040 function_variable->set_is_final();
8016 ASSERT(current_block_ != NULL); 8041 ASSERT(current_block_ != NULL);
8017 ASSERT(current_block_->scope != NULL); 8042 ASSERT(current_block_->scope != NULL);
8018 if (!current_block_->scope->AddVariable(function_variable)) { 8043 if (!current_block_->scope->AddVariable(function_variable)) {
8019 LocalVariable* existing_var = 8044 LocalVariable* existing_var =
8020 current_block_->scope->LookupVariable(function_variable->name(), 8045 current_block_->scope->LookupVariable(function_variable->name(),
8021 true); 8046 true);
8022 ASSERT(existing_var != NULL); 8047 ASSERT(existing_var != NULL);
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
8814 // variable is set to dynamic. It will later be patched to match the 8839 // variable is set to dynamic. It will later be patched to match the
8815 // type of the case clause expressions. Therefore, we have to allocate 8840 // type of the case clause expressions. Therefore, we have to allocate
8816 // a new type representing dynamic and can't reuse the canonical 8841 // a new type representing dynamic and can't reuse the canonical
8817 // type object for dynamic. 8842 // type object for dynamic.
8818 const Type& temp_var_type = Type::ZoneHandle(Z, 8843 const Type& temp_var_type = Type::ZoneHandle(Z,
8819 Type::New(Class::Handle(Z, Object::dynamic_class()), 8844 Type::New(Class::Handle(Z, Object::dynamic_class()),
8820 TypeArguments::Handle(Z), 8845 TypeArguments::Handle(Z),
8821 expr_pos)); 8846 expr_pos));
8822 temp_var_type.SetIsFinalized(); 8847 temp_var_type.SetIsFinalized();
8823 LocalVariable* temp_variable = new(Z) LocalVariable( 8848 LocalVariable* temp_variable = new(Z) LocalVariable(
8824 expr_pos, Symbols::SwitchExpr(), temp_var_type); 8849 expr_pos, expr_pos, Symbols::SwitchExpr(), temp_var_type);
8825 current_block_->scope->AddVariable(temp_variable); 8850 current_block_->scope->AddVariable(temp_variable);
8826 AstNode* save_switch_expr = new(Z) StoreLocalNode( 8851 AstNode* save_switch_expr = new(Z) StoreLocalNode(
8827 expr_pos, temp_variable, switch_expr); 8852 expr_pos, temp_variable, switch_expr);
8828 current_block_->statements->Add(save_switch_expr); 8853 current_block_->statements->Add(save_switch_expr);
8829 8854
8830 // Parse case clauses 8855 // Parse case clauses
8831 bool default_seen = false; 8856 bool default_seen = false;
8832 GrowableArray<LiteralNode*> case_expr_values; 8857 GrowableArray<LiteralNode*> case_expr_values;
8833 while (true) { 8858 while (true) {
8834 // Check for statement label 8859 // Check for statement label
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
9104 ASSERT(!iterator_ctor.IsNull()); 9129 ASSERT(!iterator_ctor.IsNull());
9105 ArgumentListNode* ctor_args = new (Z) ArgumentListNode(stream_expr_pos); 9130 ArgumentListNode* ctor_args = new (Z) ArgumentListNode(stream_expr_pos);
9106 ctor_args->Add(stream_expr); 9131 ctor_args->Add(stream_expr);
9107 ConstructorCallNode* ctor_call = 9132 ConstructorCallNode* ctor_call =
9108 new (Z) ConstructorCallNode(stream_expr_pos, 9133 new (Z) ConstructorCallNode(stream_expr_pos,
9109 TypeArguments::ZoneHandle(Z), 9134 TypeArguments::ZoneHandle(Z),
9110 iterator_ctor, 9135 iterator_ctor,
9111 ctor_args); 9136 ctor_args);
9112 const AbstractType& iterator_type = Object::dynamic_type(); 9137 const AbstractType& iterator_type = Object::dynamic_type();
9113 LocalVariable* iterator_var = new(Z) LocalVariable( 9138 LocalVariable* iterator_var = new(Z) LocalVariable(
9114 stream_expr_pos, Symbols::ForInIter(), iterator_type); 9139 stream_expr_pos, stream_expr_pos, Symbols::ForInIter(), iterator_type);
9115 current_block_->scope->AddVariable(iterator_var); 9140 current_block_->scope->AddVariable(iterator_var);
9116 AstNode* iterator_init = 9141 AstNode* iterator_init =
9117 new(Z) StoreLocalNode(stream_expr_pos, iterator_var, ctor_call); 9142 new(Z) StoreLocalNode(stream_expr_pos, iterator_var, ctor_call);
9118 current_block_->statements->Add(iterator_init); 9143 current_block_->statements->Add(iterator_init);
9119 9144
9120 // We need to ensure that the stream is cancelled after the loop. 9145 // We need to ensure that the stream is cancelled after the loop.
9121 // Thus, wrap the loop in a try-finally that calls :for-in-iter.close() 9146 // Thus, wrap the loop in a try-finally that calls :for-in-iter.close()
9122 // in the finally clause. It is harmless to call close() if the stream 9147 // in the finally clause. It is harmless to call close() if the stream
9123 // is already cancelled (when moveNext() returns false). 9148 // is already cancelled (when moveNext() returns false).
9124 // Note: even though this is async code, we do not need to set up 9149 // Note: even though this is async code, we do not need to set up
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
9189 9214
9190 // Generate assignment of next iterator value to loop variable. 9215 // Generate assignment of next iterator value to loop variable.
9191 AstNode* loop_var_assignment = NULL; 9216 AstNode* loop_var_assignment = NULL;
9192 if (new_loop_var) { 9217 if (new_loop_var) {
9193 // The for loop variable is new for each iteration. 9218 // The for loop variable is new for each iteration.
9194 // Create a variable and add it to the loop body scope. 9219 // Create a variable and add it to the loop body scope.
9195 // Note that the variable token position needs to be inside the 9220 // Note that the variable token position needs to be inside the
9196 // loop block, so it gets put in the loop context level. 9221 // loop block, so it gets put in the loop context level.
9197 LocalVariable* loop_var = 9222 LocalVariable* loop_var =
9198 new(Z) LocalVariable(loop_var_assignment_pos, 9223 new(Z) LocalVariable(loop_var_assignment_pos,
9224 loop_var_assignment_pos,
9199 *loop_var_name, 9225 *loop_var_name,
9200 loop_var_type);; 9226 loop_var_type);;
9201 if (loop_var_is_final) { 9227 if (loop_var_is_final) {
9202 loop_var->set_is_final(); 9228 loop_var->set_is_final();
9203 } 9229 }
9204 current_block_->scope->AddVariable(loop_var); 9230 current_block_->scope->AddVariable(loop_var);
9205 loop_var_assignment = new(Z) StoreLocalNode( 9231 loop_var_assignment = new(Z) StoreLocalNode(
9206 loop_var_assignment_pos, loop_var, iterator_current); 9232 loop_var_assignment_pos, loop_var, iterator_current);
9207 } else { 9233 } else {
9208 AstNode* loop_var_primary = 9234 AstNode* loop_var_primary =
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
9364 loop_var_pos = TokenPos(); 9390 loop_var_pos = TokenPos();
9365 loop_var_name = ExpectIdentifier("variable name expected"); 9391 loop_var_name = ExpectIdentifier("variable name expected");
9366 } else { 9392 } else {
9367 // The case without a type is handled above, so require a type here. 9393 // The case without a type is handled above, so require a type here.
9368 // Delay creation of the local variable until we know its actual 9394 // Delay creation of the local variable until we know its actual
9369 // position, which is inside the loop body. 9395 // position, which is inside the loop body.
9370 new_loop_var = true; 9396 new_loop_var = true;
9371 loop_var_type = ParseConstFinalVarOrType( 9397 loop_var_type = ParseConstFinalVarOrType(
9372 I->type_checks() ? ClassFinalizer::kCanonicalize : 9398 I->type_checks() ? ClassFinalizer::kCanonicalize :
9373 ClassFinalizer::kIgnore); 9399 ClassFinalizer::kIgnore);
9400 loop_var_pos = TokenPos();
9374 loop_var_name = ExpectIdentifier("variable name expected"); 9401 loop_var_name = ExpectIdentifier("variable name expected");
9375 } 9402 }
9376 ExpectToken(Token::kIN); 9403 ExpectToken(Token::kIN);
9377 9404
9378 // Ensure that the block token range contains the call to moveNext and it 9405 // Ensure that the block token range contains the call to moveNext and it
9379 // also starts the block at a different token position than the following 9406 // also starts the block at a different token position than the following
9380 // loop block. Both blocks can allocate contexts and if they have a matching 9407 // loop block. Both blocks can allocate contexts and if they have a matching
9381 // token position range, it can be an issue (cf. bug 26941). 9408 // token position range, it can be an issue (cf. bug 26941).
9382 OpenBlock(); // Implicit block around while loop. 9409 OpenBlock(); // Implicit block around while loop.
9383 9410
9384 const TokenPosition collection_pos = TokenPos(); 9411 const TokenPosition collection_pos = TokenPos();
9385 AstNode* collection_expr = 9412 AstNode* collection_expr =
9386 ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL); 9413 ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL);
9387 ExpectToken(Token::kRPAREN); 9414 ExpectToken(Token::kRPAREN);
9388 9415
9389 // Generate implicit iterator variable and add to scope. 9416 // Generate implicit iterator variable and add to scope.
9390 // We could set the type of the implicit iterator variable to Iterator<T> 9417 // We could set the type of the implicit iterator variable to Iterator<T>
9391 // where T is the type of the for loop variable. However, the type error 9418 // where T is the type of the for loop variable. However, the type error
9392 // would refer to the compiler generated iterator and could confuse the user. 9419 // would refer to the compiler generated iterator and could confuse the user.
9393 // It is better to leave the iterator untyped and postpone the type error 9420 // It is better to leave the iterator untyped and postpone the type error
9394 // until the loop variable is assigned to. 9421 // until the loop variable is assigned to.
9395 const AbstractType& iterator_type = Object::dynamic_type(); 9422 const AbstractType& iterator_type = Object::dynamic_type();
9396 LocalVariable* iterator_var = new(Z) LocalVariable( 9423 LocalVariable* iterator_var = new(Z) LocalVariable(
9424 collection_pos,
9397 collection_pos, Symbols::ForInIter(), iterator_type); 9425 collection_pos, Symbols::ForInIter(), iterator_type);
9398 current_block_->scope->AddVariable(iterator_var); 9426 current_block_->scope->AddVariable(iterator_var);
9399 9427
9400 // Generate initialization of iterator variable. 9428 // Generate initialization of iterator variable.
9401 ArgumentListNode* no_args = new(Z) ArgumentListNode(collection_pos); 9429 ArgumentListNode* no_args = new(Z) ArgumentListNode(collection_pos);
9402 AstNode* get_iterator = new(Z) InstanceGetterNode( 9430 AstNode* get_iterator = new(Z) InstanceGetterNode(
9403 collection_pos, collection_expr, Symbols::Iterator()); 9431 collection_pos, collection_expr, Symbols::Iterator());
9404 AstNode* iterator_init = 9432 AstNode* iterator_init =
9405 new(Z) StoreLocalNode(collection_pos, iterator_var, get_iterator); 9433 new(Z) StoreLocalNode(collection_pos, iterator_var, get_iterator);
9406 current_block_->statements->Add(iterator_init); 9434 current_block_->statements->Add(iterator_init);
(...skipping 17 matching lines...) Expand all
9424 loop_var_assignment_pos, 9452 loop_var_assignment_pos,
9425 new(Z) LoadLocalNode(loop_var_assignment_pos, iterator_var), 9453 new(Z) LoadLocalNode(loop_var_assignment_pos, iterator_var),
9426 Symbols::Current()); 9454 Symbols::Current());
9427 9455
9428 // Generate assignment of next iterator value to loop variable. 9456 // Generate assignment of next iterator value to loop variable.
9429 AstNode* loop_var_assignment = NULL; 9457 AstNode* loop_var_assignment = NULL;
9430 if (new_loop_var) { 9458 if (new_loop_var) {
9431 // The for loop variable is new for each iteration. 9459 // The for loop variable is new for each iteration.
9432 // Create a variable and add it to the loop body scope. 9460 // Create a variable and add it to the loop body scope.
9433 LocalVariable* loop_var = 9461 LocalVariable* loop_var =
9434 new(Z) LocalVariable(loop_var_assignment_pos, 9462 new(Z) LocalVariable(loop_var_pos,
9463 loop_var_assignment_pos,
9435 *loop_var_name, 9464 *loop_var_name,
9436 loop_var_type);; 9465 loop_var_type);;
9437 if (loop_var_is_final) { 9466 if (loop_var_is_final) {
9438 loop_var->set_is_final(); 9467 loop_var->set_is_final();
9439 } 9468 }
9440 current_block_->scope->AddVariable(loop_var); 9469 current_block_->scope->AddVariable(loop_var);
9441 loop_var_assignment = new(Z) StoreLocalNode( 9470 loop_var_assignment = new(Z) StoreLocalNode(
9442 loop_var_assignment_pos, loop_var, iterator_current); 9471 loop_var_assignment_pos, loop_var, iterator_current);
9443 } else { 9472 } else {
9444 AstNode* loop_var_primary = 9473 AstNode* loop_var_primary =
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
9591 } 9620 }
9592 9621
9593 9622
9594 // Populate local scope of the catch block with the catch parameters. 9623 // Populate local scope of the catch block with the catch parameters.
9595 void Parser::AddCatchParamsToScope(CatchParamDesc* exception_param, 9624 void Parser::AddCatchParamsToScope(CatchParamDesc* exception_param,
9596 CatchParamDesc* stack_trace_param, 9625 CatchParamDesc* stack_trace_param,
9597 LocalScope* scope) { 9626 LocalScope* scope) {
9598 if (exception_param->name != NULL) { 9627 if (exception_param->name != NULL) {
9599 LocalVariable* var = new(Z) LocalVariable( 9628 LocalVariable* var = new(Z) LocalVariable(
9600 exception_param->token_pos, 9629 exception_param->token_pos,
9630 exception_param->token_pos,
9601 *exception_param->name, 9631 *exception_param->name,
9602 *exception_param->type); 9632 *exception_param->type);
9603 var->set_is_final(); 9633 var->set_is_final();
9604 bool added_to_scope = scope->AddVariable(var); 9634 bool added_to_scope = scope->AddVariable(var);
9605 ASSERT(added_to_scope); 9635 ASSERT(added_to_scope);
9606 exception_param->var = var; 9636 exception_param->var = var;
9607 } 9637 }
9608 if (stack_trace_param->name != NULL) { 9638 if (stack_trace_param->name != NULL) {
9609 LocalVariable* var = new(Z) LocalVariable( 9639 LocalVariable* var = new(Z) LocalVariable(
9610 stack_trace_param->token_pos, 9640 stack_trace_param->token_pos,
9641 stack_trace_param->token_pos,
9611 *stack_trace_param->name, 9642 *stack_trace_param->name,
9612 *stack_trace_param->type); 9643 *stack_trace_param->type);
9613 var->set_is_final(); 9644 var->set_is_final();
9614 bool added_to_scope = scope->AddVariable(var); 9645 bool added_to_scope = scope->AddVariable(var);
9615 if (!added_to_scope) { 9646 if (!added_to_scope) {
9616 // The name of the exception param is reused for the stack trace param. 9647 // The name of the exception param is reused for the stack trace param.
9617 ReportError(stack_trace_param->token_pos, 9648 ReportError(stack_trace_param->token_pos,
9618 "name '%s' already exists in scope", 9649 "name '%s' already exists in scope",
9619 stack_trace_param->name->ToCString()); 9650 stack_trace_param->name->ToCString());
9620 } 9651 }
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
10010 10041
10011 10042
10012 void Parser::SetupSavedTryContext(LocalVariable* saved_try_context) { 10043 void Parser::SetupSavedTryContext(LocalVariable* saved_try_context) {
10013 const String& async_saved_try_ctx_name = String::ZoneHandle(Z, 10044 const String& async_saved_try_ctx_name = String::ZoneHandle(Z,
10014 Symbols::NewFormatted(T, 10045 Symbols::NewFormatted(T,
10015 "%s%d", 10046 "%s%d",
10016 Symbols::AsyncSavedTryCtxVarPrefix().ToCString(), 10047 Symbols::AsyncSavedTryCtxVarPrefix().ToCString(),
10017 last_used_try_index_ - 1)); 10048 last_used_try_index_ - 1));
10018 LocalVariable* async_saved_try_ctx = new (Z) LocalVariable( 10049 LocalVariable* async_saved_try_ctx = new (Z) LocalVariable(
10019 TokenPosition::kNoSource, 10050 TokenPosition::kNoSource,
10051 TokenPosition::kNoSource,
10020 async_saved_try_ctx_name, 10052 async_saved_try_ctx_name,
10021 Object::dynamic_type()); 10053 Object::dynamic_type());
10022 ASSERT(async_temp_scope_ != NULL); 10054 ASSERT(async_temp_scope_ != NULL);
10023 async_temp_scope_->AddVariable(async_saved_try_ctx); 10055 async_temp_scope_->AddVariable(async_saved_try_ctx);
10024 ASSERT(saved_try_context != NULL); 10056 ASSERT(saved_try_context != NULL);
10025 current_block_->statements->Add(new(Z) StoreLocalNode( 10057 current_block_->statements->Add(new(Z) StoreLocalNode(
10026 TokenPosition::kNoSource, 10058 TokenPosition::kNoSource,
10027 async_saved_try_ctx, 10059 async_saved_try_ctx,
10028 new(Z) LoadLocalNode(TokenPosition::kNoSource, saved_try_context))); 10060 new(Z) LoadLocalNode(TokenPosition::kNoSource, saved_try_context)));
10029 } 10061 }
(...skipping 21 matching lines...) Expand all
10051 LocalVariable** context_var, 10083 LocalVariable** context_var,
10052 LocalVariable** exception_var, 10084 LocalVariable** exception_var,
10053 LocalVariable** stack_trace_var, 10085 LocalVariable** stack_trace_var,
10054 LocalVariable** saved_exception_var, 10086 LocalVariable** saved_exception_var,
10055 LocalVariable** saved_stack_trace_var) { 10087 LocalVariable** saved_stack_trace_var) {
10056 // Consecutive try statements share the same set of variables. 10088 // Consecutive try statements share the same set of variables.
10057 *context_var = try_scope->LocalLookupVariable(Symbols::SavedTryContextVar()); 10089 *context_var = try_scope->LocalLookupVariable(Symbols::SavedTryContextVar());
10058 if (*context_var == NULL) { 10090 if (*context_var == NULL) {
10059 *context_var = new(Z) LocalVariable( 10091 *context_var = new(Z) LocalVariable(
10060 TokenPos(), 10092 TokenPos(),
10093 TokenPos(),
10061 Symbols::SavedTryContextVar(), 10094 Symbols::SavedTryContextVar(),
10062 Object::dynamic_type()); 10095 Object::dynamic_type());
10063 try_scope->AddVariable(*context_var); 10096 try_scope->AddVariable(*context_var);
10064 } 10097 }
10065 *exception_var = try_scope->LocalLookupVariable(Symbols::ExceptionVar()); 10098 *exception_var = try_scope->LocalLookupVariable(Symbols::ExceptionVar());
10066 if (*exception_var == NULL) { 10099 if (*exception_var == NULL) {
10067 *exception_var = new(Z) LocalVariable( 10100 *exception_var = new(Z) LocalVariable(
10068 TokenPos(), 10101 TokenPos(),
10102 TokenPos(),
10069 Symbols::ExceptionVar(), 10103 Symbols::ExceptionVar(),
10070 Object::dynamic_type()); 10104 Object::dynamic_type());
10071 try_scope->AddVariable(*exception_var); 10105 try_scope->AddVariable(*exception_var);
10072 } 10106 }
10073 *stack_trace_var = try_scope->LocalLookupVariable(Symbols::StackTraceVar()); 10107 *stack_trace_var = try_scope->LocalLookupVariable(Symbols::StackTraceVar());
10074 if (*stack_trace_var == NULL) { 10108 if (*stack_trace_var == NULL) {
10075 *stack_trace_var = new(Z) LocalVariable( 10109 *stack_trace_var = new(Z) LocalVariable(
10076 TokenPos(), 10110 TokenPos(),
10111 TokenPos(),
10077 Symbols::StackTraceVar(), 10112 Symbols::StackTraceVar(),
10078 Object::dynamic_type()); 10113 Object::dynamic_type());
10079 try_scope->AddVariable(*stack_trace_var); 10114 try_scope->AddVariable(*stack_trace_var);
10080 } 10115 }
10081 if (is_async) { 10116 if (is_async) {
10082 *saved_exception_var = try_scope->LocalLookupVariable( 10117 *saved_exception_var = try_scope->LocalLookupVariable(
10083 Symbols::SavedExceptionVar()); 10118 Symbols::SavedExceptionVar());
10084 if (*saved_exception_var == NULL) { 10119 if (*saved_exception_var == NULL) {
10085 *saved_exception_var = new(Z) LocalVariable( 10120 *saved_exception_var = new(Z) LocalVariable(
10086 TokenPos(), 10121 TokenPos(),
10122 TokenPos(),
10087 Symbols::SavedExceptionVar(), 10123 Symbols::SavedExceptionVar(),
10088 Object::dynamic_type()); 10124 Object::dynamic_type());
10089 try_scope->AddVariable(*saved_exception_var); 10125 try_scope->AddVariable(*saved_exception_var);
10090 } 10126 }
10091 *saved_stack_trace_var = try_scope->LocalLookupVariable( 10127 *saved_stack_trace_var = try_scope->LocalLookupVariable(
10092 Symbols::SavedStackTraceVar()); 10128 Symbols::SavedStackTraceVar());
10093 if (*saved_stack_trace_var == NULL) { 10129 if (*saved_stack_trace_var == NULL) {
10094 *saved_stack_trace_var = new(Z) LocalVariable( 10130 *saved_stack_trace_var = new(Z) LocalVariable(
10095 TokenPos(), 10131 TokenPos(),
10132 TokenPos(),
10096 Symbols::SavedStackTraceVar(), 10133 Symbols::SavedStackTraceVar(),
10097 Object::dynamic_type()); 10134 Object::dynamic_type());
10098 try_scope->AddVariable(*saved_stack_trace_var); 10135 try_scope->AddVariable(*saved_stack_trace_var);
10099 } 10136 }
10100 } 10137 }
10101 } 10138 }
10102 10139
10103 10140
10104 AstNode* Parser::ParseTryStatement(String* label_name) { 10141 AstNode* Parser::ParseTryStatement(String* label_name) {
10105 TRACE_PARSER("ParseTryStatement"); 10142 TRACE_PARSER("ParseTryStatement");
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
11066 parsed_function()->EnsureExpressionTemp(); 11103 parsed_function()->EnsureExpressionTemp();
11067 } 11104 }
11068 11105
11069 11106
11070 LocalVariable* Parser::CreateTempConstVariable(TokenPosition token_pos, 11107 LocalVariable* Parser::CreateTempConstVariable(TokenPosition token_pos,
11071 const char* s) { 11108 const char* s) {
11072 char name[64]; 11109 char name[64];
11073 OS::SNPrint(name, 64, ":%s%" Pd "", s, token_pos.value()); 11110 OS::SNPrint(name, 64, ":%s%" Pd "", s, token_pos.value());
11074 LocalVariable* temp = new(Z) LocalVariable( 11111 LocalVariable* temp = new(Z) LocalVariable(
11075 token_pos, 11112 token_pos,
11113 token_pos,
11076 String::ZoneHandle(Z, Symbols::New(T, name)), 11114 String::ZoneHandle(Z, Symbols::New(T, name)),
11077 Object::dynamic_type()); 11115 Object::dynamic_type());
11078 temp->set_is_final(); 11116 temp->set_is_final();
11079 current_block_->scope->AddVariable(temp); 11117 current_block_->scope->AddVariable(temp);
11080 return temp; 11118 return temp;
11081 } 11119 }
11082 11120
11083 11121
11084 AstNode* Parser::OptimizeBinaryOpNode(TokenPosition op_pos, 11122 AstNode* Parser::OptimizeBinaryOpNode(TokenPosition op_pos,
11085 Token::Kind binary_op, 11123 Token::Kind binary_op,
(...skipping 3999 matching lines...) Expand 10 before | Expand all | Expand 10 after
15085 const ArgumentListNode& function_args, 15123 const ArgumentListNode& function_args,
15086 const LocalVariable* temp_for_last_arg, 15124 const LocalVariable* temp_for_last_arg,
15087 bool is_super_invocation) { 15125 bool is_super_invocation) {
15088 UNREACHABLE(); 15126 UNREACHABLE();
15089 return NULL; 15127 return NULL;
15090 } 15128 }
15091 15129
15092 } // namespace dart 15130 } // namespace dart
15093 15131
15094 #endif // DART_PRECOMPILED_RUNTIME 15132 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698