Skip to main content

module lang::php::analysis::usedef::UseDef

rascal-0.40.17
php-analysis-0.2.4

Usage

import lang::php::analysis::usedef::UseDef;

Source code

http://github.com/cwi-swat/php-analysis/blob/main/src/main/rascal/lang/php/analysis/usedef/UseDef.rsc

Dependencies

import lang::php::ast::AbstractSyntax;
import lang::php::ast::System;
import lang::php::analysis::cfg::CFG;
import lang::php::analysis::cfg::Label;
import lang::php::analysis::cfg::FlowEdge;
import lang::php::pp::PrettyPrinter;
import lang::php::analysis::cfg::Util;
import Relation;
import Set;
import List;

data Name

data Name  
= varName(str varName)
| elementName(str varName, str indexName)
| computedName(Expr computedName)
| propertyName(Expr targetObject, str propertyName)
| computedPropertyName(Expr targetObject, Expr computedPropertyName)
| staticPropertyName(str className, str propertyName)
| computedStaticPropertyName(Expr computedClassName, str propertyName)
| computedStaticPropertyName(str className, Expr computedPropertyName)
| computedStaticPropertyName(Expr computedClassName, Expr computedPropertyName)
;

function printName

str printName(varName(str vname))

str printName(elementName(str vname, str indexName))

str printName(computedName(Expr cname))

str printName(propertyName(Expr targetObject, str pname))

str printName(computedPropertyName(Expr targetObject, Expr pname))

str printName(staticPropertyName(str className, str pname))

str printName(computedStaticPropertyName(Expr computedClassName, str pname))

str printName(computedStaticPropertyName(str className, Expr pname))

str printName(computedStaticPropertyName(Expr computedClassName, Expr pname))

data DefExpr

data DefExpr  
= defExpr(Expr e)
| defExprWOp(Name usedName, Expr e, Op usedOp)
| inputParamDef(Name paramName)
| globalDef(Name globalName)
;

alias Defs

rel[Lab current, Name name, DefExpr definedAs, Lab definedAt]

alias Uses

rel[Lab current, Name name, Lab definedAt]

function isDefNode

bool isDefNode(exprNode(assign(_,_),_))

bool isDefNode(exprNode(assignWOp(_,_,_),_))

bool isDefNode(exprNode(refAssign(_,_),_))

bool isDefNode(headerNode(global(_),_,_))

bool isDefNode(foreachAssignValue(_,_,_))

bool isDefNode(foreachAssignKey(_,_,_))

default bool isDefNode(CFGNode n)

function getNames

list[Name] getNames(Expr n)

function getNestedNames

set[Name] getNestedNames(CFGNode n, set[loc] locsToFilter)

function getDefInfo

rel[Name name, DefExpr definedAs, Lab definedAt] getDefInfo(CFGNode n)

function definitions

Defs definitions(CFG inputCFG)

function uses

Uses uses(CFG inputCFG, Defs defs)