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

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

Issue 1289643005: Rename accessors of class Field to make it more apparent as to what is being accessed - static fiel… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: self-code-review Created 5 years, 3 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 4374 matching lines...) Expand 10 before | Expand all | Expand 10 after
4385 const String& getter_name = 4385 const String& getter_name =
4386 String::Handle(isolate, Field::GetterName(field_name)); 4386 String::Handle(isolate, Field::GetterName(field_name));
4387 getter = cls.LookupStaticFunctionAllowPrivate(getter_name); 4387 getter = cls.LookupStaticFunctionAllowPrivate(getter_name);
4388 } 4388 }
4389 4389
4390 if (!getter.IsNull()) { 4390 if (!getter.IsNull()) {
4391 // Invoke the getter and return the result. 4391 // Invoke the getter and return the result.
4392 return Api::NewHandle( 4392 return Api::NewHandle(
4393 isolate, DartEntry::InvokeFunction(getter, Object::empty_array())); 4393 isolate, DartEntry::InvokeFunction(getter, Object::empty_array()));
4394 } else if (!field.IsNull()) { 4394 } else if (!field.IsNull()) {
4395 return Api::NewHandle(isolate, field.value()); 4395 return Api::NewHandle(isolate, field.StaticFieldValue());
4396 } else { 4396 } else {
4397 return Api::NewError("%s: did not find static field '%s'.", 4397 return Api::NewError("%s: did not find static field '%s'.",
4398 CURRENT_FUNC, field_name.ToCString()); 4398 CURRENT_FUNC, field_name.ToCString());
4399 } 4399 }
4400 4400
4401 } else if (obj.IsInstance()) { 4401 } else if (obj.IsInstance()) {
4402 // Every instance field has a getter Function. Try to find the 4402 // Every instance field has a getter Function. Try to find the
4403 // getter in any superclass and use that function to access the 4403 // getter in any superclass and use that function to access the
4404 // field. 4404 // field.
4405 const Instance& instance = Instance::Cast(obj); 4405 const Instance& instance = Instance::Cast(obj);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
4453 String::Handle(isolate, Field::GetterName(field_name)); 4453 String::Handle(isolate, Field::GetterName(field_name));
4454 getter = cls.LookupStaticFunctionAllowPrivate(getter_name); 4454 getter = cls.LookupStaticFunctionAllowPrivate(getter_name);
4455 } 4455 }
4456 4456
4457 if (!getter.IsNull()) { 4457 if (!getter.IsNull()) {
4458 // Invoke the getter and return the result. 4458 // Invoke the getter and return the result.
4459 return Api::NewHandle( 4459 return Api::NewHandle(
4460 isolate, DartEntry::InvokeFunction(getter, Object::empty_array())); 4460 isolate, DartEntry::InvokeFunction(getter, Object::empty_array()));
4461 } 4461 }
4462 if (!field.IsNull()) { 4462 if (!field.IsNull()) {
4463 return Api::NewHandle(isolate, field.value()); 4463 return Api::NewHandle(isolate, field.StaticFieldValue());
4464 } 4464 }
4465 return Api::NewError("%s: did not find top-level variable '%s'.", 4465 return Api::NewError("%s: did not find top-level variable '%s'.",
4466 CURRENT_FUNC, field_name.ToCString()); 4466 CURRENT_FUNC, field_name.ToCString());
4467 4467
4468 } else if (obj.IsError()) { 4468 } else if (obj.IsError()) {
4469 return container; 4469 return container;
4470 } else { 4470 } else {
4471 return Api::NewError( 4471 return Api::NewError(
4472 "%s expects argument 'container' to be an object, type, or library.", 4472 "%s expects argument 'container' to be an object, type, or library.",
4473 CURRENT_FUNC); 4473 CURRENT_FUNC);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4529 if (result.IsError()) { 4529 if (result.IsError()) {
4530 return Api::NewHandle(isolate, result.raw()); 4530 return Api::NewHandle(isolate, result.raw());
4531 } else { 4531 } else {
4532 return Api::Success(); 4532 return Api::Success();
4533 } 4533 }
4534 } else if (!field.IsNull()) { 4534 } else if (!field.IsNull()) {
4535 if (field.is_final()) { 4535 if (field.is_final()) {
4536 return Api::NewError("%s: cannot set final field '%s'.", 4536 return Api::NewError("%s: cannot set final field '%s'.",
4537 CURRENT_FUNC, field_name.ToCString()); 4537 CURRENT_FUNC, field_name.ToCString());
4538 } else { 4538 } else {
4539 field.set_value(value_instance); 4539 field.SetStaticFieldValue(value_instance);
4540 return Api::Success(); 4540 return Api::Success();
4541 } 4541 }
4542 } else { 4542 } else {
4543 return Api::NewError("%s: did not find static field '%s'.", 4543 return Api::NewError("%s: did not find static field '%s'.",
4544 CURRENT_FUNC, field_name.ToCString()); 4544 CURRENT_FUNC, field_name.ToCString());
4545 } 4545 }
4546 4546
4547 } else if (obj.IsInstance()) { 4547 } else if (obj.IsInstance()) {
4548 // Every instance field has a setter Function. Try to find the 4548 // Every instance field has a setter Function. Try to find the
4549 // setter in any superclass and use that function to access the 4549 // setter in any superclass and use that function to access the
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
4609 if (result.IsError()) { 4609 if (result.IsError()) {
4610 return Api::NewHandle(isolate, result.raw()); 4610 return Api::NewHandle(isolate, result.raw());
4611 } 4611 }
4612 return Api::Success(); 4612 return Api::Success();
4613 } 4613 }
4614 if (!field.IsNull()) { 4614 if (!field.IsNull()) {
4615 if (field.is_final()) { 4615 if (field.is_final()) {
4616 return Api::NewError("%s: cannot set final top-level variable '%s'.", 4616 return Api::NewError("%s: cannot set final top-level variable '%s'.",
4617 CURRENT_FUNC, field_name.ToCString()); 4617 CURRENT_FUNC, field_name.ToCString());
4618 } 4618 }
4619 field.set_value(value_instance); 4619 field.SetStaticFieldValue(value_instance);
4620 return Api::Success(); 4620 return Api::Success();
4621 } 4621 }
4622 return Api::NewError("%s: did not find top-level variable '%s'.", 4622 return Api::NewError("%s: did not find top-level variable '%s'.",
4623 CURRENT_FUNC, field_name.ToCString()); 4623 CURRENT_FUNC, field_name.ToCString());
4624 4624
4625 } else if (obj.IsError()) { 4625 } else if (obj.IsError()) {
4626 return container; 4626 return container;
4627 } 4627 }
4628 return Api::NewError( 4628 return Api::NewError(
4629 "%s expects argument 'container' to be an object, type, or library.", 4629 "%s expects argument 'container' to be an object, type, or library.",
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
5667 // The code that completes the futures (invoked below) may call into the 5667 // The code that completes the futures (invoked below) may call into the
5668 // newly loaded code and trigger one of these breakpoints. 5668 // newly loaded code and trigger one of these breakpoints.
5669 isolate->debugger()->NotifyDoneLoading(); 5669 isolate->debugger()->NotifyDoneLoading();
5670 5670
5671 // Notify mirrors that MirrorSystem.libraries needs to be recomputed. 5671 // Notify mirrors that MirrorSystem.libraries needs to be recomputed.
5672 const Library& libmirrors = 5672 const Library& libmirrors =
5673 Library::Handle(isolate, Library::MirrorsLibrary()); 5673 Library::Handle(isolate, Library::MirrorsLibrary());
5674 const Field& dirty_bit = Field::Handle(isolate, 5674 const Field& dirty_bit = Field::Handle(isolate,
5675 libmirrors.LookupLocalField(String::Handle(String::New("dirty")))); 5675 libmirrors.LookupLocalField(String::Handle(String::New("dirty"))));
5676 ASSERT(!dirty_bit.IsNull() && dirty_bit.is_static()); 5676 ASSERT(!dirty_bit.IsNull() && dirty_bit.is_static());
5677 dirty_bit.set_value(Bool::True()); 5677 dirty_bit.SetStaticFieldValue(Bool::True());
5678 5678
5679 if (complete_futures) { 5679 if (complete_futures) {
5680 const Library& corelib = Library::Handle(isolate, Library::CoreLibrary()); 5680 const Library& corelib = Library::Handle(isolate, Library::CoreLibrary());
5681 const String& function_name = 5681 const String& function_name =
5682 String::Handle(isolate, String::New("_completeDeferredLoads")); 5682 String::Handle(isolate, String::New("_completeDeferredLoads"));
5683 const Function& function = 5683 const Function& function =
5684 Function::Handle(isolate, 5684 Function::Handle(isolate,
5685 corelib.LookupFunctionAllowPrivate(function_name)); 5685 corelib.LookupFunctionAllowPrivate(function_name));
5686 ASSERT(!function.IsNull()); 5686 ASSERT(!function.IsNull());
5687 const Array& args = Array::empty_array(); 5687 const Array& args = Array::empty_array();
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
6038 ASSERT(stream != NULL); 6038 ASSERT(stream != NULL);
6039 TimelineEvent* event = stream->StartEvent(); 6039 TimelineEvent* event = stream->StartEvent();
6040 if (event != NULL) { 6040 if (event != NULL) {
6041 event->AsyncEnd(label, async_id); 6041 event->AsyncEnd(label, async_id);
6042 event->Complete(); 6042 event->Complete();
6043 } 6043 }
6044 return Api::Success(); 6044 return Api::Success();
6045 } 6045 }
6046 6046
6047 } // namespace dart 6047 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698