From 4d9c23b6bca80ea8fc80f4d4cb7e349cded949c0 Mon Sep 17 00:00:00 2001
From: jespergravgaard <jesper@balmangravgaard.dk>
Date: Sat, 23 Nov 2019 18:44:43 +0100
Subject: [PATCH] Removed isConstant from Variable (now using Kind).

---
 .../kickc/fragment/AsmFragmentInstance.java   |  2 +-
 .../AsmFragmentInstanceSpecFactory.java       |  2 +-
 .../kickc/fragment/AsmFragmentTemplate.java   | 24 +++++++--------
 .../model/iterator/ProgramValueIterator.java  |  2 +-
 .../camelot64/kickc/model/symbols/Scope.java  | 15 +++++-----
 .../kickc/model/symbols/Variable.java         | 30 ++++---------------
 .../kickc/model/values/ConstantRef.java       |  2 +-
 .../Pass0GenerateStatementSequence.java       |  2 +-
 .../kickc/passes/Pass1UnwindBlockScopes.java  |  2 +-
 .../kickc/passes/Pass1UnwindStructValues.java |  2 +-
 .../kickc/passes/Pass2AssertSymbols.java      |  2 +-
 .../passes/Pass2ConstantIdentification.java   |  2 +-
 .../kickc/passes/Pass2ConstantInlining.java   |  2 +-
 13 files changed, 34 insertions(+), 55 deletions(-)

diff --git a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentInstance.java b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentInstance.java
index 5dc13d751..a09df4d7a 100644
--- a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentInstance.java
+++ b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentInstance.java
@@ -85,7 +85,7 @@ public class AsmFragmentInstance {
          } else {
             throw new RuntimeException("Register Type not implemented " + register);
          }
