statements,
+ LabelRef defaultSuccessor,
+ LabelRef conditionalSuccessor,
+ LabelRef callSuccessor) {
this.label = label;
this.scope = scope;
this.statements = statements;
@@ -75,7 +70,7 @@ public class ControlFlowBlock {
*
* Fails if there is no call statement
*
- * @param statement The statement to add.
+ * @param newStatement The statement to add.
*/
public void addStatementBeforeCall(Statement newStatement) {
ListIterator listIterator = statements.listIterator();
@@ -198,7 +193,6 @@ public class ControlFlowBlock {
*
* @return
*/
- @JsonIgnore
public StatementPhiBlock getPhiBlock() {
StatementPhiBlock phiBlock = null;
if(statements.size() > 0 && statements.get(0) instanceof StatementPhiBlock) {
@@ -226,7 +220,6 @@ public class ControlFlowBlock {
*
* @return All successors
*/
- @JsonIgnore
public Collection getSuccessors() {
List successors = new ArrayList<>();
if(defaultSuccessor != null) {
diff --git a/src/main/java/dk/camelot64/kickc/model/ControlFlowGraph.java b/src/main/java/dk/camelot64/kickc/model/ControlFlowGraph.java
index 978d17f1e..ac272a114 100644
--- a/src/main/java/dk/camelot64/kickc/model/ControlFlowGraph.java
+++ b/src/main/java/dk/camelot64/kickc/model/ControlFlowGraph.java
@@ -1,9 +1,5 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.util.*;
/**
@@ -25,11 +21,10 @@ public class ControlFlowGraph {
this.firstBlockRef = firstBlockRef;
}
- @JsonCreator
public ControlFlowGraph(
- @JsonProperty("blocks") Map blocks,
- @JsonProperty("firstBlockRef") LabelRef firstBlockRef,
- @JsonProperty("sequence") List sequence) {
+ Map blocks,
+ LabelRef firstBlockRef,
+ List sequence) {
this.blocks = blocks;
this.firstBlockRef = firstBlockRef;
this.sequence = sequence;
@@ -43,12 +38,10 @@ public class ControlFlowGraph {
blocks.put(block.getLabel(), block);
}
- @JsonIgnore
public ControlFlowBlock getFirstBlock() {
return getBlock(firstBlockRef);
}
- @JsonIgnore
public Collection getAllBlocks() {
if(sequence != null) {
ArrayList blocks = new ArrayList<>();
@@ -162,7 +155,6 @@ public class ControlFlowGraph {
this.sequence = sequence;
}
- @JsonIgnore
public ControlFlowBlock getMainBlock() {
for(ControlFlowBlock block : getAllBlocks()) {
LabelRef label = block.getLabel();
diff --git a/src/main/java/dk/camelot64/kickc/model/Label.java b/src/main/java/dk/camelot64/kickc/model/Label.java
index 20d3d6ffd..a2ffb7420 100644
--- a/src/main/java/dk/camelot64/kickc/model/Label.java
+++ b/src/main/java/dk/camelot64/kickc/model/Label.java
@@ -1,9 +1,5 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
/** A jump label */
public class Label implements Symbol {
@@ -21,10 +17,7 @@ public class Label implements Symbol {
this.intermediate = intermediate;
}
- @JsonCreator
- public Label(
- @JsonProperty("name") String name,
- @JsonProperty("intermediate") boolean intermediate) {
+ public Label( String name, boolean intermediate) {
this.name = name;
this.scope = null;
this.intermediate = intermediate;
@@ -63,7 +56,6 @@ public class Label implements Symbol {
return intermediate;
}
- @JsonIgnore
public SymbolType getType() {
return SymbolType.LABEL;
}
@@ -101,7 +93,6 @@ public class Label implements Symbol {
}
}
- @JsonIgnore
public LabelRef getRef() {
return new LabelRef(this);
}
diff --git a/src/main/java/dk/camelot64/kickc/model/LabelRef.java b/src/main/java/dk/camelot64/kickc/model/LabelRef.java
index 7b2b5d83c..973de630d 100644
--- a/src/main/java/dk/camelot64/kickc/model/LabelRef.java
+++ b/src/main/java/dk/camelot64/kickc/model/LabelRef.java
@@ -1,14 +1,9 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
/** A reference to a label */
public class LabelRef extends SymbolRef {
- @JsonCreator
- public LabelRef(
- @JsonProperty("fullName") String fullName) {
+ public LabelRef(String fullName) {
super(fullName);
}
diff --git a/src/main/java/dk/camelot64/kickc/model/Procedure.java b/src/main/java/dk/camelot64/kickc/model/Procedure.java
index 914fb5faa..684befa66 100644
--- a/src/main/java/dk/camelot64/kickc/model/Procedure.java
+++ b/src/main/java/dk/camelot64/kickc/model/Procedure.java
@@ -1,9 +1,5 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -20,14 +16,13 @@ public class Procedure extends Scope {
this.returnType = returnType;
}
- @JsonCreator
private Procedure(
- @JsonProperty("name") String name,
- @JsonProperty("returntype") SymbolType returnType,
- @JsonProperty("parameterNames") List parameterNames,
- @JsonProperty("symbols") HashMap symbols,
- @JsonProperty("intermediateVarCount") int intermediateVarCount,
- @JsonProperty("intermediateLabelCount") int intermediateLabelCount) {
+ String name,
+ SymbolType returnType,
+ List parameterNames,
+ HashMap symbols,
+ int intermediateVarCount,
+ int intermediateLabelCount) {
super(name, symbols, intermediateVarCount, intermediateLabelCount);
this.returnType = returnType;
this.parameterNames = parameterNames;
@@ -41,7 +36,6 @@ public class Procedure extends Scope {
this.parameterNames = parameterNames;
}
- @JsonIgnore
public Label getLabel() {
return new Label(getFullName(), getScope(), false);
}
@@ -50,7 +44,6 @@ public class Procedure extends Scope {
return returnType;
}
- @JsonIgnore
public List getParameters() {
ArrayList parameters = new ArrayList<>();
for(String name : parameterNames) {
@@ -108,7 +101,6 @@ public class Procedure extends Scope {
return res.toString();
}
- @JsonIgnore
public ProcedureRef getRef() {
return new ProcedureRef(this.getFullName());
}
diff --git a/src/main/java/dk/camelot64/kickc/model/ProcedureRef.java b/src/main/java/dk/camelot64/kickc/model/ProcedureRef.java
index a402695bc..ee34b3e84 100644
--- a/src/main/java/dk/camelot64/kickc/model/ProcedureRef.java
+++ b/src/main/java/dk/camelot64/kickc/model/ProcedureRef.java
@@ -1,14 +1,9 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
/** A reference to a procedure */
public class ProcedureRef extends ScopeRef {
- @JsonCreator
- public ProcedureRef(@JsonProperty("fullName") String fullName) {
+ public ProcedureRef(String fullName) {
super(fullName);
}
@@ -17,7 +12,6 @@ public class ProcedureRef extends ScopeRef {
*
* @return The label of the code block
*/
- @JsonIgnore
public LabelRef getLabelRef() {
return new LabelRef(getFullName());
}
@@ -27,7 +21,6 @@ public class ProcedureRef extends ScopeRef {
*
* @return The label of the code block
*/
- @JsonIgnore
public LabelRef getReturnBlock() {
return new LabelRef(getFullName() + "::" + SymbolRef.PROCEXIT_BLOCK_NAME);
}
diff --git a/src/main/java/dk/camelot64/kickc/model/ProgramScope.java b/src/main/java/dk/camelot64/kickc/model/ProgramScope.java
index a2c7234bb..e44f93430 100644
--- a/src/main/java/dk/camelot64/kickc/model/ProgramScope.java
+++ b/src/main/java/dk/camelot64/kickc/model/ProgramScope.java
@@ -1,9 +1,5 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.util.HashMap;
/** The program scope containing the symbols of a program */
@@ -14,12 +10,11 @@ public class ProgramScope extends Scope {
super("", null);
}
- @JsonCreator
private ProgramScope(
- @JsonProperty("name") String name,
- @JsonProperty("symbols") HashMap symbols,
- @JsonProperty("intermediateVarCount") int intermediateVarCount,
- @JsonProperty("intermediateLabelCount") int intermediateLabelCount) {
+ String name,
+ HashMap symbols,
+ int intermediateVarCount,
+ int intermediateLabelCount) {
super(name, symbols, intermediateVarCount, intermediateLabelCount);
}
@@ -28,7 +23,6 @@ public class ProgramScope extends Scope {
return new SymbolTypeProgram();
}
- @JsonIgnore
public String getSymbolTableContents(Program program) {
return toString(program, null);
}
diff --git a/src/main/java/dk/camelot64/kickc/model/Scope.java b/src/main/java/dk/camelot64/kickc/model/Scope.java
index 4b0d05a4b..82ecde020 100644
--- a/src/main/java/dk/camelot64/kickc/model/Scope.java
+++ b/src/main/java/dk/camelot64/kickc/model/Scope.java
@@ -1,9 +1,5 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.util.*;
/**
@@ -15,7 +11,6 @@ public abstract class Scope implements Symbol {
private HashMap symbols;
private int intermediateVarCount = 0;
private int intermediateLabelCount = 1;
- @JsonIgnore
private Scope parentScope;
public Scope(String name, Scope parentScope) {
@@ -24,12 +19,11 @@ public abstract class Scope implements Symbol {
this.symbols = new LinkedHashMap<>();
}
- @JsonCreator
public Scope(
- @JsonProperty("name") String name,
- @JsonProperty("symbols") HashMap symbols,
- @JsonProperty("intermediateVarCount") int intermediateVarCount,
- @JsonProperty("intermediateLabelCount") int intermediateLabelCount) {
+ String name,
+ HashMap symbols,
+ int intermediateVarCount,
+ int intermediateLabelCount) {
this.name = name;
this.symbols = symbols;
this.intermediateVarCount = intermediateVarCount;
@@ -74,7 +68,6 @@ public abstract class Scope implements Symbol {
}
@Override
- @JsonIgnore
public Scope getScope() {
return parentScope;
}
@@ -85,11 +78,9 @@ public abstract class Scope implements Symbol {
}
@Override
- @JsonIgnore
public abstract SymbolType getType();
@Override
- @JsonIgnore
public int getScopeDepth() {
if(parentScope == null) {
return 0;
@@ -190,7 +181,6 @@ public abstract class Scope implements Symbol {
return getConstant(constantRef.getFullName());
}
- @JsonIgnore
public Collection getAllVariables(boolean includeSubScopes) {
Collection vars = new ArrayList<>();
for(Symbol symbol : symbols.values()) {
@@ -227,7 +217,6 @@ public abstract class Scope implements Symbol {
* @param includeSubScopes Include sub-scopes og sub-scopes
* @return The scopes
*/
- @JsonIgnore
public Collection getAllScopes(boolean includeSubScopes) {
Collection scopes = new ArrayList<>();
for(Symbol symbol : symbols.values()) {
@@ -309,7 +298,6 @@ public abstract class Scope implements Symbol {
return (Procedure) getSymbol(ref);
}
- @JsonIgnore
public String toString(Program program, Class symbolClass) {
VariableRegisterWeights registerWeights = program.getVariableRegisterWeights();
StringBuilder res = new StringBuilder();
@@ -359,7 +347,6 @@ public abstract class Scope implements Symbol {
return res.toString();
}
- @JsonIgnore
public Collection getAllSymbols() {
return symbols.values();
}
diff --git a/src/main/java/dk/camelot64/kickc/model/ScopeRef.java b/src/main/java/dk/camelot64/kickc/model/ScopeRef.java
index b9bb3419b..60f5c5cd4 100644
--- a/src/main/java/dk/camelot64/kickc/model/ScopeRef.java
+++ b/src/main/java/dk/camelot64/kickc/model/ScopeRef.java
@@ -1,17 +1,12 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
/** A reference to a scope */
public class ScopeRef extends SymbolRef {
/** The ROOT scope of the program. */
public static final ScopeRef ROOT = new ScopeRef("");
- @JsonCreator
- public ScopeRef(
- @JsonProperty("fullName") String fullName) {
+ public ScopeRef(String fullName) {
super(fullName);
}
diff --git a/src/main/java/dk/camelot64/kickc/model/Statement.java b/src/main/java/dk/camelot64/kickc/model/Statement.java
index 85ff16dbf..17441c360 100644
--- a/src/main/java/dk/camelot64/kickc/model/Statement.java
+++ b/src/main/java/dk/camelot64/kickc/model/Statement.java
@@ -1,24 +1,10 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonSubTypes;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
/**
* Single Static Assignment Form Statement.
* Intermediate form used for compiler optimization.
*/
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type")
-@JsonSubTypes({
- @JsonSubTypes.Type(value = StatementAssignment.class, name = "assign"),
- @JsonSubTypes.Type(value = StatementPhiBlock.class, name = "phiblock"),
- @JsonSubTypes.Type(value = StatementConditionalJump.class, name = "cond"),
- @JsonSubTypes.Type(value = StatementJump.class, name = "jump"),
- @JsonSubTypes.Type(value = StatementLabel.class, name = "label"),
- @JsonSubTypes.Type(value = StatementCall.class, name = "call"),
- @JsonSubTypes.Type(value = StatementReturn.class, name = "return"),
- @JsonSubTypes.Type(value = StatementProcedureBegin.class, name = "procbegin"),
- @JsonSubTypes.Type(value = StatementProcedureEnd.class, name = "procend")
-})
public interface Statement {
String toString(Program program, boolean aliveInfo);
diff --git a/src/main/java/dk/camelot64/kickc/model/StatementAssignment.java b/src/main/java/dk/camelot64/kickc/model/StatementAssignment.java
index 91f666d70..dcfc581ec 100644
--- a/src/main/java/dk/camelot64/kickc/model/StatementAssignment.java
+++ b/src/main/java/dk/camelot64/kickc/model/StatementAssignment.java
@@ -1,9 +1,5 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
/**
* Single Static Assignment Form Statement.
* Intermediate form used for compiler optimization.
@@ -12,7 +8,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
*
* lValue := rValue1 <operator> rValue2
*/
-@JsonPropertyOrder({"lValue", "rValue1", "operator", "rValue2"})
public class StatementAssignment extends StatementBase implements StatementLValue {
/** The variable being assigned a value by the statement. */
@@ -41,13 +36,12 @@ public class StatementAssignment extends StatementBase implements StatementLValu
this(lValue.getRef(), rValue2);
}
- @JsonCreator
public StatementAssignment(
- @JsonProperty("lValue1") LValue lValue,
- @JsonProperty("rValue1") RValue rValue1,
- @JsonProperty("operator") Operator operator,
- @JsonProperty("rValue2") RValue rValue2,
- @JsonProperty("index") Integer index) {
+ LValue lValue,
+ RValue rValue1,
+ Operator operator,
+ RValue rValue2,
+ Integer index) {
super(index);
this.lValue = lValue;
this.rValue1 = rValue1;
diff --git a/src/main/java/dk/camelot64/kickc/model/StatementCall.java b/src/main/java/dk/camelot64/kickc/model/StatementCall.java
index 44db887ad..8c66922e6 100644
--- a/src/main/java/dk/camelot64/kickc/model/StatementCall.java
+++ b/src/main/java/dk/camelot64/kickc/model/StatementCall.java
@@ -1,9 +1,5 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.util.List;
/**
@@ -30,22 +26,6 @@ public class StatementCall extends StatementBase implements StatementLValue {
this.parametersByAssignment = false;
}
- @JsonCreator
- StatementCall(
- @JsonProperty("lValue") LValue lValue,
- @JsonProperty("procedureName") String procedureName,
- @JsonProperty("procedure") ProcedureRef procedure,
- @JsonProperty("parameters") List parameters,
- @JsonProperty("parametersByAssignment") boolean parametersByAssignment,
- @JsonProperty("index") Integer index) {
- super(index);
- this.lValue = lValue;
- this.procedureName = procedureName;
- this.procedure = procedure;
- this.parameters = parameters;
- this.parametersByAssignment = parametersByAssignment;
- }
-
public LValue getlValue() {
return lValue;
}
@@ -74,7 +54,6 @@ public class StatementCall extends StatementBase implements StatementLValue {
this.parameters = parameters;
}
- @JsonIgnore
public int getNumParameters() {
return parameters.size();
}
diff --git a/src/main/java/dk/camelot64/kickc/model/StatementConditionalJump.java b/src/main/java/dk/camelot64/kickc/model/StatementConditionalJump.java
index d60abb87e..c0a9b433d 100644
--- a/src/main/java/dk/camelot64/kickc/model/StatementConditionalJump.java
+++ b/src/main/java/dk/camelot64/kickc/model/StatementConditionalJump.java
@@ -1,8 +1,5 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
/**
* Intermediate Compiler Form Statement with a conditional jump.
* Intermediate form used for compiler optimization.
@@ -34,13 +31,12 @@ public class StatementConditionalJump extends StatementBase {
this(rValue1, operator, rValue2, destination, null);
}
- @JsonCreator
public StatementConditionalJump(
- @JsonProperty("rValue1") RValue rValue1,
- @JsonProperty("operator") Operator operator,
- @JsonProperty("rValue2") RValue rValue2,
- @JsonProperty("destination") LabelRef destination,
- @JsonProperty("index") Integer index) {
+ RValue rValue1,
+ Operator operator,
+ RValue rValue2,
+ LabelRef destination,
+ Integer index) {
super(index);
this.rValue1 = rValue1;
this.operator = operator;
diff --git a/src/main/java/dk/camelot64/kickc/model/StatementPhiBlock.java b/src/main/java/dk/camelot64/kickc/model/StatementPhiBlock.java
index c0873465b..0833ac857 100644
--- a/src/main/java/dk/camelot64/kickc/model/StatementPhiBlock.java
+++ b/src/main/java/dk/camelot64/kickc/model/StatementPhiBlock.java
@@ -1,9 +1,5 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -19,10 +15,9 @@ public class StatementPhiBlock extends StatementBase {
*/
private List phiVariables;
- @JsonCreator
public StatementPhiBlock(
- @JsonProperty("phiVariables") List phiVariables,
- @JsonProperty("index") Integer index) {
+ List phiVariables,
+ Integer index) {
super(index);
this.phiVariables = phiVariables;
}
@@ -37,7 +32,6 @@ public class StatementPhiBlock extends StatementBase {
*
* @return The variables defined
*/
- @JsonIgnore
public List getVariables() {
ArrayList vars = new ArrayList<>();
for(PhiVariable phiVariable : phiVariables) {
@@ -150,10 +144,9 @@ public class StatementPhiBlock extends StatementBase {
this.values = new ArrayList<>();
}
- @JsonCreator
public PhiVariable(
- @JsonProperty("variable") VariableRef variable,
- @JsonProperty("values") List values) {
+ VariableRef variable,
+ List values) {
this.variable = variable;
this.values = values;
}
@@ -209,7 +202,6 @@ public class StatementPhiBlock extends StatementBase {
getPhirValue(predecessor).setrValue(rValue);
}
- @JsonIgnore
public boolean isEmpty() {
return this.values.isEmpty();
}
@@ -252,10 +244,9 @@ public class StatementPhiBlock extends StatementBase {
this.predecessor = predecessor;
}
- @JsonCreator
public PhiRValue(
- @JsonProperty("predecessor") LabelRef predecessor,
- @JsonProperty("rValue") RValue rValue) {
+ LabelRef predecessor,
+ RValue rValue) {
this.predecessor = predecessor;
this.rValue = rValue;
}
diff --git a/src/main/java/dk/camelot64/kickc/model/StatementReturn.java b/src/main/java/dk/camelot64/kickc/model/StatementReturn.java
index e39bb5f51..9732309a3 100644
--- a/src/main/java/dk/camelot64/kickc/model/StatementReturn.java
+++ b/src/main/java/dk/camelot64/kickc/model/StatementReturn.java
@@ -1,8 +1,5 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
/**
* Return Statement inside procedure in Single Static Assignment Form.
*/
@@ -18,14 +15,6 @@ public class StatementReturn extends StatementBase {
this.value = value;
}
- @JsonCreator
- StatementReturn(
- @JsonProperty("value") RValue value,
- @JsonProperty("index") Integer index) {
- super(index);
- this.value = value;
- }
-
public RValue getValue() {
return value;
}
diff --git a/src/main/java/dk/camelot64/kickc/model/Symbol.java b/src/main/java/dk/camelot64/kickc/model/Symbol.java
index 2ca755057..94bd40eb1 100644
--- a/src/main/java/dk/camelot64/kickc/model/Symbol.java
+++ b/src/main/java/dk/camelot64/kickc/model/Symbol.java
@@ -1,24 +1,18 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
/** A Symbol (variable, jump label, etc.) */
public interface Symbol extends Value {
- @JsonIgnore
String getLocalName();
- @JsonIgnore
String getFullName();
SymbolType getType();
- @JsonIgnore
Scope getScope();
void setScope(Scope scope);
- @JsonIgnore
int getScopeDepth();
SymbolRef getRef();
diff --git a/src/main/java/dk/camelot64/kickc/model/SymbolRef.java b/src/main/java/dk/camelot64/kickc/model/SymbolRef.java
index 108d058e8..e0fb01d59 100644
--- a/src/main/java/dk/camelot64/kickc/model/SymbolRef.java
+++ b/src/main/java/dk/camelot64/kickc/model/SymbolRef.java
@@ -1,7 +1,5 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
/** A reference to a symbol (variable, procedure or label) */
public class SymbolRef implements Value {
@@ -56,7 +54,6 @@ public class SymbolRef implements Value {
}
}
- @JsonIgnore
public int getScopeDepth() {
int depth = 0;
char[] chars = fullName.toCharArray();
@@ -66,12 +63,10 @@ public class SymbolRef implements Value {
return depth / 2;
}
- @JsonIgnore
public boolean isVersion() {
return fullName.contains("#");
}
- @JsonIgnore
public boolean isIntermediate() {
if(
fullName.contains(BEGIN_BLOCK_NAME) ||
@@ -79,12 +74,10 @@ public class SymbolRef implements Value {
return fullName.contains("$") || fullName.contains("@");
}
- @JsonIgnore
public boolean isProcExit() {
return fullName.endsWith(PROCEXIT_BLOCK_NAME);
}
- @JsonIgnore
public String getLocalName() {
int lastScopeIdx = fullName.lastIndexOf("::");
if(lastScopeIdx == -1) {
@@ -94,7 +87,6 @@ public class SymbolRef implements Value {
}
}
- @JsonIgnore
public String getScopeNames() {
int lastScopeIdx = fullName.lastIndexOf("::");
if(lastScopeIdx == -1) {
diff --git a/src/main/java/dk/camelot64/kickc/model/SymbolTypePointer.java b/src/main/java/dk/camelot64/kickc/model/SymbolTypePointer.java
index 883bf4d4b..5d7a27281 100644
--- a/src/main/java/dk/camelot64/kickc/model/SymbolTypePointer.java
+++ b/src/main/java/dk/camelot64/kickc/model/SymbolTypePointer.java
@@ -1,17 +1,12 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
/** A pointer */
public class SymbolTypePointer implements SymbolType {
private SymbolType elementType;
- @JsonCreator
public SymbolTypePointer(
- @JsonProperty("elementType") SymbolType elementType) {
+ SymbolType elementType) {
this.elementType = elementType;
}
@@ -24,7 +19,6 @@ public class SymbolTypePointer implements SymbolType {
}
@Override
- @JsonIgnore
public String getTypeName() {
return elementType.getTypeName() + "*";
}
diff --git a/src/main/java/dk/camelot64/kickc/model/SymbolTypeProcedure.java b/src/main/java/dk/camelot64/kickc/model/SymbolTypeProcedure.java
index 785e13c73..6794c8579 100644
--- a/src/main/java/dk/camelot64/kickc/model/SymbolTypeProcedure.java
+++ b/src/main/java/dk/camelot64/kickc/model/SymbolTypeProcedure.java
@@ -1,17 +1,11 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
/** A function returning another type */
public class SymbolTypeProcedure implements SymbolType {
private SymbolType returnType;
- @JsonCreator
- public SymbolTypeProcedure(
- @JsonProperty("returnType") SymbolType returnType) {
+ public SymbolTypeProcedure(SymbolType returnType) {
this.returnType = returnType;
}
@@ -20,7 +14,6 @@ public class SymbolTypeProcedure implements SymbolType {
}
@Override
- @JsonIgnore
public String getTypeName() {
return returnType.getTypeName() + "()";
}
diff --git a/src/main/java/dk/camelot64/kickc/model/SymbolTypeProgram.java b/src/main/java/dk/camelot64/kickc/model/SymbolTypeProgram.java
index 54d94fcda..7c140a34c 100644
--- a/src/main/java/dk/camelot64/kickc/model/SymbolTypeProgram.java
+++ b/src/main/java/dk/camelot64/kickc/model/SymbolTypeProgram.java
@@ -1,7 +1,5 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
/** A program */
public class SymbolTypeProgram implements SymbolType {
@@ -10,7 +8,6 @@ public class SymbolTypeProgram implements SymbolType {
}
@Override
- @JsonIgnore
public String getTypeName() {
return "PROGRAM";
}
diff --git a/src/main/java/dk/camelot64/kickc/model/Value.java b/src/main/java/dk/camelot64/kickc/model/Value.java
index 0601c78d2..4cb3c737a 100644
--- a/src/main/java/dk/camelot64/kickc/model/Value.java
+++ b/src/main/java/dk/camelot64/kickc/model/Value.java
@@ -1,29 +1,6 @@
package dk.camelot64.kickc.model;
-import com.fasterxml.jackson.annotation.JsonSubTypes;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-
/** Any value (variable, constant, label) */
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type")
-@JsonSubTypes({
- @JsonSubTypes.Type(value = ConstantBool.class, name = "boolean"),
- @JsonSubTypes.Type(value = ConstantInteger.class, name = "integer"),
- @JsonSubTypes.Type(value = ConstantDouble.class, name = "double"),
- @JsonSubTypes.Type(value = ConstantString.class, name = "string"),
- @JsonSubTypes.Type(value = VariableUnversioned.class, name = "variable_unversioned"),
- @JsonSubTypes.Type(value = VariableVersion.class, name = "variable_versioned"),
- @JsonSubTypes.Type(value = VariableIntermediate.class, name = "variable_intermediate"),
- @JsonSubTypes.Type(value = Label.class, name = "label"),
- @JsonSubTypes.Type(value = VariableRef.class, name = "varref"),
- @JsonSubTypes.Type(value = LabelRef.class, name = "labelref"),
- @JsonSubTypes.Type(value = ProcedureRef.class, name = "procref"),
- @JsonSubTypes.Type(value = PointerDereferenceIndexed.class, name = "pointer_indexed"),
- @JsonSubTypes.Type(value = PointerDereferenceSimple.class, name = "pointer_simple"),
- @JsonSubTypes.Type(value = ProgramScope.class, name = "program"),
- @JsonSubTypes.Type(value = Procedure.class, name = "procedure")
-})
public interface Value {
-
String toString(Program program);
-
}
diff --git a/src/main/java/dk/camelot64/kickc/model/jackson/IclJacksonFactory.java b/src/main/java/dk/camelot64/kickc/model/jackson/IclJacksonFactory.java
deleted file mode 100644
index 00d8fb1f7..000000000
--- a/src/main/java/dk/camelot64/kickc/model/jackson/IclJacksonFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package dk.camelot64.kickc.model.jackson;
-
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.PropertyAccessor;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.Module;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-
-/** Factory for Jackson JSON serialization of the KickC ICL */
-public class IclJacksonFactory {
-
- private static ObjectMapper mapper;
- private static Module module;
-
- static {
- mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
- mapper.setSerializationInclusion(JsonInclude.Include.ALWAYS);
- mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
- SimpleModule jsonModule = new SimpleModule("KickC ICL Types");
- module = jsonModule;
- mapper.registerModule(jsonModule);
- }
-
-
- /** Get an ObjectMapper usable for serializing/deserializing KickC ICL to/from JSON */
- public static ObjectMapper getMapper() {
- return mapper;
- }
-
-
- /** Get a Jackson Module usable for serializing/deserializing KickC ICL to/from JSON */
- public static Module getModule() {
- return module;
- }
-
-}