public class FieldingAnalyzer extends Object
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..
Modifier and Type | Class and Description |
---|---|
static class |
FieldingAnalyzer.AnalysisVisitor |
static class |
FieldingAnalyzer.RewriteVisitor |
Constructor and Description |
---|
FieldingAnalyzer(CodeGenAnalyzer analyzer) |
Modifier and Type | Method and Description |
---|---|
void |
analyze(CGElement cgTree,
boolean mustBeCaught) |
void |
setCaught(Set<CGVariable> catchers) |
public FieldingAnalyzer(CodeGenAnalyzer analyzer)
public void analyze(CGElement cgTree, boolean mustBeCaught)
public void setCaught(Set<CGVariable> catchers)
Copyright © 2005, 2018 IBM Corporation and others. All Rights Reserved.