-      } else if(boundValue instanceof Variable && ((Variable) boundValue).isConstant()) {
+      } else if(boundValue instanceof Variable && ((Variable) boundValue).isKindConstant()) {
          Variable constantVar = (Variable) boundValue;
          String constantValueAsm = AsmFormat.getAsmConstant(program, constantVar.getConstantRef(), 99, codeScopeRef);
          boolean constantValueZp = SymbolType.BYTE.equals(constantVar.getType());
diff --git a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentInstanceSpecFactory.java b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentInstanceSpecFactory.java
index 98ac6c67b..4cba316a9 100644
--- a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentInstanceSpecFactory.java
+++ b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentInstanceSpecFactory.java
@@ -506,7 +506,7 @@ public class AsmFragmentInstanceSpecFactory {
       // If the constant is already bound - reuse the index
       for(String boundName : bindings.keySet()) {
          Value boundValue = bindings.get(boundName);
-         if(boundValue instanceof ConstantValue || (boundValue instanceof Variable && ((Variable) boundValue).isConstant())) {
+         if(boundValue instanceof ConstantValue || (boundValue instanceof Variable && ((Variable) boundValue).isKindConstant())) {
             if(boundValue.equals(constant)) {
                return "c" + boundName.substring(boundName.length() - 1);
             }
diff --git a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplate.java b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplate.java
index 1ac10137a..b2c986d5a 100644
--- a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplate.java
+++ b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplate.java
@@ -79,12 +79,12 @@ public class AsmFragmentTemplate {
       ProgramScope scope = new ProgramScope();
       LinkedHashMap<String, Value> bindings = new LinkedHashMap<>();
       {
-         Variable v1 = new Variable(false, "z1", scope, SymbolType.BYTE, Variable.Kind.PHI_VERSION, Variable.MemoryArea.ZEROPAGE_MEMORY, null);
-         Variable v2 = new Variable(false, "z2", scope, SymbolType.BYTE, Variable.Kind.PHI_VERSION, Variable.MemoryArea.ZEROPAGE_MEMORY, null);
-         Variable v3 = new Variable(false, "z3", scope, SymbolType.BYTE, Variable.Kind.PHI_VERSION, Variable.MemoryArea.ZEROPAGE_MEMORY, null);
-         Variable v4 = new Variable(false, "z4", scope, SymbolType.BYTE, Variable.Kind.PHI_VERSION, Variable.MemoryArea.ZEROPAGE_MEMORY, null);
-         Variable v5 = new Variable(false, "z5", scope, SymbolType.BYTE, Variable.Kind.PHI_VERSION, Variable.MemoryArea.ZEROPAGE_MEMORY, null);
-         Variable v6 = new Variable(false, "z6", scope, SymbolType.BYTE, Variable.Kind.PHI_VERSION, Variable.MemoryArea.ZEROPAGE_MEMORY, null);
+         Variable v1 = new Variable( "z1", scope, SymbolType.BYTE, Variable.Kind.PHI_VERSION, Variable.MemoryArea.ZEROPAGE_MEMORY, null);
+         Variable v2 = new Variable( "z2", scope, SymbolType.BYTE, Variable.Kind.PHI_VERSION, Variable.MemoryArea.ZEROPAGE_MEMORY, null);
+         Variable v3 = new Variable( "z3", scope, SymbolType.BYTE, Variable.Kind.PHI_VERSION, Variable.MemoryArea.ZEROPAGE_MEMORY, null);
+         Variable v4 = new Variable( "z4", scope, SymbolType.BYTE, Variable.Kind.PHI_VERSION, Variable.MemoryArea.ZEROPAGE_MEMORY, null);
+         Variable v5 = new Variable( "z5", scope, SymbolType.BYTE, Variable.Kind.PHI_VERSION, Variable.MemoryArea.ZEROPAGE_MEMORY, null);
+         Variable v6 = new Variable( "z6", scope, SymbolType.BYTE, Variable.Kind.PHI_VERSION, Variable.MemoryArea.ZEROPAGE_MEMORY, null);
          v1.setAllocation(new Registers.RegisterZpMem(2, 1));
          v2.setAllocation(new Registers.RegisterZpMem(4, 1));
          v3.setAllocation(new Registers.RegisterZpMem(6, 1));
@@ -99,12 +99,12 @@ public class AsmFragmentTemplate {
          if(signature.contains("z6")) bindings.put("z6", v6);
       }
       {
-         Variable v1 = new Variable(false, "m1", scope, SymbolType.BYTE, Variable.Kind.LOAD_STORE, Variable.MemoryArea.MAIN_MEMORY, null);
-         Variable v2 = new Variable(false, "m2", scope, SymbolType.BYTE, Variable.Kind.LOAD_STORE, Variable.MemoryArea.MAIN_MEMORY, null);
-         Variable v3 = new Variable(false, "m3", scope, SymbolType.BYTE, Variable.Kind.LOAD_STORE, Variable.MemoryArea.MAIN_MEMORY, null);
-         Variable v4 = new Variable(false, "m4", scope, SymbolType.BYTE, Variable.Kind.LOAD_STORE, Variable.MemoryArea.MAIN_MEMORY, null);
-         Variable v5 = new Variable(false, "m5", scope, SymbolType.BYTE, Variable.Kind.LOAD_STORE, Variable.MemoryArea.MAIN_MEMORY, null);
-         Variable v6 = new Variable(false, "m6", scope, SymbolType.BYTE, Variable.Kind.LOAD_STORE, Variable.MemoryArea.MAIN_MEMORY, null);
+         Variable v1 = new Variable( "m1", scope, SymbolType.BYTE, Variable.Kind.LOAD_STORE, Variable.MemoryArea.MAIN_MEMORY, null);
+         Variable v2 = new Variable( "m2", scope, SymbolType.BYTE, Variable.Kind.LOAD_STORE, Variable.MemoryArea.MAIN_MEMORY, null);
+         Variable v3 = new Variable( "m3", scope, SymbolType.BYTE, Variable.Kind.LOAD_STORE, Variable.MemoryArea.MAIN_MEMORY, null);
+         Variable v4 = new Variable( "m4", scope, SymbolType.BYTE, Variable.Kind.LOAD_STORE, Variable.MemoryArea.MAIN_MEMORY, null);
+         Variable v5 = new Variable( "m5", scope, SymbolType.BYTE, Variable.Kind.LOAD_STORE, Variable.MemoryArea.MAIN_MEMORY, null);
+         Variable v6 = new Variable( "m6", scope, SymbolType.BYTE, Variable.Kind.LOAD_STORE, Variable.MemoryArea.MAIN_MEMORY, null);
          v1.setAllocation(new Registers.RegisterMainMem(v1.getVariableRef(), 1, null));
          v2.setAllocation(new Registers.RegisterMainMem(v2.getVariableRef(), 1, null));
          v3.setAllocation(new Registers.RegisterMainMem(v3.getVariableRef(), 1, null));
diff --git a/src/main/java/dk/camelot64/kickc/model/iterator/ProgramValueIterator.java b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramValueIterator.java
index a39f700bb..ef31b102c 100644
--- a/src/main/java/dk/camelot64/kickc/model/iterator/ProgramValueIterator.java
+++ b/src/main/java/dk/camelot64/kickc/model/iterator/ProgramValueIterator.java
@@ -48,7 +48,7 @@ public class ProgramValueIterator {
     * @param programValueHandler The programValueHandler to execute
     */
    public static void execute(Variable variable, ProgramValueHandler programValueHandler) {
-      if(variable.isConstant()) {
+      if(variable.isKindConstant()) {
          execute(new ProgramValue.ProgramValueConstantVar(variable), programValueHandler, null, null, null);
       }
       if(variable.isArray()) {
diff --git a/src/main/java/dk/camelot64/kickc/model/symbols/Scope.java b/src/main/java/dk/camelot64/kickc/model/symbols/Scope.java
index 76f154a8c..fa6c9f2aa 100644
--- a/src/main/java/dk/camelot64/kickc/model/symbols/Scope.java
+++ b/src/main/java/dk/camelot64/kickc/model/symbols/Scope.java
@@ -101,16 +101,16 @@ public abstract class Scope implements Symbol, Serializable {
    }
 
    public Variable addVariable(Variable.Kind kind, String name, SymbolType type, Variable.MemoryArea memoryArea, String dataSegment) {
-      return add(new Variable( false, name, this, type, kind, memoryArea, dataSegment));
+      return add(new Variable( name, this, type, kind, memoryArea, dataSegment));
    }
 
    public Variable addVariablePhiMaster(String name, SymbolType type, Variable.MemoryArea memoryArea, String dataSegment) {
-      return add(new Variable( false, name, this, type, Variable.Kind.PHI_MASTER, memoryArea, dataSegment));
+      return add(new Variable( name, this, type, Variable.Kind.PHI_MASTER, memoryArea, dataSegment));
    }
 
    public Variable addVariableIntermediate() {
       String name = allocateIntermediateVariableName();
-      return add(new Variable( false, name, this, SymbolType.VAR, Variable.Kind.INTERMEDIATE, Variable.MemoryArea.ZEROPAGE_MEMORY, getSegmentData()));
+      return add(new Variable( name, this, SymbolType.VAR, Variable.Kind.INTERMEDIATE, Variable.MemoryArea.ZEROPAGE_MEMORY, getSegmentData()));
    }
 
    /**
@@ -168,8 +168,7 @@ public abstract class Scope implements Symbol, Serializable {
    }
 
    public Variable getVar(String name) {
-      Variable symbol = (Variable) getSymbol(name);
-      return symbol;
+      return (Variable) getSymbol(name);
    }
 
    public Variable getVar(SymbolVariableRef variableRef) {
@@ -188,7 +187,7 @@ public abstract class Scope implements Symbol, Serializable {
 
    public Variable getConstant(String name) {
       Variable symbol = (Variable) getSymbol(name);
-      if(symbol!=null && !symbol.isConstant()) throw new InternalError("Symbol is not a constant! "+symbol.toString());
+      if(symbol!=null && !symbol.isKindConstant()) throw new InternalError("Symbol is not a constant! "+symbol.toString());
       return symbol;
    }
 
@@ -236,7 +235,7 @@ public abstract class Scope implements Symbol, Serializable {
    public Collection<Variable> getAllConstants(boolean includeSubScopes) {
       Collection<Variable> vars = new ArrayList<>();
       getAllVars(includeSubScopes).stream().
-            filter(Variable::isConstant).
+            filter(variable -> variable.isKindConstant()).
             forEach(vars::add);
       return vars;
    }
@@ -396,7 +395,7 @@ public abstract class Scope implements Symbol, Serializable {
                      }
                   }
                }
-               if(symVar.isConstant() && symVar.getConstantValue()!=null) {
+               if(symVar.isKindConstant() && symVar.getConstantValue()!=null) {
                   res.append(" = " + symVar.getConstantValue().toString(program));
                }
                res.append("\n");
diff --git a/src/main/java/dk/camelot64/kickc/model/symbols/Variable.java b/src/main/java/dk/camelot64/kickc/model/symbols/Variable.java
index 1a5a669e0..753c039e7 100644
--- a/src/main/java/dk/camelot64/kickc/model/symbols/Variable.java
+++ b/src/main/java/dk/camelot64/kickc/model/symbols/Variable.java
@@ -36,9 +36,6 @@ public class Variable implements Symbol {
    /** The kind of the variable.  */
    private Kind kind;
 
-   /** True of the variable is a compile-time constant (previously ConstantVar) [ALL] TODO: Eliminate (use Kind.CONSTANT) */
-   private boolean isConstant;
-
    /** Non-null if teh variable is an array. */
    private ArraySpec arraySpec;
 
@@ -111,7 +108,6 @@ public class Variable implements Symbol {
     */
    public Variable(String name, Scope scope, SymbolType type, ArraySpec arraySpec, String dataSegment, ConstantValue value) {
       this.kind = Kind.CONSTANT;
-      this.isConstant = true;
       this.name = name;
       this.scope = scope;
       this.type = type;
@@ -132,8 +128,7 @@ public class Variable implements Symbol {
     * @param memoryArea  The memory area (zeropage/main memory)
     * @param dataSegment The data segment (in main memory)
     */
-   public Variable(boolean isConstant, String name, Scope scope, SymbolType type, Kind kind, MemoryArea memoryArea, String dataSegment) {
-      this.isConstant = isConstant;
+   public Variable(String name, Scope scope, SymbolType type, Kind kind, MemoryArea memoryArea, String dataSegment) {
       this.name = name;
       this.scope = scope;
       this.type = type;
@@ -144,8 +139,6 @@ public class Variable implements Symbol {
          this.nextPhiVersionNumber = 0;
       this.comments = new ArrayList<>();
       setFullName();
-      //if(isKindConstant()!=isConstant)
-      //   throw new RuntimeException("CONST ISSUE!");
    }
 
 
@@ -156,7 +149,7 @@ public class Variable implements Symbol {
     * @param version The version number
     */
    public Variable(Variable phiMaster, int version) {
-      this(false, phiMaster.getName() + "#" + version, phiMaster.getScope(), phiMaster.getType(), Kind.PHI_VERSION, phiMaster.getMemoryArea(), phiMaster.getDataSegment());
+      this(phiMaster.getName() + "#" + version, phiMaster.getScope(), phiMaster.getType(), Kind.PHI_VERSION, phiMaster.getMemoryArea(), phiMaster.getDataSegment());
       this.setArraySpec(phiMaster.getArraySpec());
       this.setDeclaredAlignment(phiMaster.getDeclaredAlignment());
       this.setDeclaredAsRegister(phiMaster.isDeclaredAsRegister());
@@ -176,7 +169,7 @@ public class Variable implements Symbol {
     * @param original The original variable
     */
    public Variable(String name, Scope scope, Variable original) {
-      this(original.isConstant(), name, scope, original.getType(), original.getKind(), original.getMemoryArea(), original.getDataSegment());
+      this(name, scope, original.getType(), original.getKind(), original.getMemoryArea(), original.getDataSegment());
       this.setArraySpec(original.getArraySpec());
       this.setDeclaredAlignment(original.getDeclaredAlignment());
       this.setDeclaredAsRegister(original.isDeclaredAsRegister());
@@ -193,10 +186,6 @@ public class Variable implements Symbol {
       return kind;
    }
 
-   public void setKind(Kind kind) {
-      this.kind = kind;
-   }
-
    public boolean isKindConstant() {
       return Kind.CONSTANT.equals(getKind());
    }
@@ -217,26 +206,17 @@ public class Variable implements Symbol {
       return Kind.INTERMEDIATE.equals(getKind());
    }
 
-   /**
-    * True if the variable is a compile time constant. (Previously this was ConstantVar)
-    *
-    * @return True if the variable is a compile time constant.
-    */
-   public boolean isConstant() {
-      return isConstant;
-   }
-
    /**
     * True if the variable is a not compile time constant. (Previously this was Variable)
     *
     * @return True if the variable is not a compile-time constant
     */
    public boolean isVariable() {
-      return !isConstant();
+      return !isKindConstant();
    }
 
    public SymbolVariableRef getRef() {
-      if(isConstant())
+      if(isKindConstant())
          return new ConstantRef(this);
       else
          return new VariableRef(this);
diff --git a/src/main/java/dk/camelot64/kickc/model/values/ConstantRef.java b/src/main/java/dk/camelot64/kickc/model/values/ConstantRef.java
index 8351db644..993dbafab 100644
--- a/src/main/java/dk/camelot64/kickc/model/values/ConstantRef.java
+++ b/src/main/java/dk/camelot64/kickc/model/values/ConstantRef.java
@@ -10,7 +10,7 @@ public class ConstantRef extends SymbolVariableRef implements ConstantValue {
 
    public ConstantRef(Variable constantVar) {
       super(constantVar.getFullName());
-      if(!constantVar.isConstant())
+      if(!constantVar.isKindConstant())
          throw new InternalError("VariableRef not allowed for non-constant "+constantVar.toString());
    }
 
diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java b/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java
index 2543669d8..458314a9f 100644
--- a/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java
+++ b/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java
@@ -267,7 +267,7 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
       this.visitDeclTypes(ctx.declTypes());
       SymbolType type = declVarType;
       List<Directive> directives = declVarDirectives;
-      Variable param = new Variable(false, ctx.NAME().getText(), getCurrentScope(), type, Variable.Kind.PHI_MASTER, defaultMemoryArea, currentDataSegment);
+      Variable param = new Variable( ctx.NAME().getText(), getCurrentScope(), type, Variable.Kind.PHI_MASTER, defaultMemoryArea, currentDataSegment);
       // Add directives
       directiveContext.applyDirectives(param, true, false, directives, new StatementSource(ctx));
       exitDeclTypes();
diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass1UnwindBlockScopes.java b/src/main/java/dk/camelot64/kickc/passes/Pass1UnwindBlockScopes.java
index 5bf8696da..a0e19d80a 100644
--- a/src/main/java/dk/camelot64/kickc/passes/Pass1UnwindBlockScopes.java
+++ b/src/main/java/dk/camelot64/kickc/passes/Pass1UnwindBlockScopes.java
@@ -70,7 +70,7 @@ public class Pass1UnwindBlockScopes extends Pass1Base {
                }
             } else if(symbol instanceof Variable) {
                Variable variable = (Variable) symbol;
-               if(variable.isConstant()) {
+               if(variable.isKindConstant()) {
                   String name = findLocalName(procedure, symbol);
                   Variable unwound = new Variable(name, procedure, (Variable) symbol);
                   procedure.add(unwound);
diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass1UnwindStructValues.java b/src/main/java/dk/camelot64/kickc/passes/Pass1UnwindStructValues.java
index f7e147dfe..f5392a4e5 100644
--- a/src/main/java/dk/camelot64/kickc/passes/Pass1UnwindStructValues.java
+++ b/src/main/java/dk/camelot64/kickc/passes/Pass1UnwindStructValues.java
@@ -209,7 +209,7 @@ public class Pass1UnwindStructValues extends Pass1Base {
                   for(Variable member : structDefinition.getAllVars(false)) {
                      String name = variable.getLocalName() + "_" + member.getLocalName();
                      Variable.MemoryArea memoryArea = (member.getType() instanceof SymbolTypePointer)?Variable.MemoryArea.ZEROPAGE_MEMORY:variable.getMemoryArea();
-                     Variable memberVariable = scope.add(new Variable( false, name, scope, member.getType(), variable.getKind(), memoryArea, variable.getDataSegment()));
+                     Variable memberVariable = scope.add(new Variable(  name, scope, member.getType(), variable.getKind(), memoryArea, variable.getDataSegment()));
                      memberVariable.setArraySpec(member.getArraySpec());
                      memberVariable.setDeclaredVolatile(variable.isDeclaredVolatile());
                      memberVariable.setInferredVolatile(variable.isInferredVolatile());
diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass2AssertSymbols.java b/src/main/java/dk/camelot64/kickc/passes/Pass2AssertSymbols.java
index 77297b22e..6756b018c 100644
--- a/src/main/java/dk/camelot64/kickc/passes/Pass2AssertSymbols.java
+++ b/src/main/java/dk/camelot64/kickc/passes/Pass2AssertSymbols.java
@@ -46,7 +46,7 @@ public class Pass2AssertSymbols extends Pass2SsaAssertion {
          if(tableSymbol instanceof Variable && ((Variable) tableSymbol).isKindPhiMaster()) continue;
          if(tableSymbol instanceof Variable && ((Variable) tableSymbol).isKindConstant()) continue;
          if(tableSymbol instanceof Variable && ((Variable) tableSymbol).isKindLoadStore()) continue;
-         if(tableSymbol instanceof Variable && (((Variable) tableSymbol).isConstant()) ) continue;
+         if(tableSymbol instanceof Variable && (((Variable) tableSymbol).isKindConstant()) ) continue;
          if(tableSymbol instanceof StructDefinition) continue;
          if(tableSymbol instanceof EnumDefinition) continue;
          if(tableSymbol instanceof TypeDefsScope) continue;
diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass2ConstantIdentification.java b/src/main/java/dk/camelot64/kickc/passes/Pass2ConstantIdentification.java
index 72507fea2..bad45b2fb 100644
--- a/src/main/java/dk/camelot64/kickc/passes/Pass2ConstantIdentification.java
+++ b/src/main/java/dk/camelot64/kickc/passes/Pass2ConstantIdentification.java
@@ -214,7 +214,7 @@ public class Pass2ConstantIdentification extends Pass2SsaOptimization {
    public static ConstantValue getConstant(RValue rValue) {
       if(rValue instanceof ConstantValue) {
          return (ConstantValue) rValue;
-      } else if(rValue instanceof Variable && ((Variable) rValue).isConstant()) {
+      } else if(rValue instanceof Variable && ((Variable) rValue).isKindConstant()) {
          Variable constantVar = (Variable) rValue;
          return constantVar.getConstantRef();
       } else if(rValue instanceof CastValue) {
diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass2ConstantInlining.java b/src/main/java/dk/camelot64/kickc/passes/Pass2ConstantInlining.java
index f77541016..9d4ff9ef3 100644
--- a/src/main/java/dk/camelot64/kickc/passes/Pass2ConstantInlining.java
+++ b/src/main/java/dk/camelot64/kickc/passes/Pass2ConstantInlining.java
@@ -147,7 +147,7 @@ public class Pass2ConstantInlining extends Pass2SsaOptimization {
                      aliases.put(constant.getConstantRef(), value);
                      getLog().append("Inlining constant with var siblings " + constant);
                      break;
-                  } else if(symbol instanceof Variable && ((Variable) symbol).isConstant()) {
+                  } else if(symbol instanceof Variable && ((Variable) symbol).isKindConstant()) {
                      ConstantValue otherValue = ((Variable) symbol).getConstantValue();
                      if(!otherValue.equals(value) && !(value instanceof ConstantString) && !(value instanceof ConstantArray) && !(otherValue instanceof ConstantRef)) {
                         aliases.put(constant.getConstantRef(), value);