-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use transformation to emit "is" checks
Currently, only is_nat is supported Addresses #108
- Loading branch information
Showing
3 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
core/vdm2c/src/main/java/org/overture/codegen/vdm2c/transformations/IsCheckTrans.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.overture.codegen.vdm2c.transformations; | ||
|
||
import org.overture.cgc.extast.analysis.DepthFirstAnalysisCAdaptor; | ||
import org.overture.codegen.ir.analysis.AnalysisException; | ||
import org.overture.codegen.ir.analysis.intf.IAnalysis; | ||
import org.overture.codegen.ir.expressions.AGeneralIsExpIR; | ||
import org.overture.codegen.ir.expressions.ANatIsExpIR; | ||
import org.overture.codegen.trans.assistants.TransAssistantIR; | ||
import org.overture.codegen.vdm2c.utils.CTransUtil; | ||
import org.overture.codegen.vdm2c.utils.IApplyAssistant; | ||
|
||
public class IsCheckTrans extends DepthFirstAnalysisCAdaptor implements IApplyAssistant { | ||
|
||
public static final String VDM_IS_NAT = "isNat"; | ||
|
||
private TransAssistantIR assist; | ||
|
||
public IsCheckTrans(TransAssistantIR assist) | ||
{ | ||
this.assist = assist; | ||
} | ||
|
||
@Override | ||
public void caseANatIsExpIR(ANatIsExpIR node) throws AnalysisException { | ||
CTransUtil.rewriteToApply(this, node, VDM_IS_NAT, node.getExp()); | ||
} | ||
|
||
@Override | ||
public TransAssistantIR getAssist() { | ||
return assist; | ||
} | ||
|
||
@Override | ||
public IAnalysis getAnalyzer() { | ||
return THIS; | ||
} | ||
} |