summaryrefslogtreecommitdiffstats
path: root/gcc/go/gofrontend/expressions.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/go/gofrontend/expressions.h')
-rw-r--r--gcc/go/gofrontend/expressions.h39
1 files changed, 26 insertions, 13 deletions
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h
index abebbd16961..83bc7241480 100644
--- a/gcc/go/gofrontend/expressions.h
+++ b/gcc/go/gofrontend/expressions.h
@@ -103,6 +103,7 @@ class Expression
EXPRESSION_TYPE_DESCRIPTOR,
EXPRESSION_TYPE_INFO,
EXPRESSION_SLICE_INFO,
+ EXPRESSION_INTERFACE_INFO,
EXPRESSION_STRUCT_FIELD_OFFSET,
EXPRESSION_MAP_DESCRIPTOR,
EXPRESSION_LABEL_ADDR
@@ -356,6 +357,21 @@ class Expression
static Expression*
make_slice_info(Expression* slice, Slice_info, Location);
+
+ // Make an expression that evaluates to some characteristic of a
+ // interface. For simplicity, the enum values must match the field indexes
+ // of a non-empty interface in the underlying struct.
+ enum Interface_info
+ {
+ // The methods of an interface.
+ INTERFACE_INFO_METHODS,
+ // The first argument to pass to an interface method.
+ INTERFACE_INFO_OBJECT
+ };
+
+ static Expression*
+ make_interface_info(Expression* iface, Interface_info, Location);
+
// Make an expression which evaluates to the offset of a field in a
// struct. This is only used for type descriptors, so there is no
// location parameter.
@@ -1508,10 +1524,9 @@ class Call_expression : public Expression
bool
check_argument_type(int, const Type*, const Type*, Location, bool);
- tree
- interface_method_function(Translate_context*,
- Interface_field_reference_expression*,
- tree*);
+ Expression*
+ interface_method_function(Interface_field_reference_expression*,
+ Expression**);
tree
set_results(Translate_context*, tree);
@@ -2115,16 +2130,14 @@ class Interface_field_reference_expression : public Expression
static Named_object*
create_thunk(Gogo*, Interface_type* type, const std::string& name);
- // Return a tree for the pointer to the function to call, given a
- // tree for the expression.
- tree
- get_function_tree(Translate_context*, tree);
+ // Return an expression for the pointer to the function to call.
+ Expression*
+ get_function();
- // Return a tree for the first argument to pass to the interface
- // function, given a tree for the expression. This is the real
- // object associated with the interface object.
- tree
- get_underlying_object_tree(Translate_context*, tree);
+ // Return an expression for the first argument to pass to the interface
+ // function. This is the real object associated with the interface object.
+ Expression*
+ get_underlying_object();
protected:
int
OpenPOWER on IntegriCloud