Chromium Code Reviews| Index: runtime/lib/mirrors.cc |
| diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc |
| index d0e4524e01cac94453ac7a1f6c78580271a715f7..92900fcfc1f106e7fc7a6b268fb5136b52bc2cfa 100644 |
| --- a/runtime/lib/mirrors.cc |
| +++ b/runtime/lib/mirrors.cc |
| @@ -486,6 +486,7 @@ DEFINE_NATIVE_ENTRY(ClassMirror_members, 2) { |
| Function& func = Function::Handle(); |
| for (intptr_t i = 0; i < num_functions; i++) { |
| func ^= functions.At(i); |
| + if (!func.is_visible()) continue; |
|
srdjan
2013/08/13 00:41:23
Instead of 'continue', I would write:
if (func.is_
|
| if (func.kind() == RawFunction::kRegularFunction || |
| func.kind() == RawFunction::kGetterFunction || |
| func.kind() == RawFunction::kSetterFunction) { |
| @@ -635,7 +636,7 @@ static RawObject* ReflectivelyInvokeDynamicFunction(const Instance& receiver, |
| // Note "arguments" is already the internal arguments with the receiver as |
| // the first element. |
| Object& result = Object::Handle(); |
| - if (function.IsNull()) { |
| + if (function.IsNull() || !function.is_visible()) { |
| const Array& arguments_descriptor = |
| Array::Handle(ArgumentsDescriptor::New(arguments.Length())); |
| result = DartEntry::InvokeNoSuchMethod(receiver, |
| @@ -894,7 +895,8 @@ DEFINE_NATIVE_ENTRY(ClassMirror_invoke, 4) { |
| if (function.IsNull() || |
| !function.AreValidArgumentCounts(number_of_arguments, |
| /* named_args */ 0, |
| - NULL)) { |
| + NULL) || |
| + !function.is_visible()) { |
| ThrowNoSuchMethod(klass, |
| function_name, |
| function, |
| @@ -929,7 +931,7 @@ DEFINE_NATIVE_ENTRY(ClassMirror_invokeGetter, 3) { |
| const Function& getter = Function::Handle( |
| klass.LookupStaticFunctionAllowPrivate(internal_getter_name)); |
| - if (getter.IsNull()) { |
| + if (getter.IsNull() || !getter.is_visible()) { |
| ThrowNoSuchMethod(klass, |
| getter_name, |
| getter, |
| @@ -968,7 +970,7 @@ DEFINE_NATIVE_ENTRY(ClassMirror_invokeSetter, 4) { |
| const Function& setter = Function::Handle( |
| klass.LookupStaticFunctionAllowPrivate(internal_setter_name)); |
| - if (setter.IsNull()) { |
| + if (setter.IsNull() || !setter.is_visible()) { |
| ThrowNoSuchMethod(klass, |
| setter_name, |
| setter, |
| @@ -1035,7 +1037,8 @@ DEFINE_NATIVE_ENTRY(ClassMirror_invokeConstructor, 3) { |
| !constructor.AreValidArgumentCounts(number_of_arguments + |
| constructor.NumImplicitParameters(), |
| /* named args */ 0, |
| - NULL)) { |
| + NULL) || |
| + !constructor.is_visible()) { |
| // Pretend we didn't find the constructor at all when the arity is wrong |
| // so as to produce the same NoSuchMethodError as the non-reflective case. |
| constructor = Function::null(); |
| @@ -1086,7 +1089,8 @@ DEFINE_NATIVE_ENTRY(LibraryMirror_invoke, 4) { |
| if (function.IsNull() || |
| !function.AreValidArgumentCounts(number_of_arguments, |
| 0, |
| - NULL) ) { |
| + NULL) || |
| + !function.is_visible()) { |
| ThrowNoSuchMethod(library, |
| function_name, |
| function, |
| @@ -1134,7 +1138,7 @@ DEFINE_NATIVE_ENTRY(LibraryMirror_invokeGetter, 3) { |
| getter = klass.LookupStaticFunctionAllowPrivate(internal_getter_name); |
| } |
| - if (!getter.IsNull()) { |
| + if (!getter.IsNull() && getter.is_visible()) { |
| // Invoke the getter and return the result. |
| const Object& result = Object::Handle( |
| DartEntry::InvokeFunction(getter, Object::empty_array())); |
| @@ -1183,7 +1187,7 @@ DEFINE_NATIVE_ENTRY(LibraryMirror_invokeSetter, 4) { |
| const Function& setter = Function::Handle( |
| library.LookupFunctionAllowPrivate(internal_setter_name, |
| &ambiguity_error_msg)); |
| - if (setter.IsNull()) { |
| + if (setter.IsNull() || !setter.is_visible()) { |
| if (ambiguity_error_msg.IsNull()) { |
| ThrowNoSuchMethod(library, |
| setter_name, |