From 9ac1a00e942f037bd26f7150c7649bd02f29254a Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Wed, 29 Jun 2022 15:51:46 +0200 Subject: [PATCH] Remove some unused codes & adjust the license headers --- library/Icinga/Less/Call.php | 3 +++ library/Icinga/Less/ColorProp.php | 2 +- library/Icinga/Less/ColorPropOrVariable.php | 2 +- library/Icinga/Less/DeferredColorProp.php | 4 +++- library/Icinga/Less/LightMode.php | 2 +- library/Icinga/Less/LightModeCall.php | 2 +- library/Icinga/Less/LightModeDefinition.php | 2 +- library/Icinga/Less/LightModeTrait.php | 2 +- library/Icinga/Less/LightModeVisitor.php | 2 +- library/Icinga/Less/Visitor.php | 20 ++++---------------- 10 files changed, 17 insertions(+), 24 deletions(-) diff --git a/library/Icinga/Less/Call.php b/library/Icinga/Less/Call.php index 0e6074dbe..449ede622 100644 --- a/library/Icinga/Less/Call.php +++ b/library/Icinga/Less/Call.php @@ -1,5 +1,7 @@ value[0] = $vr; + break; } } diff --git a/library/Icinga/Less/ColorProp.php b/library/Icinga/Less/ColorProp.php index b6fe6d2e2..3f83c5eee 100644 --- a/library/Icinga/Less/ColorProp.php +++ b/library/Icinga/Less/ColorProp.php @@ -1,5 +1,5 @@ evaluating) { + if ($this->evaluating) { // Just like the parent method throw new Less_Exception_Compiler( "Recursive variable definition for " . $this->name, null, diff --git a/library/Icinga/Less/LightMode.php b/library/Icinga/Less/LightMode.php index f12cc03bf..b4b72a074 100644 --- a/library/Icinga/Less/LightMode.php +++ b/library/Icinga/Less/LightMode.php @@ -1,5 +1,5 @@ name === 'var') { - if ($this->callingVar !== false) { - throw new LogicException('Already calling var'); - } - - $this->callingVar = spl_object_hash($c); - } else { + if ($c->name !== 'var') { // We need to use our own tree call class , so that we can precompile the arguments before making // the actual LESS function calls. Otherwise, it will produce lots of invalid argument exceptions! $c = Call::fromCall($c); @@ -80,13 +74,6 @@ CSS; return $c; } - public function visitCallOut($c) - { - if ($this->callingVar !== false && $this->callingVar === spl_object_hash($c)) { - $this->callingVar = false; - } - } - public function visitDetachedRuleset($drs) { if ($this->variableOrigin->name === '@' . static::LIGHT_MODE_NAME) { @@ -194,7 +181,7 @@ CSS; public function visitVariable($v) { - if ($this->callingVar !== false || $this->definingVariable !== false) { + if ($this->definingVariable !== false) { return $v; } @@ -205,6 +192,7 @@ CSS; public function visitColor($c) { if ($this->definingVariable !== false) { + // Make sure that all less tree colors do have a proper name $c->name = $this->variableOrigin->name; }