From 517b0353bc96971ee7ceda2287a79afeb8230c47 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 2 Dec 2021 15:37:56 +0100 Subject: [PATCH] Support variable variables --- library/Icinga/Less/ColorPropOrVariable.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/library/Icinga/Less/ColorPropOrVariable.php b/library/Icinga/Less/ColorPropOrVariable.php index 2eb21a24b..f401b2ab2 100644 --- a/library/Icinga/Less/ColorPropOrVariable.php +++ b/library/Icinga/Less/ColorPropOrVariable.php @@ -36,6 +36,14 @@ class ColorPropOrVariable extends Less_Tree public function compile($env) { $v = $this->getVariable(); + + if ($v->name[1] === '@') { + // Evaluate variable variable as in Less_Tree_Variable:28 + $vv = new Less_Tree_Variable(substr($v->name, 1), $v->index + 1, $v->currentFileInfo); + // Overwrite the name so that the variable variable is not evaluated again + $v->name = '@' . $vv->compile($env)->value; + } + $compiled = $v->compile($env); if ($compiled instanceof ColorProp) {