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

Unified Diff: runtime/include/dart_api.h

Issue 10687004: Implement method and variable reflection in dart:mirrors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: runtime/include/dart_api.h
===================================================================
--- runtime/include/dart_api.h (revision 9071)
+++ runtime/include/dart_api.h (working copy)
@@ -1994,6 +1994,160 @@
DART_EXPORT Dart_Handle Dart_ClassGetInterfaceAt(Dart_Handle clazz,
intptr_t index);
+// --- Function and Variable Declarations ---
+
+/**
+ * Returns a list of the names of all functions or methods declared in
+ * a library or class.
+ *
+ * \param target A library or class.
+ *
+ * \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
+ * Otherwise an erorr handle is returned.
+ */
+DART_EXPORT Dart_Handle Dart_GetFunctionNames(Dart_Handle target);
+
+/**
+ * Looks up a function or method declaration by name from a library or
+ * class.
+ *
+ * \param target The library or class containing the function.
+ * \param function_name The name of the function.
+ *
+ * \return If an error is encountered, returns an error handle.
+ * 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.
+ * Dart_Null() if the function is not found.
+ */
+DART_EXPORT Dart_Handle Dart_LookupFunction(Dart_Handle target,
+ Dart_Handle function_name);
+
+/**
+ * Is this a function or method declaration handle?
+ */
+DART_EXPORT bool Dart_IsFunction(Dart_Handle handle);
+
+/**
+ * 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.
+ */
+DART_EXPORT Dart_Handle Dart_FunctionName(Dart_Handle function);
+
+/**
+ * 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.
+ *
+ * \param function A handle to a function or method declaration.
+ * \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.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_FunctionIsAbstract(Dart_Handle function,
+ bool* is_abstract);
+
+/**
+ * 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.
+ *
+ * For the purposes of the embedding API, a top-level function is
+ * implicitly declared static.
+ *
+ * \param function A handle to a function or method declaration.
+ * \param is_static Returns whether the function or method is declared static.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function,
+ bool* is_static);
+
+/**
+ * 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.
+ *
+ * \param function A handle to a function or method declaration.
+ * \param is_static Returns whether the function or method is a constructor.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_FunctionIsConstructor(Dart_Handle function,
+ bool* is_constructor);
+
+/**
+ * Determines whether a function or method is a getter.
+ *
+ * \param function A handle to a function or method declaration.
+ * \param is_static Returns whether the function or method is a getter.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_FunctionIsGetter(Dart_Handle function,
+ bool* is_getter);
+
+/**
+ * Determines whether a function or method is a setter.
+ *
+ * \param function A handle to a function or method declaration.
+ * \param is_static Returns whether the function or method is a setter.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_FunctionIsSetter(Dart_Handle function,
+ bool* is_setter);
+
+/**
+ * Returns a list of the names of all variables declared in a library
+ * or class.
+ *
+ * \param target A library or class.
+ *
+ * \return If no error occurs, a list of strings is returned.
+ * Otherwise an erorr handle is returned.
+ */
+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
+
+/**
+ * Looks up a variable declaration by name from a library or class.
+ *
+ * \param library The library or class containing the function.
+ * \param function_name The name of the function.
+ *
+ * \return If an error is encountered, returns an error handle.
+ * Otherwise returns a function handle if the function is found of
+ * Dart_Null() if the function is not found.
+ */
+DART_EXPORT Dart_Handle Dart_LookupVariable(Dart_Handle target,
cshapiro 2012/06/28 23:57:47 Likewise.
+ Dart_Handle variable_name);
+
+/**
+ * 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 "
+ */
+DART_EXPORT bool Dart_IsVariable(Dart_Handle handle);
+
+/**
+ * Returns the name for the provided variable.
cshapiro 2012/06/28 23:57:47 Ditto.
+ */
+DART_EXPORT Dart_Handle Dart_VariableName(Dart_Handle variable);
+
+/**
+ * Determines whether a variable is declared static.
cshapiro 2012/06/28 23:57:47 What kind of variable? Local variable?
+ *
+ * For the purposes of the embedding API, a top-level variable is
+ * implicitly declared static.
+ *
+ * \param variable A handle to a variable declaration.
+ * \param is_static Returns whether the variable is declared static.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_VariableIsStatic(Dart_Handle variable,
+ bool* is_static);
+
+/**
+ * Determines whether a variable is declared final.
cshapiro 2012/06/28 23:57:47 Ditto.
+ *
+ * \param variable A handle to a variable declaration.
+ * \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.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_VariableIsFinal(Dart_Handle variable,
+ bool* is_final);
+
// --- Constructors, Methods, and Fields ---
/**

Powered by Google App Engine
This is Rietveld 408576698