[gtk+/wip/otte/shader: 97/200] gskslexpression: References to const variables are const
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/shader: 97/200] gskslexpression: References to const variables are const
- Date: Mon, 16 Oct 2017 23:08:06 +0000 (UTC)
commit 57cb09a6325919eb44284c40ccc92389bcb71ec5
Author: Benjamin Otte <otte redhat com>
Date: Tue Sep 26 18:27:01 2017 +0200
gskslexpression: References to const variables are const
So we return a const value if that happens.
gsk/gskslexpression.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gskslexpression.c b/gsk/gskslexpression.c
index 497de04..18a89cb 100644
--- a/gsk/gskslexpression.c
+++ b/gsk/gskslexpression.c
@@ -662,8 +662,17 @@ gsk_sl_expression_reference_get_return_type (const GskSlExpression *expression)
static GskSlValue *
gsk_sl_expression_reference_get_constant (const GskSlExpression *expression)
{
- /* FIXME: values for constant variables need to be returned here */
- return NULL;
+ GskSlExpressionReference *reference = (GskSlExpressionReference *) expression;
+ const GskSlValue *initial_value;
+
+ if (!gsk_sl_variable_is_constant (reference->variable))
+ return NULL;
+
+ initial_value = gsk_sl_variable_get_initial_value (reference->variable);
+ if (initial_value == NULL)
+ return NULL;
+
+ return gsk_sl_value_copy (initial_value);
}
static guint32
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]