aboutsummaryrefslogtreecommitdiffstats
path: root/theme-compiler/src/com/vaadin/sass/tree/controldirective
diff options
context:
space:
mode:
Diffstat (limited to 'theme-compiler/src/com/vaadin/sass/tree/controldirective')
-rw-r--r--theme-compiler/src/com/vaadin/sass/tree/controldirective/EachDefNode.java8
-rw-r--r--theme-compiler/src/com/vaadin/sass/tree/controldirective/ElseNode.java5
-rw-r--r--theme-compiler/src/com/vaadin/sass/tree/controldirective/IfElseDefNode.java14
-rw-r--r--theme-compiler/src/com/vaadin/sass/tree/controldirective/IfNode.java13
4 files changed, 37 insertions, 3 deletions
diff --git a/theme-compiler/src/com/vaadin/sass/tree/controldirective/EachDefNode.java b/theme-compiler/src/com/vaadin/sass/tree/controldirective/EachDefNode.java
index cb209273cb..4ab8486add 100644
--- a/theme-compiler/src/com/vaadin/sass/tree/controldirective/EachDefNode.java
+++ b/theme-compiler/src/com/vaadin/sass/tree/controldirective/EachDefNode.java
@@ -19,10 +19,12 @@ package com.vaadin.sass.tree.controldirective;
import java.util.ArrayList;
import java.util.List;
+import com.vaadin.sass.ScssStylesheet;
import com.vaadin.sass.parser.LexicalUnitImpl;
import com.vaadin.sass.tree.IVariableNode;
import com.vaadin.sass.tree.Node;
import com.vaadin.sass.tree.VariableNode;
+import com.vaadin.sass.visitor.EachNodeHandler;
public class EachDefNode extends Node implements IVariableNode {
private static final long serialVersionUID = 7943948981204906221L;
@@ -88,4 +90,10 @@ public class EachDefNode extends Node implements IVariableNode {
public String getListVariable() {
return listVariable;
}
+
+ @Override
+ public void traverse() {
+ replaceVariables(ScssStylesheet.getVariables());
+ EachNodeHandler.traverse(this);
+ }
}
diff --git a/theme-compiler/src/com/vaadin/sass/tree/controldirective/ElseNode.java b/theme-compiler/src/com/vaadin/sass/tree/controldirective/ElseNode.java
index 529ce4d76e..ecda69d601 100644
--- a/theme-compiler/src/com/vaadin/sass/tree/controldirective/ElseNode.java
+++ b/theme-compiler/src/com/vaadin/sass/tree/controldirective/ElseNode.java
@@ -9,4 +9,9 @@ public class ElseNode extends Node implements IfElseNode {
return null;
}
+ @Override
+ public void traverse() {
+
+ }
+
}
diff --git a/theme-compiler/src/com/vaadin/sass/tree/controldirective/IfElseDefNode.java b/theme-compiler/src/com/vaadin/sass/tree/controldirective/IfElseDefNode.java
index 5bd3ba526c..9a818f0a20 100644
--- a/theme-compiler/src/com/vaadin/sass/tree/controldirective/IfElseDefNode.java
+++ b/theme-compiler/src/com/vaadin/sass/tree/controldirective/IfElseDefNode.java
@@ -1,6 +1,7 @@
package com.vaadin.sass.tree.controldirective;
import com.vaadin.sass.tree.Node;
+import com.vaadin.sass.visitor.IfElseNodeHandler;
public class IfElseDefNode extends Node {
@@ -14,4 +15,17 @@ public class IfElseDefNode extends Node {
return b.toString();
}
+ public void traverse() {
+ try {
+
+ for (final Node child : children) {
+ child.traverse();
+ }
+
+ IfElseNodeHandler.traverse(this);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
}
diff --git a/theme-compiler/src/com/vaadin/sass/tree/controldirective/IfNode.java b/theme-compiler/src/com/vaadin/sass/tree/controldirective/IfNode.java
index 8de7ccf78a..cdaf1b0552 100644
--- a/theme-compiler/src/com/vaadin/sass/tree/controldirective/IfNode.java
+++ b/theme-compiler/src/com/vaadin/sass/tree/controldirective/IfNode.java
@@ -18,6 +18,7 @@ package com.vaadin.sass.tree.controldirective;
import java.util.ArrayList;
import java.util.regex.Pattern;
+import com.vaadin.sass.ScssStylesheet;
import com.vaadin.sass.tree.IVariableNode;
import com.vaadin.sass.tree.Node;
import com.vaadin.sass.tree.VariableNode;
@@ -46,11 +47,17 @@ public class IfNode extends Node implements IfElseNode, IVariableNode {
@Override
public void replaceVariables(ArrayList<VariableNode> variables) {
for (final VariableNode node : variables) {
- if (expression.contains("$" + node.getName())) {
- expression = expression.replaceAll(Pattern.quote("$"
- + node.getName()), node.getExpr().toString());
+ String variable = "$" + node.getName();
+ if (expression.contains(variable)) {
+ expression = expression.replaceAll(Pattern.quote(variable),
+ node.getExpr().toString());
}
}
}
+ @Override
+ public void traverse() {
+ replaceVariables(ScssStylesheet.getVariables());
+ }
+
} \ No newline at end of file