gov.llnl.babel.visitor
Class AddDefaultsVisitor
public class AddDefaultsVisitor
Iterates over a AST a second time to decorate a primed SymbolTable
with all the details about classes, interfaces, and structs
Type resolution is largely performed in this stage.
visitArgument, visitArgumentList, visitArrayType, visitAssertion, visitAttribute, visitAttributeList, visitBinaryExpr, visitBooleanLiteral, visitCharacterLiteral, visitClassType, visitDComplexLiteral, visitDocComment, visitDoubleLiteral, visitEnsures, visitEnumItem, visitEnumeration, visitExtents, visitFComplexLiteral, visitFixedType, visitFloatLiteral, visitFromClause, visitFuncExpr, visitImportClause, visitIntLiteral, visitInterfaceType, visitInvariants, visitMethod, visitMethodList, visitName, visitNode, visitPackage, visitRArrayType, visitRequireClause, visitRequires, visitSIDLFile, visitScopedID, visitScopedIDList, visitSplicerBlock, visitSplicerImpl, visitSplicerImplList, visitSplicerList, visitStringLiteral, visitStructItem, visitStructType, visitThrowsList, visitUnaryExpr |
AddDefaultsVisitor
public AddDefaultsVisitor(MsgList msgs)
visitClassType
public Object visitClassType(ClassType node,
Object data)Add defaults at the Class Level.
1. If the class is SIDL_BASECLASS, implement SIDL_BASEINTERFACE
2. If the class doesn't inherit anything, extend SIDL_BASECLASS
TBD:
- Should defaults be assigned for class-level splicer blocks?
What about C's "int ignore;" and F90's "integer :: placeholder"?
- If so, then how should the different kind and number of blocks
for each language be handled? (For example, C has two splicer
blocks --- _data and _includes --- in it's header while, ignoring
method-specific blocks, Java has four --- _imports, _data, _load
(for static), and _misc.)
- What is the most desirable way of handling default comments
in splicer blocks given the different comment syntax for each
language?
- visitClassType in interface Visitor
visitInterfaceType
public Object visitInterfaceType(InterfaceType node,
Object data)Add defaults as the interface level
1. If it's not SIDL_BASEINTERFACE, and it has no extends, extend
SIDL_BASEINTERFACE
- visitInterfaceType in interface Visitor
visitMethod
public Object visitMethod(Method node,
Object data)Method level defaults
1. Add implicit Runtime Exception to every throws list
2. Add default splicer block contents --- at least for the
method body.
TBD:
- What about the default splicer block contents for each F90
method's use?
- visitMethod in interface Visitor