[gtk+/wip/otte/shader: 21/69] 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: 21/69] gskslexpression: References to const variables are const
- Date: Wed, 4 Oct 2017 00:38:58 +0000 (UTC)
commit 443084f20521004ac70677a44fb4c46c02823a4b
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 1da5b85..4fa07a5 100644
--- a/gsk/gskslexpression.c
+++ b/gsk/gskslexpression.c
@@ -663,8 +663,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]