module lang::java::flow::JavaToObjectFlow
rascal-0.40.16
Mapping all of Java to the object flow language.
Usage
import lang::java::flow::JavaToObjectFlow;
Dependencies
import IO;
import List;
import String;
import analysis::flow::ObjectFlow;
import lang::java::m3::TypeSymbol;
import lang::java::m3::AST;
Description
More information can be found in ObjectFlow.
function createOFG
FlowProgram createOFG(set[Declaration] asts)
function correctInsertArg
Expression correctInsertArg(Expression _/*receiver*/, str name, list[Expression] args)
function isContainerInsert
bool isContainerInsert(Expression recv, str name)
function isContainerExtract
bool isContainerExtract(Expression recv, str name)
function fixCollections
list[Declaration] fixCollections(list[Declaration] ast)
function ignoreType
bool ignoreType(arrayType(Type t))
bool ignoreType(super(_, Type t))
bool ignoreType(extends(_, Type t))
bool ignoreType(parameterizedType(_, _))
bool ignoreType(qualifiedType(_, Type t, _))
bool ignoreType(qualifiedType(_, Expression e,_))
bool ignoreType(simpleType(t))
bool ignoreType(unionType(tt))
default bool ignoreType(Type t)
bool ignoreType(id(str n))
bool ignoreType(Expression::qualifiedName([*_, Expression last]))
bool ignoreType(TypeSymbol::interface(_,_))
bool ignoreType(TypeSymbol::\enum(_))
bool ignoreType(TypeSymbol::\typeParameter(_,_))
bool ignoreType(TypeSymbol::\wildcard(_))
bool ignoreType(TypeSymbol::\capture(_,_))
bool ignoreType(TypeSymbol::intersection(tt))
bool ignoreType(TypeSymbol::union(tt))
bool ignoreType(TypeSymbol::\class(t,_))
bool ignoreType(TypeSymbol::\object())
bool ignoreType(TypeSymbol::\array(_,_))
default bool ignoreType(TypeSymbol t)
function getDeclarations
set[FlowDecl] getDeclarations(set[Declaration] asts)
function lhsDecl
loc lhsDecl(arrayAccess(e,_))
loc lhsDecl(f:fieldAccess(_,_))
loc lhsDecl(f:fieldAccess(_))
loc lhsDecl(v:variable(_,_))
loc lhsDecl(s:id(_))
loc lhsDecl(q:qualifiedName(_))
function getStatements
set[FlowStm] getStatements(set[Declaration] asts)
function translate
set[FlowStm] translate(loc base, loc target, c:cast(_, e))
set[FlowStm] translate(loc base, loc target, conditional(con, t, e))
set[FlowStm] translate(loc base, loc target, f:fieldAccess(_,_))
set[FlowStm] translate(loc base, loc target, f:fieldAccess(_))
set[FlowStm] translate(loc base, loc target, s:id(_))
set[FlowStm] translate(loc base, loc target, a:assignment(l,_,r))
set[FlowStm] translate(loc base, loc target, m:methodCall(targs, n, args))
set[FlowStm] translate(loc base, loc target, m:superMethodCall(targs, n, args))
set[FlowStm] translate(loc base, loc target, m:superMethodCall(qual, targs, n, args))
set[FlowStm] translate(loc base, loc target, m:constructorCall(targs, args))
set[FlowStm] translate(loc base, loc target, m:superConstructorCall(qual, targs, args))
set[FlowStm] translate(loc base, loc target, m:superConstructorCall(targs, args))
set[FlowStm] translate(loc base, loc target, m:methodCall(r, _, n, a))
function newObject
Expression newObject(Type t, list[Declaration] targs, list[Expression] args, Expression original)
function translate
set[FlowStm] translate(loc base, loc target, Expression ob:newObject(Expression _, Type t, list[Declaration] targs, list[Expression] a))
set[FlowStm] translate(loc base, loc target, Expression ob:newObject(_, Type t, list[Declaration] targs, list[Expression] a, Declaration _))
set[FlowStm] translate(loc base, loc target, Expression ob:newObject(Type t, list[Declaration] targs, list[Expression] a, Declaration _))
set[FlowStm] translate(loc base, loc target, Expression ob:newObject(_, Type t, _, a))
function simpleExpression
bool simpleExpression(fieldAccess(_,_))
bool simpleExpression(fieldAccess(_))
bool simpleExpression(qualifiedName([*_, e]))
bool simpleExpression(this())
bool simpleExpression(this(_))
bool simpleExpression(id(_))
default bool simpleExpression(Expression e)
function removeNesting
Expression removeNesting(cast(_, e))
Expression removeNesting(arrayAccess(e, _))
Expression removeNesting(\bracket(e))
default Expression removeNesting(Expression e)
function unnestExpressions
tuple[list[loc], set[FlowStm]] unnestExpressions(loc prefix, int uniqNum, list[Expression] exprs)
function translate
default set[FlowStm] translate(loc base, loc target, Expression e)