module JavaToObjectFlow
rascal-0.28.2
Usage
import lang::java::flow::JavaToObjectFlow;
Dependencies
import IO;
import List;
import analysis::flow::ObjectFlow;
import lang::java::m3::TypeSymbol;
import lang::java::m3::AST;
Synopsis
mapping all of Java to the object flow language
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(t))
bool ignoreType(upperbound(t))
bool ignoreType(lowerbound(t))
bool ignoreType(parameterizedType(_))
bool ignoreType(Type::qualifiedType(t,_))
bool ignoreType(simpleType(t))
bool ignoreType(unionType(tt))
default bool ignoreType(Type t)
bool ignoreType(Expression::simpleName(n))
bool ignoreType(Expression::qualifiedName(Expression q, n))
default bool ignoreType(Expression e)
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:simpleName(_))
loc lhsDecl(q:qualifiedName(_,_))
default loc lhsDecl(Expression e)
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:simpleName(_))
set[FlowStm] translate(loc base, loc target, a:assignment(l,_,r))
set[FlowStm] translate(loc base, loc target, m:methodCall(s, n, a))
set[FlowStm] translate(loc base, loc target, m:methodCall(_, r, n, a))
function newObject
Expression newObject(Type t, list[Expression] args, Expression original)
function translate
set[FlowStm] translate(loc base, loc target, Expression ob:newObject(Expression _, Type t, list[Expression] a))
set[FlowStm] translate(loc base, loc target, Expression ob:newObject(_, Type t, list[Expression] a, Declaration _))
set[FlowStm] translate(loc base, loc target, Expression ob:newObject(Type t, 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(simpleName(_))
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)