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

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

Issue 19021002: Fix closure creation from function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 4526 matching lines...) Expand 10 before | Expand all | Expand 10 after
4537 if (is_static()) { 4537 if (is_static()) {
4538 context_scope = ContextScope::New(0); 4538 context_scope = ContextScope::New(0);
4539 } else { 4539 } else {
4540 context_scope = LocalScope::CreateImplicitClosureScope(*this); 4540 context_scope = LocalScope::CreateImplicitClosureScope(*this);
4541 } 4541 }
4542 closure_function.set_context_scope(context_scope); 4542 closure_function.set_context_scope(context_scope);
4543 4543
4544 // Set closure function's result type to this result type. 4544 // Set closure function's result type to this result type.
4545 closure_function.set_result_type(AbstractType::Handle(result_type())); 4545 closure_function.set_result_type(AbstractType::Handle(result_type()));
4546 4546
4547 // Set closure function's end token to this end token.
4548 closure_function.set_end_token_pos(end_token_pos());
4549
4547 // Set closure function's formal parameters to this formal parameters, 4550 // Set closure function's formal parameters to this formal parameters,
4548 // removing the receiver if this is an instance method and adding the closure 4551 // removing the receiver if this is an instance method and adding the closure
4549 // object as first parameter. 4552 // object as first parameter.
4550 const int kClosure = 1; 4553 const int kClosure = 1;
4551 const int has_receiver = is_static() ? 0 : 1; 4554 const int has_receiver = is_static() ? 0 : 1;
4552 const int num_fixed_params = kClosure - has_receiver + num_fixed_parameters(); 4555 const int num_fixed_params = kClosure - has_receiver + num_fixed_parameters();
4553 const int num_opt_params = NumOptionalParameters(); 4556 const int num_opt_params = NumOptionalParameters();
4554 const bool has_opt_pos_params = HasOptionalPositionalParameters(); 4557 const bool has_opt_pos_params = HasOptionalPositionalParameters();
4555 const int num_params = num_fixed_params + num_opt_params; 4558 const int num_params = num_fixed_params + num_opt_params;
4556 closure_function.set_num_fixed_parameters(num_fixed_params); 4559 closure_function.set_num_fixed_parameters(num_fixed_params);
(...skipping 9588 matching lines...) Expand 10 before | Expand all | Expand 10 after
14145 } 14148 }
14146 14149
14147 14150
14148 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 14151 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
14149 stream->OpenObject(); 14152 stream->OpenObject();
14150 stream->CloseObject(); 14153 stream->CloseObject();
14151 } 14154 }
14152 14155
14153 14156
14154 } // namespace dart 14157 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698