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

Side by Side Diff: runtime/include/dart_api.h

Issue 17390008: Fix for issue 11262. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 * for details. All rights reserved. Use of this source code is governed by a 3 * for details. All rights reserved. Use of this source code is governed by a
4 * BSD-style license that can be found in the LICENSE file. 4 * BSD-style license that can be found in the LICENSE file.
5 */ 5 */
6 6
7 #ifndef INCLUDE_DART_API_H_ 7 #ifndef INCLUDE_DART_API_H_
8 #define INCLUDE_DART_API_H_ 8 #define INCLUDE_DART_API_H_
9 9
10 /** \mainpage Dart Embedding API Reference 10 /** \mainpage Dart Embedding API Reference
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 DART_EXPORT bool Dart_IsInstance(Dart_Handle object); 1135 DART_EXPORT bool Dart_IsInstance(Dart_Handle object);
1136 DART_EXPORT bool Dart_IsNumber(Dart_Handle object); 1136 DART_EXPORT bool Dart_IsNumber(Dart_Handle object);
1137 DART_EXPORT bool Dart_IsInteger(Dart_Handle object); 1137 DART_EXPORT bool Dart_IsInteger(Dart_Handle object);
1138 DART_EXPORT bool Dart_IsDouble(Dart_Handle object); 1138 DART_EXPORT bool Dart_IsDouble(Dart_Handle object);
1139 DART_EXPORT bool Dart_IsBoolean(Dart_Handle object); 1139 DART_EXPORT bool Dart_IsBoolean(Dart_Handle object);
1140 DART_EXPORT bool Dart_IsString(Dart_Handle object); 1140 DART_EXPORT bool Dart_IsString(Dart_Handle object);
1141 DART_EXPORT bool Dart_IsStringLatin1(Dart_Handle object); /* (ISO-8859-1) */ 1141 DART_EXPORT bool Dart_IsStringLatin1(Dart_Handle object); /* (ISO-8859-1) */
1142 DART_EXPORT bool Dart_IsExternalString(Dart_Handle object); 1142 DART_EXPORT bool Dart_IsExternalString(Dart_Handle object);
1143 DART_EXPORT bool Dart_IsList(Dart_Handle object); 1143 DART_EXPORT bool Dart_IsList(Dart_Handle object);
1144 DART_EXPORT bool Dart_IsLibrary(Dart_Handle object); 1144 DART_EXPORT bool Dart_IsLibrary(Dart_Handle object);
1145 DART_EXPORT bool Dart_IsType(Dart_Handle handle);
1145 DART_EXPORT bool Dart_IsClass(Dart_Handle handle); 1146 DART_EXPORT bool Dart_IsClass(Dart_Handle handle);
1146 DART_EXPORT bool Dart_IsAbstractClass(Dart_Handle handle);
1147 DART_EXPORT bool Dart_IsFunction(Dart_Handle handle); 1147 DART_EXPORT bool Dart_IsFunction(Dart_Handle handle);
1148 DART_EXPORT bool Dart_IsVariable(Dart_Handle handle); 1148 DART_EXPORT bool Dart_IsVariable(Dart_Handle handle);
1149 DART_EXPORT bool Dart_IsTypeVariable(Dart_Handle handle); 1149 DART_EXPORT bool Dart_IsTypeVariable(Dart_Handle handle);
1150 DART_EXPORT bool Dart_IsClosure(Dart_Handle object); 1150 DART_EXPORT bool Dart_IsClosure(Dart_Handle object);
1151 1151
1152 1152
1153 /* 1153 /*
1154 * ========= 1154 * =========
1155 * Instances 1155 * Instances
1156 * ========= 1156 * =========
1157 */ 1157 */
1158 1158
1159 /* 1159 /*
1160 * For the purposes of the embedding api, not all objects returned are 1160 * For the purposes of the embedding api, not all objects returned are
1161 * Dart language objects. Within the api, we use the term 'Instance' 1161 * Dart language objects. Within the api, we use the term 'Instance'
1162 * to indicate handles which refer to true Dart language objects. 1162 * to indicate handles which refer to true Dart language objects.
1163 * 1163 *
1164 * TODO(turnidge): Reorganize the "Object" section above, pulling down 1164 * TODO(turnidge): Reorganize the "Object" section above, pulling down
1165 * any functions that more properly belong here. */ 1165 * any functions that more properly belong here. */
1166 1166
1167 /** 1167 /**
1168 * Gets the type of a Dart language object.
1169 *
1170 * \param instance Some Dart object.
1171 *
1172 * \return If no error occurs, the type is returned. Otherwise an
1173 * error handle is returned.
1174 */
1175 DART_EXPORT Dart_Handle Dart_InstanceGetType(Dart_Handle instance);
1176
1177 /**
1178 * TODO(asiva): Deprecate this method once all use cases have switched
1179 * to using Dart_InstanceGetType
1168 * Gets the class for some Dart language object. 1180 * Gets the class for some Dart language object.
1169 * 1181 *
1170 * \param instance Some Dart object. 1182 * \param instance Some Dart object.
1171 * 1183 *
1172 * \return If no error occurs, the class is returned. Otherwise an 1184 * \return If no error occurs, the class is returned. Otherwise an
1173 * error handle is returned. 1185 * error handle is returned.
1174 */ 1186 */
1175 DART_EXPORT Dart_Handle Dart_InstanceGetClass(Dart_Handle instance); 1187 DART_EXPORT Dart_Handle Dart_InstanceGetClass(Dart_Handle instance);
1176 1188
1177 1189
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 * Invoking Constructors, Methods, Closures and Field accessors 1741 * Invoking Constructors, Methods, Closures and Field accessors
1730 * ============================================================ 1742 * ============================================================
1731 */ 1743 */
1732 1744
1733 /** 1745 /**
1734 * Invokes a constructor, creating a new object. 1746 * Invokes a constructor, creating a new object.
1735 * 1747 *
1736 * This function allows hidden constructors (constructors with leading 1748 * This function allows hidden constructors (constructors with leading
1737 * underscores) to be called. 1749 * underscores) to be called.
1738 * 1750 *
1739 * \param clazz A class or an interface. 1751 * \param type Type of object to be constructed.
1740 * \param constructor_name The name of the constructor to invoke. Use 1752 * \param constructor_name The name of the constructor to invoke. Use
1741 * Dart_Null() to invoke the unnamed constructor. This name should 1753 * Dart_Null() to invoke the unnamed constructor. This name should
1742 * not include the name of the class. 1754 * not include the name of the class.
1743 * \param number_of_arguments Size of the arguments array. 1755 * \param number_of_arguments Size of the arguments array.
1744 * \param arguments An array of arguments to the constructor. 1756 * \param arguments An array of arguments to the constructor.
1745 * 1757 *
1746 * \return If the constructor is called and completes successfully, 1758 * \return If the constructor is called and completes successfully,
1747 * then the new object. If an error occurs during execution, then an 1759 * then the new object. If an error occurs during execution, then an
1748 * error handle is returned. 1760 * error handle is returned.
1749 */ 1761 */
1750 DART_EXPORT Dart_Handle Dart_New(Dart_Handle clazz, 1762 DART_EXPORT Dart_Handle Dart_New(Dart_Handle type,
1751 Dart_Handle constructor_name, 1763 Dart_Handle constructor_name,
1752 int number_of_arguments, 1764 int number_of_arguments,
1753 Dart_Handle* arguments); 1765 Dart_Handle* arguments);
1754 1766
1755 /** 1767 /**
1756 * Invokes a method or function. 1768 * Invokes a method or function.
1757 * 1769 *
1758 * The 'target' parameter may be an object, class, or library. If 1770 * The 'target' parameter may be an object, type, or library. If
1759 * 'target' is an object, then this function will invoke an instance 1771 * 'target' is an object, then this function will invoke an instance
1760 * method. If 'target' is a class, then this function will invoke a 1772 * method. If 'target' is a type, then this function will invoke a
1761 * static method. If 'target' is a library, then this function will 1773 * static method. If 'target' is a library, then this function will
1762 * invoke a top-level function from that library. 1774 * invoke a top-level function from that library.
1763 * 1775 *
1764 * This function ignores visibility (leading underscores in names). 1776 * This function ignores visibility (leading underscores in names).
1765 * 1777 *
1766 * May generate an unhandled exception error. 1778 * May generate an unhandled exception error.
1767 * 1779 *
1768 * \param target An object, class, or library. 1780 * \param target An object, type, or library.
1769 * \param name The name of the function or method to invoke. 1781 * \param name The name of the function or method to invoke.
1770 * \param number_of_arguments Size of the arguments array. 1782 * \param number_of_arguments Size of the arguments array.
1771 * \param arguments An array of arguments to the function. 1783 * \param arguments An array of arguments to the function.
1772 * 1784 *
1773 * \return If the function or method is called and completes 1785 * \return If the function or method is called and completes
1774 * successfully, then the return value is returned. If an error 1786 * successfully, then the return value is returned. If an error
1775 * occurs during execution, then an error handle is returned. 1787 * occurs during execution, then an error handle is returned.
1776 */ 1788 */
1777 DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, 1789 DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target,
1778 Dart_Handle name, 1790 Dart_Handle name,
(...skipping 10 matching lines...) Expand all
1789 * invoking the closure is returned. If an error occurs during 1801 * invoking the closure is returned. If an error occurs during
1790 * execution, then an error handle is returned. 1802 * execution, then an error handle is returned.
1791 */ 1803 */
1792 DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure, 1804 DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure,
1793 int number_of_arguments, 1805 int number_of_arguments,
1794 Dart_Handle* arguments); 1806 Dart_Handle* arguments);
1795 1807
1796 /** 1808 /**
1797 * Gets the value of a field. 1809 * Gets the value of a field.
1798 * 1810 *
1799 * The 'container' parameter may be an object, class, or library. If 1811 * The 'container' parameter may be an object, type, or library. If
1800 * 'container' is an object, then this function will access an 1812 * 'container' is an object, then this function will access an
1801 * instance field. If 'container' is a class, then this function will 1813 * instance field. If 'container' is a type, then this function will
vsm 2013/06/18 22:45:51 This seems ambiguous now as a type is also an obje
siva 2013/06/18 23:09:54 Yes if it is a type then it would be a static call
vsm 2013/06/18 23:18:17 Ultimately, I think the API itself is ambiguous as
siva 2013/06/18 23:42:34 I think I will add a comment in the API that acces
1802 * access a static field. If 'container' is a library, then this 1814 * access a static field. If 'container' is a library, then this
1803 * function will access a top-level variable. 1815 * function will access a top-level variable.
1804 * 1816 *
1805 * This function ignores field visibility (leading underscores in names). 1817 * This function ignores field visibility (leading underscores in names).
1806 * 1818 *
1807 * May generate an unhandled exception error. 1819 * May generate an unhandled exception error.
1808 * 1820 *
1809 * \param container An object, class, or library. 1821 * \param container An object, type, or library.
1810 * \param name A field name. 1822 * \param name A field name.
1811 * 1823 *
1812 * \return If no error occurs, then the value of the field is 1824 * \return If no error occurs, then the value of the field is
1813 * returned. Otherwise an error handle is returned. 1825 * returned. Otherwise an error handle is returned.
1814 */ 1826 */
1815 DART_EXPORT Dart_Handle Dart_GetField(Dart_Handle container, 1827 DART_EXPORT Dart_Handle Dart_GetField(Dart_Handle container,
1816 Dart_Handle name); 1828 Dart_Handle name);
1817 1829
1818 /** 1830 /**
1819 * Sets the value of a field. 1831 * Sets the value of a field.
1820 * 1832 *
1821 * The 'container' parameter may actually be an object, class, or 1833 * The 'container' parameter may actually be an object, type, or
1822 * library. If 'container' is an object, then this function will 1834 * library. If 'container' is an object, then this function will
1823 * access an instance field. If 'container' is a class, then this 1835 * access an instance field. If 'container' is a type, then this
1824 * function will access a static field. If 'container' is a library, 1836 * function will access a static field. If 'container' is a library,
1825 * then this function will access a top-level variable. 1837 * then this function will access a top-level variable.
1826 * 1838 *
1827 * This function ignores field visibility (leading underscores in names). 1839 * This function ignores field visibility (leading underscores in names).
1828 * 1840 *
1829 * May generate an unhandled exception error. 1841 * May generate an unhandled exception error.
1830 * 1842 *
1831 * \param container An object, class, or library. 1843 * \param container An object, type, or library.
1832 * \param name A field name. 1844 * \param name A field name.
1833 * \param value The new field value. 1845 * \param value The new field value.
1834 * 1846 *
1835 * \return A valid handle if no error occurs. 1847 * \return A valid handle if no error occurs.
1836 */ 1848 */
1837 DART_EXPORT Dart_Handle Dart_SetField(Dart_Handle container, 1849 DART_EXPORT Dart_Handle Dart_SetField(Dart_Handle container,
1838 Dart_Handle name, 1850 Dart_Handle name,
1839 Dart_Handle value); 1851 Dart_Handle value);
1840 1852
1841 1853
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 * Lookup a class or interface by name from a Library. 2091 * Lookup a class or interface by name from a Library.
2080 * 2092 *
2081 * \param library The library containing the class or interface. 2093 * \param library The library containing the class or interface.
2082 * \param class_name The name of the class or interface. 2094 * \param class_name The name of the class or interface.
2083 * 2095 *
2084 * \return If no error occurs, the class or interface is 2096 * \return If no error occurs, the class or interface is
2085 * returned. Otherwise an error handle is returned. 2097 * returned. Otherwise an error handle is returned.
2086 */ 2098 */
2087 DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, 2099 DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library,
2088 Dart_Handle class_name); 2100 Dart_Handle class_name);
2089 /* TODO(turnidge): Consider returning Dart_Null() when the class is 2101 /* TODO(asiva): The above method needs to be removed once all uses
2090 * not found to distinguish that from a true error case. */ 2102 * of it are removed from the embedder code. */
2091 2103
2092 /** 2104 /**
2093 * Returns the url from which a library was loaded. 2105 * Returns the url from which a library was loaded.
2094 */ 2106 */
2095 DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library); 2107 DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library);
2096 2108
2097 DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url); 2109 DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url);
2098 /* TODO(turnidge): Consider returning Dart_Null() when the library is 2110 /* TODO(turnidge): Consider returning Dart_Null() when the library is
2099 * not found to distinguish that from a true error case. */ 2111 * not found to distinguish that from a true error case. */
2100 2112
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 * 2186 *
2175 * \param object An object. 2187 * \param object An object.
2176 * \param peer A value to store in the peer field. 2188 * \param peer A value to store in the peer field.
2177 * 2189 *
2178 * \return Returns an error if 'object' is a subtype of Null, num, or 2190 * \return Returns an error if 'object' is a subtype of Null, num, or
2179 * bool. 2191 * bool.
2180 */ 2192 */
2181 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer); 2193 DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer);
2182 2194
2183 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ 2195 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698