| OLD | NEW |
| 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 "lib/mirrors.h" | 5 #include "lib/mirrors.h" |
| 6 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/bootstrap_natives.h" | 8 #include "vm/bootstrap_natives.h" |
| 9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 // Conventions: | 41 // Conventions: |
| 42 // * For throwing a NSM in a class klass we use its runtime type as receiver, | 42 // * For throwing a NSM in a class klass we use its runtime type as receiver, |
| 43 // i.e., klass.RareType(). | 43 // i.e., klass.RareType(). |
| 44 // * For throwing a NSM in a library, we just pass the null instance as | 44 // * For throwing a NSM in a library, we just pass the null instance as |
| 45 // receiver. | 45 // receiver. |
| 46 static void ThrowNoSuchMethod(const Instance& receiver, | 46 static void ThrowNoSuchMethod(const Instance& receiver, |
| 47 const String& function_name, | 47 const String& function_name, |
| 48 const Function& function, | 48 const Function& function, |
| 49 const Array& arguments, | 49 const Array& arguments, |
| 50 const Array& argument_names, |
| 50 const InvocationMirror::Call call, | 51 const InvocationMirror::Call call, |
| 51 const InvocationMirror::Type type) { | 52 const InvocationMirror::Type type) { |
| 52 const Smi& invocation_type = Smi::Handle(Smi::New( | 53 const Smi& invocation_type = Smi::Handle(Smi::New( |
| 53 InvocationMirror::EncodeType(call, type))); | 54 InvocationMirror::EncodeType(call, type))); |
| 54 | 55 |
| 55 const Array& args = Array::Handle(Array::New(6)); | 56 const Array& args = Array::Handle(Array::New(6)); |
| 56 args.SetAt(0, receiver); | 57 args.SetAt(0, receiver); |
| 57 args.SetAt(1, function_name); | 58 args.SetAt(1, function_name); |
| 58 args.SetAt(2, invocation_type); | 59 args.SetAt(2, invocation_type); |
| 59 args.SetAt(3, arguments); | 60 args.SetAt(3, arguments); |
| 60 // TODO(rmacnak): Argument 4 (attempted argument names). | 61 if (!argument_names.IsNull() && (argument_names.Length() > 0)) { |
| 62 // Empty and null are treated differently for some reason. Don't pass empty |
| 63 // to match the non-reflective error. |
| 64 args.SetAt(4, argument_names); |
| 65 } |
| 61 if (!function.IsNull()) { | 66 if (!function.IsNull()) { |
| 62 const intptr_t total_num_parameters = function.NumParameters(); | 67 const Array& array = Array::Handle(Array::New(1)); |
| 63 const Array& array = Array::Handle(Array::New(total_num_parameters)); | 68 array.SetAt(0, String::Handle(function.UserVisibleFormalParameters())); |
| 64 String& param_name = String::Handle(); | |
| 65 for (int i = 0; i < total_num_parameters; i++) { | |
| 66 param_name = function.ParameterNameAt(i); | |
| 67 array.SetAt(i, param_name); | |
| 68 } | |
| 69 args.SetAt(5, array); | 69 args.SetAt(5, array); |
| 70 } | 70 } |
| 71 | 71 |
| 72 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, args); | 72 const Library& libcore = Library::Handle(Library::CoreLibrary()); |
| 73 const Class& NoSuchMethodError = Class::Handle( |
| 74 libcore.LookupClass(Symbols::NoSuchMethodError())); |
| 75 const Function& throwNew = Function::Handle( |
| 76 NoSuchMethodError.LookupFunctionAllowPrivate(Symbols::ThrowNew())); |
| 77 const Object& result = Object::Handle( |
| 78 DartEntry::InvokeFunction(throwNew, args)); |
| 79 ASSERT(result.IsError()); |
| 80 Exceptions::PropagateError(Error::Cast(result)); |
| 73 UNREACHABLE(); | 81 UNREACHABLE(); |
| 74 } | 82 } |
| 75 | 83 |
| 76 | 84 |
| 77 static void EnsureConstructorsAreCompiled(const Function& func) { | 85 static void EnsureConstructorsAreCompiled(const Function& func) { |
| 78 // Only generative constructors can have initializing formals. | 86 // Only generative constructors can have initializing formals. |
| 79 if (!func.IsGenerativeConstructor()) return; | 87 if (!func.IsGenerativeConstructor()) return; |
| 80 | 88 |
| 81 Thread* thread = Thread::Current(); | 89 Thread* thread = Thread::Current(); |
| 82 Zone* zone = thread->zone(); | 90 Zone* zone = thread->zone(); |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 const Object& result = Object::Handle( | 673 const Object& result = Object::Handle( |
| 666 DartEntry::InvokeFunction(getter, Object::empty_array())); | 674 DartEntry::InvokeFunction(getter, Object::empty_array())); |
| 667 return ReturnResult(result); | 675 return ReturnResult(result); |
| 668 } | 676 } |
| 669 | 677 |
| 670 if (throw_nsm_if_absent) { | 678 if (throw_nsm_if_absent) { |
| 671 ThrowNoSuchMethod(Instance::null_instance(), | 679 ThrowNoSuchMethod(Instance::null_instance(), |
| 672 getter_name, | 680 getter_name, |
| 673 getter, | 681 getter, |
| 674 Object::null_array(), | 682 Object::null_array(), |
| 683 Object::null_array(), |
| 675 InvocationMirror::kTopLevel, | 684 InvocationMirror::kTopLevel, |
| 676 InvocationMirror::kGetter); | 685 InvocationMirror::kGetter); |
| 677 UNREACHABLE(); | 686 UNREACHABLE(); |
| 678 } | 687 } |
| 679 | 688 |
| 680 // Fall through case: Indicate that we didn't find any function or field using | 689 // Fall through case: Indicate that we didn't find any function or field using |
| 681 // a special null instance. This is different from a field being null. Callers | 690 // a special null instance. This is different from a field being null. Callers |
| 682 // make sure that this null does not leak into Dartland. | 691 // make sure that this null does not leak into Dartland. |
| 683 return Object::sentinel().raw(); | 692 return Object::sentinel().raw(); |
| 684 } | 693 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 703 const Function& closure_function = | 712 const Function& closure_function = |
| 704 Function::Handle(getter.ImplicitClosureFunction()); | 713 Function::Handle(getter.ImplicitClosureFunction()); |
| 705 return closure_function.ImplicitStaticClosure(); | 714 return closure_function.ImplicitStaticClosure(); |
| 706 } | 715 } |
| 707 } | 716 } |
| 708 if (throw_nsm_if_absent) { | 717 if (throw_nsm_if_absent) { |
| 709 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), | 718 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), |
| 710 getter_name, | 719 getter_name, |
| 711 getter, | 720 getter, |
| 712 Object::null_array(), | 721 Object::null_array(), |
| 722 Object::null_array(), |
| 713 InvocationMirror::kStatic, | 723 InvocationMirror::kStatic, |
| 714 InvocationMirror::kGetter); | 724 InvocationMirror::kGetter); |
| 715 UNREACHABLE(); | 725 UNREACHABLE(); |
| 716 } | 726 } |
| 717 // Fall through case: Indicate that we didn't find any function or field | 727 // Fall through case: Indicate that we didn't find any function or field |
| 718 // using a special null instance. This is different from a field being | 728 // using a special null instance. This is different from a field being |
| 719 // null. Callers make sure that this null does not leak into Dartland. | 729 // null. Callers make sure that this null does not leak into Dartland. |
| 720 return Object::sentinel().raw(); | 730 return Object::sentinel().raw(); |
| 721 } | 731 } |
| 722 | 732 |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names)); | 1516 Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names)); |
| 1507 | 1517 |
| 1508 ArgumentsDescriptor args_descriptor(args_descriptor_array); | 1518 ArgumentsDescriptor args_descriptor(args_descriptor_array); |
| 1509 | 1519 |
| 1510 if (function.IsNull() || | 1520 if (function.IsNull() || |
| 1511 !function.AreValidArguments(args_descriptor, NULL) || | 1521 !function.AreValidArguments(args_descriptor, NULL) || |
| 1512 !function.is_reflectable()) { | 1522 !function.is_reflectable()) { |
| 1513 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), | 1523 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), |
| 1514 function_name, | 1524 function_name, |
| 1515 function, | 1525 function, |
| 1516 Object::null_array(), | 1526 args, |
| 1527 arg_names, |
| 1517 InvocationMirror::kStatic, | 1528 InvocationMirror::kStatic, |
| 1518 InvocationMirror::kMethod); | 1529 InvocationMirror::kMethod); |
| 1519 UNREACHABLE(); | 1530 UNREACHABLE(); |
| 1520 } | 1531 } |
| 1521 | 1532 |
| 1522 Object& result = Object::Handle( | 1533 Object& result = Object::Handle( |
| 1523 DartEntry::InvokeFunction(function, args, args_descriptor_array)); | 1534 DartEntry::InvokeFunction(function, args, args_descriptor_array)); |
| 1524 if (result.IsError()) { | 1535 if (result.IsError()) { |
| 1525 Exceptions::PropagateError(Error::Cast(result)); | 1536 Exceptions::PropagateError(Error::Cast(result)); |
| 1526 UNREACHABLE(); | 1537 UNREACHABLE(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 | 1571 |
| 1561 const int kNumArgs = 1; | 1572 const int kNumArgs = 1; |
| 1562 const Array& args = Array::Handle(Array::New(kNumArgs)); | 1573 const Array& args = Array::Handle(Array::New(kNumArgs)); |
| 1563 args.SetAt(0, value); | 1574 args.SetAt(0, value); |
| 1564 | 1575 |
| 1565 if (setter.IsNull() || !setter.is_reflectable()) { | 1576 if (setter.IsNull() || !setter.is_reflectable()) { |
| 1566 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), | 1577 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), |
| 1567 internal_setter_name, | 1578 internal_setter_name, |
| 1568 setter, | 1579 setter, |
| 1569 args, | 1580 args, |
| 1581 Object::null_array(), |
| 1570 InvocationMirror::kStatic, | 1582 InvocationMirror::kStatic, |
| 1571 InvocationMirror::kSetter); | 1583 InvocationMirror::kSetter); |
| 1572 UNREACHABLE(); | 1584 UNREACHABLE(); |
| 1573 } | 1585 } |
| 1574 | 1586 |
| 1575 // Invoke the setter and return the result. | 1587 // Invoke the setter and return the result. |
| 1576 Object& result = Object::Handle( | 1588 Object& result = Object::Handle( |
| 1577 DartEntry::InvokeFunction(setter, args)); | 1589 DartEntry::InvokeFunction(setter, args)); |
| 1578 if (result.IsError()) { | 1590 if (result.IsError()) { |
| 1579 Exceptions::PropagateError(Error::Cast(result)); | 1591 Exceptions::PropagateError(Error::Cast(result)); |
| 1580 UNREACHABLE(); | 1592 UNREACHABLE(); |
| 1581 } | 1593 } |
| 1582 return result.raw(); | 1594 return result.raw(); |
| 1583 } | 1595 } |
| 1584 | 1596 |
| 1585 if (field.is_final()) { | 1597 if (field.is_final()) { |
| 1586 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), | 1598 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), |
| 1587 internal_setter_name, | 1599 internal_setter_name, |
| 1588 setter, | 1600 setter, |
| 1589 Object::null_array(), | 1601 Object::null_array(), |
| 1602 Object::null_array(), |
| 1590 InvocationMirror::kStatic, | 1603 InvocationMirror::kStatic, |
| 1591 InvocationMirror::kSetter); | 1604 InvocationMirror::kSetter); |
| 1592 UNREACHABLE(); | 1605 UNREACHABLE(); |
| 1593 } | 1606 } |
| 1594 | 1607 |
| 1595 field.set_value(value); | 1608 field.set_value(value); |
| 1596 return value.raw(); | 1609 return value.raw(); |
| 1597 } | 1610 } |
| 1598 | 1611 |
| 1599 | 1612 |
| 1600 DEFINE_NATIVE_ENTRY(ClassMirror_invokeConstructor, 5) { | 1613 DEFINE_NATIVE_ENTRY(ClassMirror_invokeConstructor, 5) { |
| 1601 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 1614 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
| 1602 const Class& klass = Class::Handle(ref.GetClassReferent()); | 1615 const Class& klass = Class::Handle(ref.GetClassReferent()); |
| 1603 GET_NATIVE_ARGUMENT(Type, type, arguments->NativeArgAt(1)); | 1616 GET_NATIVE_ARGUMENT(Type, type, arguments->NativeArgAt(1)); |
| 1604 GET_NON_NULL_NATIVE_ARGUMENT( | 1617 GET_NON_NULL_NATIVE_ARGUMENT( |
| 1605 String, constructor_name, arguments->NativeArgAt(2)); | 1618 String, constructor_name, arguments->NativeArgAt(2)); |
| 1606 GET_NON_NULL_NATIVE_ARGUMENT(Array, explicit_args, arguments->NativeArgAt(3)); | 1619 GET_NON_NULL_NATIVE_ARGUMENT(Array, explicit_args, arguments->NativeArgAt(3)); |
| 1607 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4)); | 1620 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4)); |
| 1608 | 1621 |
| 1609 // By convention, the static function implementing a named constructor 'C' | 1622 // By convention, the static function implementing a named constructor 'C' |
| 1610 // for class 'A' is labeled 'A.C', and the static function implementing the | 1623 // for class 'A' is labeled 'A.C', and the static function implementing the |
| 1611 // unnamed constructor for class 'A' is labeled 'A.'. | 1624 // unnamed constructor for class 'A' is labeled 'A.'. |
| 1612 // This convention prevents users from explicitly calling constructors. | 1625 // This convention prevents users from explicitly calling constructors. |
| 1613 const String& klass_name = String::Handle(klass.Name()); | 1626 const String& klass_name = String::Handle(klass.Name()); |
| 1627 String& external_constructor_name = String::Handle(klass_name.raw()); |
| 1614 String& internal_constructor_name = | 1628 String& internal_constructor_name = |
| 1615 String::Handle(String::Concat(klass_name, Symbols::Dot())); | 1629 String::Handle(String::Concat(klass_name, Symbols::Dot())); |
| 1616 if (!constructor_name.IsNull()) { | 1630 if (!constructor_name.IsNull() && constructor_name.Length() > 0) { |
| 1617 internal_constructor_name = | 1631 internal_constructor_name = |
| 1618 String::Concat(internal_constructor_name, constructor_name); | 1632 String::Concat(internal_constructor_name, constructor_name); |
| 1633 external_constructor_name = internal_constructor_name.raw(); |
| 1619 } | 1634 } |
| 1620 | 1635 |
| 1621 Function& lookup_constructor = Function::Handle( | 1636 Function& lookup_constructor = Function::Handle( |
| 1622 klass.LookupFunction(internal_constructor_name)); | 1637 klass.LookupFunction(internal_constructor_name)); |
| 1623 | 1638 |
| 1624 if (lookup_constructor.IsNull() || | 1639 if (lookup_constructor.IsNull() || |
| 1625 (lookup_constructor.kind() != RawFunction::kConstructor) || | 1640 (lookup_constructor.kind() != RawFunction::kConstructor) || |
| 1626 !lookup_constructor.is_reflectable()) { | 1641 !lookup_constructor.is_reflectable()) { |
| 1627 // Pretend we didn't find the constructor at all when the arity is wrong | |
| 1628 // so as to produce the same NoSuchMethodError as the non-reflective case. | |
| 1629 lookup_constructor = Function::null(); | |
| 1630 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), | 1642 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), |
| 1631 internal_constructor_name, | 1643 external_constructor_name, |
| 1632 lookup_constructor, | 1644 lookup_constructor, |
| 1633 Object::null_array(), | 1645 explicit_args, |
| 1646 arg_names, |
| 1634 InvocationMirror::kConstructor, | 1647 InvocationMirror::kConstructor, |
| 1635 InvocationMirror::kMethod); | 1648 InvocationMirror::kMethod); |
| 1636 UNREACHABLE(); | 1649 UNREACHABLE(); |
| 1637 } | 1650 } |
| 1638 | 1651 |
| 1639 if (klass.is_abstract() && !lookup_constructor.IsFactory()) { | 1652 if (klass.is_abstract() && !lookup_constructor.IsFactory()) { |
| 1640 const Array& error_args = Array::Handle(Array::New(3)); | 1653 const Array& error_args = Array::Handle(Array::New(3)); |
| 1641 error_args.SetAt(0, klass_name); | 1654 error_args.SetAt(0, klass_name); |
| 1642 // 1 = script url | 1655 // 1 = script url |
| 1643 // 2 = token position | 1656 // 2 = token position |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1695 args.SetAt(i + num_implicit_args, explicit_argument); | 1708 args.SetAt(i + num_implicit_args, explicit_argument); |
| 1696 } | 1709 } |
| 1697 | 1710 |
| 1698 const Array& args_descriptor_array = | 1711 const Array& args_descriptor_array = |
| 1699 Array::Handle(ArgumentsDescriptor::New(args.Length(), | 1712 Array::Handle(ArgumentsDescriptor::New(args.Length(), |
| 1700 arg_names)); | 1713 arg_names)); |
| 1701 | 1714 |
| 1702 ArgumentsDescriptor args_descriptor(args_descriptor_array); | 1715 ArgumentsDescriptor args_descriptor(args_descriptor_array); |
| 1703 if (!redirected_constructor.AreValidArguments(args_descriptor, NULL) || | 1716 if (!redirected_constructor.AreValidArguments(args_descriptor, NULL) || |
| 1704 !redirected_constructor.is_reflectable()) { | 1717 !redirected_constructor.is_reflectable()) { |
| 1705 // Pretend we didn't find the constructor at all when the arity is wrong | 1718 external_constructor_name = redirected_constructor.name(); |
| 1706 // so as to produce the same NoSuchMethodError as the non-reflective case. | |
| 1707 redirected_constructor = Function::null(); | |
| 1708 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), | 1719 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), |
| 1709 internal_constructor_name, | 1720 external_constructor_name, |
| 1710 redirected_constructor, | 1721 redirected_constructor, |
| 1711 Object::null_array(), | 1722 explicit_args, |
| 1723 arg_names, |
| 1712 InvocationMirror::kConstructor, | 1724 InvocationMirror::kConstructor, |
| 1713 InvocationMirror::kMethod); | 1725 InvocationMirror::kMethod); |
| 1714 UNREACHABLE(); | 1726 UNREACHABLE(); |
| 1715 } | 1727 } |
| 1716 | 1728 |
| 1717 Instance& new_object = Instance::Handle(); | 1729 Instance& new_object = Instance::Handle(); |
| 1718 if (redirected_constructor.IsGenerativeConstructor()) { | 1730 if (redirected_constructor.IsGenerativeConstructor()) { |
| 1719 // Constructors get the uninitialized object and a constructor phase. Note | 1731 // Constructors get the uninitialized object and a constructor phase. Note |
| 1720 // we have delayed allocation until after the function type and argument | 1732 // we have delayed allocation until after the function type and argument |
| 1721 // matching checks. | 1733 // matching checks. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1798 const Array& args_descriptor_array = | 1810 const Array& args_descriptor_array = |
| 1799 Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names)); | 1811 Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names)); |
| 1800 ArgumentsDescriptor args_descriptor(args_descriptor_array); | 1812 ArgumentsDescriptor args_descriptor(args_descriptor_array); |
| 1801 | 1813 |
| 1802 if (function.IsNull() || | 1814 if (function.IsNull() || |
| 1803 !function.AreValidArguments(args_descriptor, NULL) || | 1815 !function.AreValidArguments(args_descriptor, NULL) || |
| 1804 !function.is_reflectable()) { | 1816 !function.is_reflectable()) { |
| 1805 ThrowNoSuchMethod(Instance::null_instance(), | 1817 ThrowNoSuchMethod(Instance::null_instance(), |
| 1806 function_name, | 1818 function_name, |
| 1807 function, | 1819 function, |
| 1808 Object::null_array(), | 1820 args, |
| 1821 arg_names, |
| 1809 InvocationMirror::kTopLevel, | 1822 InvocationMirror::kTopLevel, |
| 1810 InvocationMirror::kMethod); | 1823 InvocationMirror::kMethod); |
| 1811 UNREACHABLE(); | 1824 UNREACHABLE(); |
| 1812 } | 1825 } |
| 1813 | 1826 |
| 1814 const Object& result = Object::Handle( | 1827 const Object& result = Object::Handle( |
| 1815 DartEntry::InvokeFunction(function, args, args_descriptor_array)); | 1828 DartEntry::InvokeFunction(function, args, args_descriptor_array)); |
| 1816 if (result.IsError()) { | 1829 if (result.IsError()) { |
| 1817 Exceptions::PropagateError(Error::Cast(result)); | 1830 Exceptions::PropagateError(Error::Cast(result)); |
| 1818 UNREACHABLE(); | 1831 UNREACHABLE(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1855 | 1868 |
| 1856 const int kNumArgs = 1; | 1869 const int kNumArgs = 1; |
| 1857 const Array& args = Array::Handle(Array::New(kNumArgs)); | 1870 const Array& args = Array::Handle(Array::New(kNumArgs)); |
| 1858 args.SetAt(0, value); | 1871 args.SetAt(0, value); |
| 1859 | 1872 |
| 1860 if (setter.IsNull() || !setter.is_reflectable()) { | 1873 if (setter.IsNull() || !setter.is_reflectable()) { |
| 1861 ThrowNoSuchMethod(Instance::null_instance(), | 1874 ThrowNoSuchMethod(Instance::null_instance(), |
| 1862 internal_setter_name, | 1875 internal_setter_name, |
| 1863 setter, | 1876 setter, |
| 1864 args, | 1877 args, |
| 1878 Object::null_array(), |
| 1865 InvocationMirror::kTopLevel, | 1879 InvocationMirror::kTopLevel, |
| 1866 InvocationMirror::kSetter); | 1880 InvocationMirror::kSetter); |
| 1867 UNREACHABLE(); | 1881 UNREACHABLE(); |
| 1868 } | 1882 } |
| 1869 | 1883 |
| 1870 // Invoke the setter and return the result. | 1884 // Invoke the setter and return the result. |
| 1871 const Object& result = Object::Handle( | 1885 const Object& result = Object::Handle( |
| 1872 DartEntry::InvokeFunction(setter, args)); | 1886 DartEntry::InvokeFunction(setter, args)); |
| 1873 if (result.IsError()) { | 1887 if (result.IsError()) { |
| 1874 Exceptions::PropagateError(Error::Cast(result)); | 1888 Exceptions::PropagateError(Error::Cast(result)); |
| 1875 UNREACHABLE(); | 1889 UNREACHABLE(); |
| 1876 } | 1890 } |
| 1877 return result.raw(); | 1891 return result.raw(); |
| 1878 } | 1892 } |
| 1879 | 1893 |
| 1880 if (field.is_final()) { | 1894 if (field.is_final()) { |
| 1881 ThrowNoSuchMethod(Instance::null_instance(), | 1895 ThrowNoSuchMethod(Instance::null_instance(), |
| 1882 internal_setter_name, | 1896 internal_setter_name, |
| 1883 setter, | 1897 setter, |
| 1884 Object::null_array(), | 1898 Object::null_array(), |
| 1899 Object::null_array(), |
| 1885 InvocationMirror::kTopLevel, | 1900 InvocationMirror::kTopLevel, |
| 1886 InvocationMirror::kSetter); | 1901 InvocationMirror::kSetter); |
| 1887 UNREACHABLE(); | 1902 UNREACHABLE(); |
| 1888 } | 1903 } |
| 1889 | 1904 |
| 1890 field.set_value(value); | 1905 field.set_value(value); |
| 1891 return value.raw(); | 1906 return value.raw(); |
| 1892 } | 1907 } |
| 1893 | 1908 |
| 1894 | 1909 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2067 } | 2082 } |
| 2068 | 2083 |
| 2069 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { | 2084 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { |
| 2070 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); | 2085 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); |
| 2071 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); | 2086 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); |
| 2072 return Bool::Get(a.IsSubtypeOf(b, NULL)).raw(); | 2087 return Bool::Get(a.IsSubtypeOf(b, NULL)).raw(); |
| 2073 } | 2088 } |
| 2074 | 2089 |
| 2075 | 2090 |
| 2076 } // namespace dart | 2091 } // namespace dart |
| OLD | NEW |