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

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

Issue 2481873005: clang-format runtime/vm (Closed)
Patch Set: Merge Created 4 years, 1 month 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
« no previous file with comments | « runtime/vm/kernel_reader.h ('k') | runtime/vm/kernel_to_il.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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/kernel_reader.h" 5 #include "vm/kernel_reader.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 library.SetLoadInProgress(); 174 library.SetLoadInProgress();
175 } 175 }
176 // Setup toplevel class (which contains library fields/procedures). 176 // Setup toplevel class (which contains library fields/procedures).
177 177
178 // TODO(27590): Figure out why we need this script stuff here. 178 // TODO(27590): Figure out why we need this script stuff here.
179 Script& script = Script::Handle( 179 Script& script = Script::Handle(
180 Z, 180 Z,
181 Script::New(H.DartString(""), H.DartString(""), RawScript::kScriptTag)); 181 Script::New(H.DartString(""), H.DartString(""), RawScript::kScriptTag));
182 script.SetLocationOffset(0, 0); 182 script.SetLocationOffset(0, 0);
183 script.Tokenize(H.DartString("nop() {}")); 183 script.Tokenize(H.DartString("nop() {}"));
184 dart::Class& toplevel_class = dart::Class::Handle(Z, dart::Class::New( 184 dart::Class& toplevel_class = dart::Class::Handle(
185 library, Symbols::TopLevel(), script, TokenPosition::kNoSource)); 185 Z, dart::Class::New(library, Symbols::TopLevel(), script,
186 TokenPosition::kNoSource));
186 toplevel_class.set_is_cycle_free(); 187 toplevel_class.set_is_cycle_free();
187 library.set_toplevel_class(toplevel_class); 188 library.set_toplevel_class(toplevel_class);
188 if (bootstrapping_) { 189 if (bootstrapping_) {
189 GrowableObjectArray::Handle(Z, I->object_store()->pending_classes()) 190 GrowableObjectArray::Handle(Z, I->object_store()->pending_classes())
190 .Add(toplevel_class, Heap::kOld); 191 .Add(toplevel_class, Heap::kOld);
191 } 192 }
192 193
193 ActiveClassScope active_class_scope(&active_class_, NULL, &toplevel_class); 194 ActiveClassScope active_class_scope(&active_class_, NULL, &toplevel_class);
194 // Load toplevel fields. 195 // Load toplevel fields.
195 for (intptr_t i = 0; i < kernel_library->fields().length(); i++) { 196 for (intptr_t i = 0; i < kernel_library->fields().length(); i++) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 267 }
267 268
268 parameter ^= type_parameters.TypeAt(i); 269 parameter ^= type_parameters.TypeAt(i);
269 parameter.set_bound(bound); 270 parameter.set_bound(bound);
270 } 271 }
271 } 272 }
272 } 273 }
273 274
274 // Set super type. Some classes (e.g., Object) do not have one. 275 // Set super type. Some classes (e.g., Object) do not have one.
275 if (kernel_normal_class->super_class() != NULL) { 276 if (kernel_normal_class->super_class() != NULL) {
276 AbstractType& super_type = T.TranslateTypeWithoutFinalization( 277 AbstractType& super_type =
277 kernel_normal_class->super_class()); 278 T.TranslateTypeWithoutFinalization(kernel_normal_class->super_class());
278 if (super_type.IsMalformed()) H.ReportError("Malformed super type"); 279 if (super_type.IsMalformed()) H.ReportError("Malformed super type");
279 klass->set_super_type(super_type); 280 klass->set_super_type(super_type);
280 } 281 }
281 282
282 // Build implemented interface types 283 // Build implemented interface types
283 intptr_t interface_count = kernel_klass->implemented_classes().length(); 284 intptr_t interface_count = kernel_klass->implemented_classes().length();
284 const dart::Array& interfaces = 285 const dart::Array& interfaces =
285 dart::Array::Handle(Z, dart::Array::New(interface_count)); 286 dart::Array::Handle(Z, dart::Array::New(interface_count));
286 dart::Class& interface_class = dart::Class::Handle(Z); 287 dart::Class& interface_class = dart::Class::Handle(Z);
287 for (intptr_t i = 0; i < interface_count; i++) { 288 for (intptr_t i = 0; i < interface_count; i++) {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 setter.set_result_type(Object::void_type()); 521 setter.set_result_type(Object::void_type());
521 setter.set_is_debuggable(false); 522 setter.set_is_debuggable(false);
522 SetupFieldAccessorFunction(klass, setter); 523 SetupFieldAccessorFunction(klass, setter);
523 } 524 }
524 } 525 }
525 526
526 void KernelReader::SetupFunctionParameters(TranslationHelper translation_helper, 527 void KernelReader::SetupFunctionParameters(TranslationHelper translation_helper,
527 DartTypeTranslator type_translator, 528 DartTypeTranslator type_translator,
528 const dart::Class& klass, 529 const dart::Class& klass,
529 const dart::Function& function, 530 const dart::Function& function,
530 FunctionNode* node, bool is_method, 531 FunctionNode* node,
532 bool is_method,
531 bool is_closure) { 533 bool is_closure) {
532 dart::Zone* zone = translation_helper.zone(); 534 dart::Zone* zone = translation_helper.zone();
533 535
534 ASSERT(!(is_method && is_closure)); 536 ASSERT(!(is_method && is_closure));
535 bool is_factory = function.IsFactory(); 537 bool is_factory = function.IsFactory();
536 intptr_t extra_parameters = (is_method || is_closure || is_factory) ? 1 : 0; 538 intptr_t extra_parameters = (is_method || is_closure || is_factory) ? 1 : 0;
537 539
538 function.set_num_fixed_parameters(extra_parameters + 540 function.set_num_fixed_parameters(extra_parameters +
539 node->required_parameter_count()); 541 node->required_parameter_count());
540 if (node->named_parameters().length() > 0) { 542 if (node->named_parameters().length() > 0) {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 if (kind == Procedure::kIncompleteProcedure) { 691 if (kind == Procedure::kIncompleteProcedure) {
690 return RawFunction::kSignatureFunction; 692 return RawFunction::kSignatureFunction;
691 } else { 693 } else {
692 ASSERT(0 <= kind && kind <= Procedure::kFactory); 694 ASSERT(0 <= kind && kind <= Procedure::kFactory);
693 return static_cast<RawFunction::Kind>(lookuptable[kind]); 695 return static_cast<RawFunction::Kind>(lookuptable[kind]);
694 } 696 }
695 } 697 }
696 698
697 } // namespace kernel 699 } // namespace kernel
698 } // namespace dart 700 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/kernel_reader.h ('k') | runtime/vm/kernel_to_il.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698