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

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

Issue 2583153002: Set correct script on fields in kernel. (Closed)
Patch Set: Created 4 years 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 | « no previous file | runtime/vm/object.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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 ActiveClassScope active_class_scope(&active_class_, kernel_klass, &klass); 287 ActiveClassScope active_class_scope(&active_class_, kernel_klass, &klass);
288 288
289 for (intptr_t i = 0; i < kernel_klass->fields().length(); i++) { 289 for (intptr_t i = 0; i < kernel_klass->fields().length(); i++) {
290 Field* kernel_field = kernel_klass->fields()[i]; 290 Field* kernel_field = kernel_klass->fields()[i];
291 ActiveMemberScope active_member_scope(&active_class_, kernel_field); 291 ActiveMemberScope active_member_scope(&active_class_, kernel_field);
292 292
293 const dart::String& name = H.DartFieldName(kernel_field->name()); 293 const dart::String& name = H.DartFieldName(kernel_field->name());
294 const AbstractType& type = 294 const AbstractType& type =
295 T.TranslateTypeWithoutFinalization(kernel_field->type()); 295 T.TranslateTypeWithoutFinalization(kernel_field->type());
296 const Object& script_class =
297 ClassForScriptAt(klass, kernel_field->source_uri_index());
296 dart::Field& field = dart::Field::Handle( 298 dart::Field& field = dart::Field::Handle(
297 Z, dart::Field::New(name, kernel_field->IsStatic(), 299 Z, dart::Field::New(name, kernel_field->IsStatic(),
298 // In the VM all const fields are implicitly final 300 // In the VM all const fields are implicitly final
299 // whereas in Kernel they are not final because they 301 // whereas in Kernel they are not final because they
300 // are not explicitly declared that way. 302 // are not explicitly declared that way.
301 kernel_field->IsFinal() || kernel_field->IsConst(), 303 kernel_field->IsFinal() || kernel_field->IsConst(),
302 kernel_field->IsConst(), 304 kernel_field->IsConst(),
303 false, // is_reflectable 305 false, // is_reflectable
304 klass, type, kernel_field->position())); 306 script_class, type, kernel_field->position()));
305 field.set_kernel_field(kernel_field); 307 field.set_kernel_field(kernel_field);
306 field.set_has_initializer(kernel_field->initializer() != NULL); 308 field.set_has_initializer(kernel_field->initializer() != NULL);
307 GenerateFieldAccessors(klass, field, kernel_field); 309 GenerateFieldAccessors(klass, field, kernel_field);
308 klass.AddField(field); 310 klass.AddField(field);
309 } 311 }
310 312
311 for (intptr_t i = 0; i < kernel_klass->constructors().length(); i++) { 313 for (intptr_t i = 0; i < kernel_klass->constructors().length(); i++) {
312 Constructor* kernel_constructor = kernel_klass->constructors()[i]; 314 Constructor* kernel_constructor = kernel_klass->constructors()[i];
313 ActiveMemberScope active_member_scope(&active_class_, kernel_constructor); 315 ActiveMemberScope active_member_scope(&active_class_, kernel_constructor);
314 ActiveFunctionScope active_function_scope(&active_class_, 316 ActiveFunctionScope active_function_scope(&active_class_,
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 initializer_fun.set_is_debuggable(false); 710 initializer_fun.set_is_debuggable(false);
709 initializer_fun.set_is_reflectable(false); 711 initializer_fun.set_is_reflectable(false);
710 initializer_fun.set_is_inlinable(false); 712 initializer_fun.set_is_inlinable(false);
711 return new (zone) ParsedFunction(thread, initializer_fun); 713 return new (zone) ParsedFunction(thread, initializer_fun);
712 } 714 }
713 715
714 716
715 } // namespace kernel 717 } // namespace kernel
716 } // namespace dart 718 } // namespace dart
717 #endif // !defined(DART_PRECOMPILED_RUNTIME) 719 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698