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

Side by Side Diff: runtime/lib/mirrors.cc

Issue 326263002: Add missing demangling to the VM's NoSuchMethodError. Ensure the NoSuchMethorError for reflective i… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/lib/errors_patch.dart ('k') | runtime/lib/mirrors_patch.dart » ('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) 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/invocation_mirror.h" 5 #include "lib/invocation_mirror.h"
6 #include "vm/bootstrap_natives.h" 6 #include "vm/bootstrap_natives.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/exceptions.h" 10 #include "vm/exceptions.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 59
60 // Conventions: 60 // Conventions:
61 // * For throwing a NSM in a class klass we use its runtime type as receiver, 61 // * For throwing a NSM in a class klass we use its runtime type as receiver,
62 // i.e., klass.RareType(). 62 // i.e., klass.RareType().
63 // * For throwing a NSM in a library, we just pass the null instance as 63 // * For throwing a NSM in a library, we just pass the null instance as
64 // receiver. 64 // receiver.
65 static void ThrowNoSuchMethod(const Instance& receiver, 65 static void ThrowNoSuchMethod(const Instance& receiver,
66 const String& function_name, 66 const String& function_name,
67 const Function& function, 67 const Function& function,
68 const Array& arguments,
68 const InvocationMirror::Call call, 69 const InvocationMirror::Call call,
69 const InvocationMirror::Type type) { 70 const InvocationMirror::Type type) {
70 const Smi& invocation_type = Smi::Handle(Smi::New( 71 const Smi& invocation_type = Smi::Handle(Smi::New(
71 InvocationMirror::EncodeType(call, type))); 72 InvocationMirror::EncodeType(call, type)));
72 73
73 const Array& args = Array::Handle(Array::New(6)); 74 const Array& args = Array::Handle(Array::New(6));
74 args.SetAt(0, receiver); 75 args.SetAt(0, receiver);
75 args.SetAt(1, function_name); 76 args.SetAt(1, function_name);
76 args.SetAt(2, invocation_type); 77 args.SetAt(2, invocation_type);
77 // Parameter 3 (actual arguments): We omit this parameter to get the same 78 args.SetAt(3, arguments);
78 // error message as one would get by invoking the function non-reflectively. 79 // TODO(rmacnak): Argument 4 (attempted argument names).
79 // Parameter 4 (named arguments): We omit this parameters since we cannot
80 // invoke functions with named parameters reflectively (using mirrors).
81 if (!function.IsNull()) { 80 if (!function.IsNull()) {
82 const intptr_t total_num_parameters = function.NumParameters(); 81 const intptr_t total_num_parameters = function.NumParameters();
83 const Array& array = Array::Handle(Array::New(total_num_parameters)); 82 const Array& array = Array::Handle(Array::New(total_num_parameters));
84 String& param_name = String::Handle(); 83 String& param_name = String::Handle();
85 for (int i = 0; i < total_num_parameters; i++) { 84 for (int i = 0; i < total_num_parameters; i++) {
86 param_name = function.ParameterNameAt(i); 85 param_name = function.ParameterNameAt(i);
87 array.SetAt(i, param_name); 86 array.SetAt(i, param_name);
88 } 87 }
89 args.SetAt(5, array); 88 args.SetAt(5, array);
90 } 89 }
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 // Invoke the getter and return the result. 669 // Invoke the getter and return the result.
671 const Object& result = Object::Handle( 670 const Object& result = Object::Handle(
672 DartEntry::InvokeFunction(getter, Object::empty_array())); 671 DartEntry::InvokeFunction(getter, Object::empty_array()));
673 return ReturnResult(result); 672 return ReturnResult(result);
674 } 673 }
675 674
676 if (throw_nsm_if_absent) { 675 if (throw_nsm_if_absent) {
677 ThrowNoSuchMethod(Instance::null_instance(), 676 ThrowNoSuchMethod(Instance::null_instance(),
678 getter_name, 677 getter_name,
679 getter, 678 getter,
679 Object::null_array(),
680 InvocationMirror::kTopLevel, 680 InvocationMirror::kTopLevel,
681 InvocationMirror::kGetter); 681 InvocationMirror::kGetter);
682 UNREACHABLE(); 682 UNREACHABLE();
683 } 683 }
684 684
685 // Fall through case: Indicate that we didn't find any function or field using 685 // Fall through case: Indicate that we didn't find any function or field using
686 // a special null instance. This is different from a field being null. Callers 686 // a special null instance. This is different from a field being null. Callers
687 // make sure that this null does not leak into Dartland. 687 // make sure that this null does not leak into Dartland.
688 return Object::sentinel().raw(); 688 return Object::sentinel().raw();
689 } 689 }
(...skipping 17 matching lines...) Expand all
707 // Looking for a getter but found a regular method: closurize it. 707 // Looking for a getter but found a regular method: closurize it.
708 const Function& closure_function = 708 const Function& closure_function =
709 Function::Handle(getter.ImplicitClosureFunction()); 709 Function::Handle(getter.ImplicitClosureFunction());
710 return closure_function.ImplicitStaticClosure(); 710 return closure_function.ImplicitStaticClosure();
711 } 711 }
712 } 712 }
713 if (throw_nsm_if_absent) { 713 if (throw_nsm_if_absent) {
714 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), 714 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()),
715 getter_name, 715 getter_name,
716 getter, 716 getter,
717 Object::null_array(),
717 InvocationMirror::kStatic, 718 InvocationMirror::kStatic,
718 InvocationMirror::kGetter); 719 InvocationMirror::kGetter);
719 UNREACHABLE(); 720 UNREACHABLE();
720 } 721 }
721 // Fall through case: Indicate that we didn't find any function or field 722 // Fall through case: Indicate that we didn't find any function or field
722 // using a special null instance. This is different from a field being 723 // using a special null instance. This is different from a field being
723 // null. Callers make sure that this null does not leak into Dartland. 724 // null. Callers make sure that this null does not leak into Dartland.
724 return Object::sentinel().raw(); 725 return Object::sentinel().raw();
725 } 726 }
726 727
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names)); 1437 Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names));
1437 1438
1438 ArgumentsDescriptor args_descriptor(args_descriptor_array); 1439 ArgumentsDescriptor args_descriptor(args_descriptor_array);
1439 1440
1440 if (function.IsNull() || 1441 if (function.IsNull() ||
1441 !function.AreValidArguments(args_descriptor, NULL) || 1442 !function.AreValidArguments(args_descriptor, NULL) ||
1442 !function.is_visible()) { 1443 !function.is_visible()) {
1443 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), 1444 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()),
1444 function_name, 1445 function_name,
1445 function, 1446 function,
1447 Object::null_array(),
1446 InvocationMirror::kStatic, 1448 InvocationMirror::kStatic,
1447 InvocationMirror::kMethod); 1449 InvocationMirror::kMethod);
1448 UNREACHABLE(); 1450 UNREACHABLE();
1449 } 1451 }
1450 1452
1451 Object& result = Object::Handle( 1453 Object& result = Object::Handle(
1452 DartEntry::InvokeFunction(function, args, args_descriptor_array)); 1454 DartEntry::InvokeFunction(function, args, args_descriptor_array));
1453 if (result.IsError()) { 1455 if (result.IsError()) {
1454 ThrowInvokeError(Error::Cast(result)); 1456 ThrowInvokeError(Error::Cast(result));
1455 UNREACHABLE(); 1457 UNREACHABLE();
(...skipping 18 matching lines...) Expand all
1474 // because this native is an instance method in order to be polymorphic 1476 // because this native is an instance method in order to be polymorphic
1475 // with its cousins. 1477 // with its cousins.
1476 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1)); 1478 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1));
1477 const Class& klass = Class::Handle(ref.GetClassReferent()); 1479 const Class& klass = Class::Handle(ref.GetClassReferent());
1478 GET_NON_NULL_NATIVE_ARGUMENT(String, setter_name, arguments->NativeArgAt(2)); 1480 GET_NON_NULL_NATIVE_ARGUMENT(String, setter_name, arguments->NativeArgAt(2));
1479 GET_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(3)); 1481 GET_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(3));
1480 1482
1481 // Check for real fields and user-defined setters. 1483 // Check for real fields and user-defined setters.
1482 const Field& field = Field::Handle(klass.LookupStaticField(setter_name)); 1484 const Field& field = Field::Handle(klass.LookupStaticField(setter_name));
1483 Function& setter = Function::Handle(); 1485 Function& setter = Function::Handle();
1484 if (field.IsNull()) { 1486 const String& internal_setter_name = String::Handle(
1485 const String& internal_setter_name = String::Handle(
1486 Field::SetterName(setter_name)); 1487 Field::SetterName(setter_name));
1487 1488
1489 if (field.IsNull()) {
1488 setter = klass.LookupStaticFunction(internal_setter_name); 1490 setter = klass.LookupStaticFunction(internal_setter_name);
1489 1491
1492 const int kNumArgs = 1;
1493 const Array& args = Array::Handle(Array::New(kNumArgs));
1494 args.SetAt(0, value);
1495
1490 if (setter.IsNull() || !setter.is_visible()) { 1496 if (setter.IsNull() || !setter.is_visible()) {
1491 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), 1497 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()),
1492 setter_name, 1498 internal_setter_name,
1493 setter, 1499 setter,
1500 args,
1494 InvocationMirror::kStatic, 1501 InvocationMirror::kStatic,
1495 InvocationMirror::kSetter); 1502 InvocationMirror::kSetter);
1496 UNREACHABLE(); 1503 UNREACHABLE();
1497 } 1504 }
1498 1505
1499 // Invoke the setter and return the result. 1506 // Invoke the setter and return the result.
1500 const int kNumArgs = 1;
1501 const Array& args = Array::Handle(Array::New(kNumArgs));
1502 args.SetAt(0, value);
1503
1504 Object& result = Object::Handle( 1507 Object& result = Object::Handle(
1505 DartEntry::InvokeFunction(setter, args)); 1508 DartEntry::InvokeFunction(setter, args));
1506 if (result.IsError()) { 1509 if (result.IsError()) {
1507 ThrowInvokeError(Error::Cast(result)); 1510 ThrowInvokeError(Error::Cast(result));
1508 UNREACHABLE(); 1511 UNREACHABLE();
1509 } 1512 }
1510 return result.raw(); 1513 return result.raw();
1511 } 1514 }
1512 1515
1513 if (field.is_final()) { 1516 if (field.is_final()) {
1514 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), 1517 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()),
1515 setter_name, 1518 internal_setter_name,
1516 setter, 1519 setter,
1520 Object::null_array(),
1517 InvocationMirror::kStatic, 1521 InvocationMirror::kStatic,
1518 InvocationMirror::kSetter); 1522 InvocationMirror::kSetter);
1519 UNREACHABLE(); 1523 UNREACHABLE();
1520 } 1524 }
1521 1525
1522 field.set_value(value); 1526 field.set_value(value);
1523 return value.raw(); 1527 return value.raw();
1524 } 1528 }
1525 1529
1526 1530
(...skipping 23 matching lines...) Expand all
1550 1554
1551 if (lookup_constructor.IsNull() || 1555 if (lookup_constructor.IsNull() ||
1552 !(lookup_constructor.IsConstructor() || lookup_constructor.IsFactory()) || 1556 !(lookup_constructor.IsConstructor() || lookup_constructor.IsFactory()) ||
1553 !lookup_constructor.is_visible()) { 1557 !lookup_constructor.is_visible()) {
1554 // Pretend we didn't find the constructor at all when the arity is wrong 1558 // Pretend we didn't find the constructor at all when the arity is wrong
1555 // so as to produce the same NoSuchMethodError as the non-reflective case. 1559 // so as to produce the same NoSuchMethodError as the non-reflective case.
1556 lookup_constructor = Function::null(); 1560 lookup_constructor = Function::null();
1557 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), 1561 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()),
1558 internal_constructor_name, 1562 internal_constructor_name,
1559 lookup_constructor, 1563 lookup_constructor,
1564 Object::null_array(),
1560 InvocationMirror::kConstructor, 1565 InvocationMirror::kConstructor,
1561 InvocationMirror::kMethod); 1566 InvocationMirror::kMethod);
1562 UNREACHABLE(); 1567 UNREACHABLE();
1563 } 1568 }
1564 1569
1565 if (klass.is_abstract() && !lookup_constructor.IsFactory()) { 1570 if (klass.is_abstract() && !lookup_constructor.IsFactory()) {
1566 const Array& error_args = Array::Handle(Array::New(3)); 1571 const Array& error_args = Array::Handle(Array::New(3));
1567 error_args.SetAt(0, klass_name); 1572 error_args.SetAt(0, klass_name);
1568 // 1 = script url 1573 // 1 = script url
1569 // 2 = token position 1574 // 2 = token position
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 1632
1628 ArgumentsDescriptor args_descriptor(args_descriptor_array); 1633 ArgumentsDescriptor args_descriptor(args_descriptor_array);
1629 if (!redirected_constructor.AreValidArguments(args_descriptor, NULL) || 1634 if (!redirected_constructor.AreValidArguments(args_descriptor, NULL) ||
1630 !redirected_constructor.is_visible()) { 1635 !redirected_constructor.is_visible()) {
1631 // Pretend we didn't find the constructor at all when the arity is wrong 1636 // Pretend we didn't find the constructor at all when the arity is wrong
1632 // so as to produce the same NoSuchMethodError as the non-reflective case. 1637 // so as to produce the same NoSuchMethodError as the non-reflective case.
1633 redirected_constructor = Function::null(); 1638 redirected_constructor = Function::null();
1634 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), 1639 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()),
1635 internal_constructor_name, 1640 internal_constructor_name,
1636 redirected_constructor, 1641 redirected_constructor,
1642 Object::null_array(),
1637 InvocationMirror::kConstructor, 1643 InvocationMirror::kConstructor,
1638 InvocationMirror::kMethod); 1644 InvocationMirror::kMethod);
1639 UNREACHABLE(); 1645 UNREACHABLE();
1640 } 1646 }
1641 1647
1642 Instance& new_object = Instance::Handle(); 1648 Instance& new_object = Instance::Handle();
1643 if (redirected_constructor.IsConstructor()) { 1649 if (redirected_constructor.IsConstructor()) {
1644 // Constructors get the uninitialized object and a constructor phase. Note 1650 // Constructors get the uninitialized object and a constructor phase. Note
1645 // we have delayed allocation until after the function type and argument 1651 // we have delayed allocation until after the function type and argument
1646 // matching checks. 1652 // matching checks.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 String, function_name, arguments->NativeArgAt(2)); 1695 String, function_name, arguments->NativeArgAt(2));
1690 GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3)); 1696 GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3));
1691 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4)); 1697 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4));
1692 1698
1693 Function& function = Function::Handle( 1699 Function& function = Function::Handle(
1694 library.LookupLocalFunction(function_name)); 1700 library.LookupLocalFunction(function_name));
1695 1701
1696 if (function.IsNull()) { 1702 if (function.IsNull()) {
1697 // Didn't find a method: try to find a getter and invoke call on its result. 1703 // Didn't find a method: try to find a getter and invoke call on its result.
1698 const Instance& getter_result = 1704 const Instance& getter_result =
1699 Instance::Handle(InvokeLibraryGetter(library, function_name, true)); 1705 Instance::Handle(InvokeLibraryGetter(library, function_name, false));
1700 // Make room for the closure (receiver) in arguments. 1706 if (getter_result.raw() != Object::sentinel().raw()) {
1701 intptr_t numArgs = args.Length(); 1707 // Make room for the closure (receiver) in arguments.
1702 const Array& call_args = Array::Handle(Array::New(numArgs + 1)); 1708 intptr_t numArgs = args.Length();
1703 Object& temp = Object::Handle(); 1709 const Array& call_args = Array::Handle(Array::New(numArgs + 1));
1704 for (int i = 0; i < numArgs; i++) { 1710 Object& temp = Object::Handle();
1705 temp = args.At(i); 1711 for (int i = 0; i < numArgs; i++) {
1706 call_args.SetAt(i + 1, temp); 1712 temp = args.At(i);
1713 call_args.SetAt(i + 1, temp);
1714 }
1715 call_args.SetAt(0, getter_result);
1716 const Array& call_args_descriptor_array = Array::Handle(
1717 ArgumentsDescriptor::New(call_args.Length(), arg_names));
1718 // Call closure.
1719 const Object& call_result = Object::Handle(
1720 DartEntry::InvokeClosure(call_args, call_args_descriptor_array));
1721 if (call_result.IsError()) {
1722 ThrowInvokeError(Error::Cast(call_result));
1723 UNREACHABLE();
1724 }
1725 return call_result.raw();
1707 } 1726 }
1708 call_args.SetAt(0, getter_result);
1709 const Array& call_args_descriptor_array =
1710 Array::Handle(ArgumentsDescriptor::New(call_args.Length(), arg_names));
1711 // Call closure.
1712 const Object& call_result = Object::Handle(
1713 DartEntry::InvokeClosure(call_args, call_args_descriptor_array));
1714 if (call_result.IsError()) {
1715 ThrowInvokeError(Error::Cast(call_result));
1716 UNREACHABLE();
1717 }
1718 return call_result.raw();
1719 } 1727 }
1720 1728
1721 const Array& args_descriptor_array = 1729 const Array& args_descriptor_array =
1722 Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names)); 1730 Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names));
1723 ArgumentsDescriptor args_descriptor(args_descriptor_array); 1731 ArgumentsDescriptor args_descriptor(args_descriptor_array);
1724 1732
1725 if (function.IsNull() || 1733 if (function.IsNull() ||
1726 !function.AreValidArguments(args_descriptor, NULL) || 1734 !function.AreValidArguments(args_descriptor, NULL) ||
1727 !function.is_visible()) { 1735 !function.is_visible()) {
1728 ThrowNoSuchMethod(Instance::null_instance(), 1736 ThrowNoSuchMethod(Instance::null_instance(),
1729 function_name, 1737 function_name,
1730 function, 1738 function,
1739 Object::null_array(),
1731 InvocationMirror::kTopLevel, 1740 InvocationMirror::kTopLevel,
1732 InvocationMirror::kMethod); 1741 InvocationMirror::kMethod);
1733 UNREACHABLE(); 1742 UNREACHABLE();
1734 } 1743 }
1735 1744
1736 const Object& result = Object::Handle( 1745 const Object& result = Object::Handle(
1737 DartEntry::InvokeFunction(function, args, args_descriptor_array)); 1746 DartEntry::InvokeFunction(function, args, args_descriptor_array));
1738 if (result.IsError()) { 1747 if (result.IsError()) {
1739 ThrowInvokeError(Error::Cast(result)); 1748 ThrowInvokeError(Error::Cast(result));
1740 UNREACHABLE(); 1749 UNREACHABLE();
(...skipping 21 matching lines...) Expand all
1762 const Library& library = Library::Handle(ref.GetLibraryReferent()); 1771 const Library& library = Library::Handle(ref.GetLibraryReferent());
1763 GET_NON_NULL_NATIVE_ARGUMENT(String, setter_name, arguments->NativeArgAt(2)); 1772 GET_NON_NULL_NATIVE_ARGUMENT(String, setter_name, arguments->NativeArgAt(2));
1764 GET_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(3)); 1773 GET_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(3));
1765 1774
1766 // To access a top-level we may need to use the Field or the 1775 // To access a top-level we may need to use the Field or the
1767 // setter Function. The setter function may either be in the 1776 // setter Function. The setter function may either be in the
1768 // library or in the field's owner class, depending. 1777 // library or in the field's owner class, depending.
1769 const Field& field = Field::Handle( 1778 const Field& field = Field::Handle(
1770 library.LookupLocalField(setter_name)); 1779 library.LookupLocalField(setter_name));
1771 Function& setter = Function::Handle(); 1780 Function& setter = Function::Handle();
1781 const String& internal_setter_name =
1782 String::Handle(Field::SetterName(setter_name));
1772 1783
1773 if (field.IsNull()) { 1784 if (field.IsNull()) {
1774 const String& internal_setter_name = 1785 setter = library.LookupLocalFunction(internal_setter_name);
1775 String::Handle(Field::SetterName(setter_name));
1776 1786
1777 setter = library.LookupLocalFunction(internal_setter_name); 1787 const int kNumArgs = 1;
1788 const Array& args = Array::Handle(Array::New(kNumArgs));
1789 args.SetAt(0, value);
1790
1778 if (setter.IsNull() || !setter.is_visible()) { 1791 if (setter.IsNull() || !setter.is_visible()) {
1779 ThrowNoSuchMethod(Instance::null_instance(), 1792 ThrowNoSuchMethod(Instance::null_instance(),
1780 setter_name, 1793 internal_setter_name,
1781 setter, 1794 setter,
1795 args,
1782 InvocationMirror::kTopLevel, 1796 InvocationMirror::kTopLevel,
1783 InvocationMirror::kSetter); 1797 InvocationMirror::kSetter);
1784 UNREACHABLE(); 1798 UNREACHABLE();
1785 } 1799 }
1786 1800
1787 // Invoke the setter and return the result. 1801 // Invoke the setter and return the result.
1788 const int kNumArgs = 1;
1789 const Array& args = Array::Handle(Array::New(kNumArgs));
1790 args.SetAt(0, value);
1791 const Object& result = Object::Handle( 1802 const Object& result = Object::Handle(
1792 DartEntry::InvokeFunction(setter, args)); 1803 DartEntry::InvokeFunction(setter, args));
1793 if (result.IsError()) { 1804 if (result.IsError()) {
1794 ThrowInvokeError(Error::Cast(result)); 1805 ThrowInvokeError(Error::Cast(result));
1795 UNREACHABLE(); 1806 UNREACHABLE();
1796 } 1807 }
1797 return result.raw(); 1808 return result.raw();
1798 } 1809 }
1799 1810
1800 if (field.is_final()) { 1811 if (field.is_final()) {
1801 ThrowNoSuchMethod(Instance::null_instance(), 1812 ThrowNoSuchMethod(Instance::null_instance(),
1802 setter_name, 1813 internal_setter_name,
1803 setter, 1814 setter,
1815 Object::null_array(),
1804 InvocationMirror::kTopLevel, 1816 InvocationMirror::kTopLevel,
1805 InvocationMirror::kSetter); 1817 InvocationMirror::kSetter);
1806 UNREACHABLE(); 1818 UNREACHABLE();
1807 } 1819 }
1808 1820
1809 field.set_value(value); 1821 field.set_value(value);
1810 return value.raw(); 1822 return value.raw();
1811 } 1823 }
1812 1824
1813 1825
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 } 1978 }
1967 1979
1968 DEFINE_NATIVE_ENTRY(TypeMirror_moreSpecificTest, 2) { 1980 DEFINE_NATIVE_ENTRY(TypeMirror_moreSpecificTest, 2) {
1969 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); 1981 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0));
1970 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); 1982 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1));
1971 return Bool::Get(a.IsMoreSpecificThan(b, NULL)).raw(); 1983 return Bool::Get(a.IsMoreSpecificThan(b, NULL)).raw();
1972 } 1984 }
1973 1985
1974 1986
1975 } // namespace dart 1987 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/errors_patch.dart ('k') | runtime/lib/mirrors_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698