|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ocl.examples.codegen.analyzer.FieldingAnalyzer
public class FieldingAnalyzer
A FieldingAnalyzer identifies the necessary catches and throws.
Most AST nodes just propagate invalid and so use of Java exception is convenient and efficient.
The only AST nodes that respond to invalid are validating operations, so it might seem appropriate to just catch all validating operation inputs.
However VariableExps enable a value computed elsewhere to be re-used. Therefore if the re-use is by a validating operation, the computation elsewhere must be caught in the sharing LetExp.
A tree descent/ascent maintains a set of external variable references from a node and its descendants. Wherever a validating operation is encountered on the ascent, all external references from source and parameters are marked as caught variables.
A tree descent/ascent computes the isCaught state of all nodes. On the ascent children with incompatible isCaught state are corrected by insertion of a CGCaughtExp to catch a not-isCaught or a CHThrowExp to throw an isCaught..
Nested Class Summary | |
---|---|
static class |
FieldingAnalyzer.AnalysisVisitor
|
static class |
FieldingAnalyzer.RewriteVisitor
|
Field Summary | |
---|---|
protected CodeGenAnalyzer |
analyzer
|
Constructor Summary | |
---|---|
FieldingAnalyzer(CodeGenAnalyzer analyzer)
|
Method Summary | |
---|---|
void |
analyze(CGElement cgTree,
boolean mustBeCaught)
|
protected FieldingAnalyzer.AnalysisVisitor |
createAnalysisVisitor()
|
protected FieldingAnalyzer.RewriteVisitor |
createRewriteVisitor(java.util.Set<CGVariable> caughtVariables)
|
protected boolean |
isValidating(org.eclipse.emf.ecore.EObject eObject)
|
void |
setCaught(java.util.Set<CGVariable> catchers)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@NonNull protected final CodeGenAnalyzer analyzer
Constructor Detail |
---|
public FieldingAnalyzer(@NonNull CodeGenAnalyzer analyzer)
Method Detail |
---|
public void analyze(@NonNull CGElement cgTree, boolean mustBeCaught)
@NonNull protected FieldingAnalyzer.AnalysisVisitor createAnalysisVisitor()
@NonNull protected FieldingAnalyzer.RewriteVisitor createRewriteVisitor(@NonNull java.util.Set<CGVariable> caughtVariables)
protected boolean isValidating(org.eclipse.emf.ecore.EObject eObject)
public void setCaught(@Nullable java.util.Set<CGVariable> catchers)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |