Chromium Code Reviews| 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 #ifndef INCLUDE_DART_API_H_ | 5 #ifndef INCLUDE_DART_API_H_ |
| 6 #define INCLUDE_DART_API_H_ | 6 #define INCLUDE_DART_API_H_ |
| 7 | 7 |
| 8 /** \mainpage Dart Embedding API Reference | 8 /** \mainpage Dart Embedding API Reference |
| 9 * | 9 * |
| 10 * Dart is a class-based programming language for creating structured | 10 * Dart is a class-based programming language for creating structured |
| (...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1987 | 1987 |
| 1988 /** | 1988 /** |
| 1989 * Returns the interface at some index in the list of interfaces some | 1989 * Returns the interface at some index in the list of interfaces some |
| 1990 * class or inteface. | 1990 * class or inteface. |
| 1991 * | 1991 * |
| 1992 * TODO(turnidge): Finish documentation. | 1992 * TODO(turnidge): Finish documentation. |
| 1993 */ | 1993 */ |
| 1994 DART_EXPORT Dart_Handle Dart_ClassGetInterfaceAt(Dart_Handle clazz, | 1994 DART_EXPORT Dart_Handle Dart_ClassGetInterfaceAt(Dart_Handle clazz, |
| 1995 intptr_t index); | 1995 intptr_t index); |
| 1996 | 1996 |
| 1997 // --- Function and Variable Declarations --- | |
| 1998 | |
| 1999 /** | |
| 2000 * Returns a list of the names of all functions or methods declared in | |
| 2001 * a library or class. | |
| 2002 * | |
| 2003 * \param target A library or class. | |
| 2004 * | |
| 2005 * \return If no error occurs, a list of strings is returned. | |
|
cshapiro
2012/06/28 23:57:47
I am confused about the conditions under which err
turnidge
2012/07/09 23:45:17
This comment would apply to all dart api functions
| |
| 2006 * Otherwise an erorr handle is returned. | |
| 2007 */ | |
| 2008 DART_EXPORT Dart_Handle Dart_GetFunctionNames(Dart_Handle target); | |
| 2009 | |
| 2010 /** | |
| 2011 * Looks up a function or method declaration by name from a library or | |
| 2012 * class. | |
| 2013 * | |
| 2014 * \param target The library or class containing the function. | |
| 2015 * \param function_name The name of the function. | |
| 2016 * | |
| 2017 * \return If an error is encountered, returns an error handle. | |
| 2018 * Otherwise returns a function handle if the function is found of | |
|
cshapiro
2012/06/28 23:57:47
This does not read right specifically, "is found o
turnidge
2012/07/09 23:45:17
Done.
| |
| 2019 * Dart_Null() if the function is not found. | |
| 2020 */ | |
| 2021 DART_EXPORT Dart_Handle Dart_LookupFunction(Dart_Handle target, | |
| 2022 Dart_Handle function_name); | |
| 2023 | |
| 2024 /** | |
| 2025 * Is this a function or method declaration handle? | |
| 2026 */ | |
| 2027 DART_EXPORT bool Dart_IsFunction(Dart_Handle handle); | |
| 2028 | |
| 2029 /** | |
| 2030 * Returns the name for the provided function or method. | |
|
cshapiro
2012/06/28 23:57:47
Is there no possible error return? Maybe provide
turnidge
2012/07/09 23:45:17
Done.
| |
| 2031 */ | |
| 2032 DART_EXPORT Dart_Handle Dart_FunctionName(Dart_Handle function); | |
| 2033 | |
| 2034 /** | |
| 2035 * Determines whether a function or method is declared abstract. | |
|
cshapiro
2012/06/28 23:57:47
Since there cannot be an abstract function, perhap
turnidge
2012/07/09 23:45:17
Done.
| |
| 2036 * | |
| 2037 * \param function A handle to a function or method declaration. | |
| 2038 * \param is_static Returns whether the function or method is declared abstract. | |
|
cshapiro
2012/06/28 23:57:47
Same here, "returns true if 'function' is an abstr
turnidge
2012/07/09 23:45:17
Done.
| |
| 2039 * | |
| 2040 * \return A valid handle if no error occurs during the operation. | |
| 2041 */ | |
| 2042 DART_EXPORT Dart_Handle Dart_FunctionIsAbstract(Dart_Handle function, | |
| 2043 bool* is_abstract); | |
| 2044 | |
| 2045 /** | |
| 2046 * Determines whether a function or method is declared static. | |
|
cshapiro
2012/06/28 23:57:47
Declaring static seems confusing. I understand th
turnidge
2012/07/09 23:45:17
Done.
| |
| 2047 * | |
| 2048 * For the purposes of the embedding API, a top-level function is | |
| 2049 * implicitly declared static. | |
| 2050 * | |
| 2051 * \param function A handle to a function or method declaration. | |
| 2052 * \param is_static Returns whether the function or method is declared static. | |
| 2053 * | |
| 2054 * \return A valid handle if no error occurs during the operation. | |
| 2055 */ | |
| 2056 DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function, | |
| 2057 bool* is_static); | |
| 2058 | |
| 2059 /** | |
| 2060 * Determines whether a function or method is a constructor. | |
|
cshapiro
2012/06/28 23:57:47
Functions cannot be constructors. What about fact
turnidge
2012/07/09 23:45:17
Done.
| |
| 2061 * | |
| 2062 * \param function A handle to a function or method declaration. | |
| 2063 * \param is_static Returns whether the function or method is a constructor. | |
| 2064 * | |
| 2065 * \return A valid handle if no error occurs during the operation. | |
| 2066 */ | |
| 2067 DART_EXPORT Dart_Handle Dart_FunctionIsConstructor(Dart_Handle function, | |
| 2068 bool* is_constructor); | |
| 2069 | |
| 2070 /** | |
| 2071 * Determines whether a function or method is a getter. | |
| 2072 * | |
| 2073 * \param function A handle to a function or method declaration. | |
| 2074 * \param is_static Returns whether the function or method is a getter. | |
| 2075 * | |
| 2076 * \return A valid handle if no error occurs during the operation. | |
| 2077 */ | |
| 2078 DART_EXPORT Dart_Handle Dart_FunctionIsGetter(Dart_Handle function, | |
| 2079 bool* is_getter); | |
| 2080 | |
| 2081 /** | |
| 2082 * Determines whether a function or method is a setter. | |
| 2083 * | |
| 2084 * \param function A handle to a function or method declaration. | |
| 2085 * \param is_static Returns whether the function or method is a setter. | |
| 2086 * | |
| 2087 * \return A valid handle if no error occurs during the operation. | |
| 2088 */ | |
| 2089 DART_EXPORT Dart_Handle Dart_FunctionIsSetter(Dart_Handle function, | |
| 2090 bool* is_setter); | |
| 2091 | |
| 2092 /** | |
| 2093 * Returns a list of the names of all variables declared in a library | |
| 2094 * or class. | |
| 2095 * | |
| 2096 * \param target A library or class. | |
| 2097 * | |
| 2098 * \return If no error occurs, a list of strings is returned. | |
| 2099 * Otherwise an erorr handle is returned. | |
| 2100 */ | |
| 2101 DART_EXPORT Dart_Handle Dart_GetVariableNames(Dart_Handle target); | |
|
cshapiro
2012/06/28 23:57:47
Why not call this "Field" instead of "Variable"?
turnidge
2012/07/09 23:45:17
The spec calls them variables instead of fields, s
| |
| 2102 | |
| 2103 /** | |
| 2104 * Looks up a variable declaration by name from a library or class. | |
| 2105 * | |
| 2106 * \param library The library or class containing the function. | |
| 2107 * \param function_name The name of the function. | |
| 2108 * | |
| 2109 * \return If an error is encountered, returns an error handle. | |
| 2110 * Otherwise returns a function handle if the function is found of | |
| 2111 * Dart_Null() if the function is not found. | |
| 2112 */ | |
| 2113 DART_EXPORT Dart_Handle Dart_LookupVariable(Dart_Handle target, | |
|
cshapiro
2012/06/28 23:57:47
Likewise.
| |
| 2114 Dart_Handle variable_name); | |
| 2115 | |
| 2116 /** | |
| 2117 * Is this a variable declaration handle? | |
|
cshapiro
2012/06/28 23:57:47
What is a variable in this context? Is this a loc
turnidge
2012/07/09 23:45:17
For now, a variable is a top-level variable or a "
| |
| 2118 */ | |
| 2119 DART_EXPORT bool Dart_IsVariable(Dart_Handle handle); | |
| 2120 | |
| 2121 /** | |
| 2122 * Returns the name for the provided variable. | |
|
cshapiro
2012/06/28 23:57:47
Ditto.
| |
| 2123 */ | |
| 2124 DART_EXPORT Dart_Handle Dart_VariableName(Dart_Handle variable); | |
| 2125 | |
| 2126 /** | |
| 2127 * Determines whether a variable is declared static. | |
|
cshapiro
2012/06/28 23:57:47
What kind of variable? Local variable?
| |
| 2128 * | |
| 2129 * For the purposes of the embedding API, a top-level variable is | |
| 2130 * implicitly declared static. | |
| 2131 * | |
| 2132 * \param variable A handle to a variable declaration. | |
| 2133 * \param is_static Returns whether the variable is declared static. | |
| 2134 * | |
| 2135 * \return A valid handle if no error occurs during the operation. | |
| 2136 */ | |
| 2137 DART_EXPORT Dart_Handle Dart_VariableIsStatic(Dart_Handle variable, | |
| 2138 bool* is_static); | |
| 2139 | |
| 2140 /** | |
| 2141 * Determines whether a variable is declared final. | |
|
cshapiro
2012/06/28 23:57:47
Ditto.
| |
| 2142 * | |
| 2143 * \param variable A handle to a variable declaration. | |
| 2144 * \param is_static Returns whether the variable is declared final. | |
|
cshapiro
2012/06/28 23:57:47
You have the wrong name for the \param, it should
turnidge
2012/07/09 23:45:17
Done.
| |
| 2145 * | |
| 2146 * \return A valid handle if no error occurs during the operation. | |
| 2147 */ | |
| 2148 DART_EXPORT Dart_Handle Dart_VariableIsFinal(Dart_Handle variable, | |
| 2149 bool* is_final); | |
| 2150 | |
| 1997 // --- Constructors, Methods, and Fields --- | 2151 // --- Constructors, Methods, and Fields --- |
| 1998 | 2152 |
| 1999 /** | 2153 /** |
| 2000 * Invokes a constructor, creating a new object. | 2154 * Invokes a constructor, creating a new object. |
| 2001 * | 2155 * |
| 2002 * This function allows hidden constructors (constructors with leading | 2156 * This function allows hidden constructors (constructors with leading |
| 2003 * underscores) to be called. | 2157 * underscores) to be called. |
| 2004 * | 2158 * |
| 2005 * \param clazz A class or an interface. | 2159 * \param clazz A class or an interface. |
| 2006 * \param constructor_name The name of the constructor to invoke. Use | 2160 * \param constructor_name The name of the constructor to invoke. Use |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2371 // information that can be used for better profile reports for | 2525 // information that can be used for better profile reports for |
| 2372 // dynamically generated code. | 2526 // dynamically generated code. |
| 2373 DART_EXPORT void Dart_InitPprofSupport(); | 2527 DART_EXPORT void Dart_InitPprofSupport(); |
| 2374 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); | 2528 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); |
| 2375 | 2529 |
| 2376 // Support for generating flow graph compiler debugging output into a file. | 2530 // Support for generating flow graph compiler debugging output into a file. |
| 2377 typedef void (*FileWriterFunction)(const char* buffer, int64_t num_bytes); | 2531 typedef void (*FileWriterFunction)(const char* buffer, int64_t num_bytes); |
| 2378 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function); | 2532 DART_EXPORT void Dart_InitFlowGraphPrinting(FileWriterFunction function); |
| 2379 | 2533 |
| 2380 #endif // INCLUDE_DART_API_H_ | 2534 #endif // INCLUDE_DART_API_H_ |
| OLD | NEW |