Skip to main content

module lang::php::analysis::evaluators::DefinedConstants

rascal-0.40.17
php-analysis-0.2.4

Usage

import lang::php::analysis::evaluators::DefinedConstants;

Source code

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

Dependencies

import lang::php::ast::AbstractSyntax;
import lang::php::analysis::signatures::Signatures;
import lang::php::analysis::includes::IncludeGraph;
import lang::php::ast::System;
import lang::php::analysis::NamePaths;
import Set;
import List;
import Map;

data ConstItem

data ConstItem  
= normalConst(str constName)
| classConst(str className, str constName)
;

data ConstItemExp

data ConstItemExp  
= normalConst(str constName, Expr e)
| classConst(str className, str constName, Expr e)
;

function evalConsts

Script evalConsts(loc scriptLoc, Script scr, ConstInfo cinfo, set[IncludeGraphNode] reachable, map[loc,Signature] sigs)

Evaluate any constants, replacing them with their assigned value in cases where this assigned value is itself a literal.

function getScriptConstUses

set[ConstItem] getScriptConstUses(Script scr)

function getScriptConstDefs

set[ConstItemExp] getScriptConstDefs(Script scr)

function getSignatureConsts

set[ConstItemExp] getSignatureConsts(Signature sig)

data ConstInfo

data ConstInfo  
= constInfo(
map[loc,set[ConstItemExp]] systemConstDefs,
map[str constName, set[loc] defLocs] constDefLocs,
map[str className, map[str constName, set[loc] defLocs] clLocs] classConstDefLocs,
map[str constName, map[loc defLoc,set[Expr] defExprs] defLocMap] constDefExprs,
map[str className, map[str constName, map[loc defLoc,set[Expr] defExprs] defLocMap] clLocs] classConstDefExprs,
map[loc,set[ConstItem]] systemConstUses,
map[str constName, set[loc] useLocs] constUses,
map[str className, map[str constName, set[loc] useLocs] clLocs] classConstUses,
map[str, Expr] constMap,
map[str, map[str, Expr]] classConstMap)
;

function getConstInfo

ConstInfo getConstInfo(System sys)

function getSystemConstUses

map[loc,set[ConstItem]] getSystemConstUses(System sys)

function getConstUseLocs

map[str constName, set[loc] useLocs] getConstUseLocs(map[loc,set[ConstItem]] constUses)

function getClassConstUseLocs

map[str className, map[str constName, set[loc] useLocs] clLocs] getClassConstUseLocs(map[loc,set[ConstItem]] constUses)

function getConstDefLocs

map[str constName, set[loc] defLocs] getConstDefLocs(map[loc,set[ConstItemExp]] constDefs)

function getConstDefExprs

map[str constName, map[loc defLoc,set[Expr] defExprs] defLocMap] getConstDefExprs(map[loc,set[ConstItemExp]] constDefs)

function getClassConstDefLocs

map[str className, map[str constName, set[loc] defLocs] clLocs] getClassConstDefLocs(map[loc,set[ConstItemExp]] constDefs)

function getClassConstDefExprs

map[str className, map[str constName, map[loc defLoc,set[Expr] defLocs] defLocMap] clLocs] getClassConstDefExprs(map[loc,set[ConstItemExp]] constDefs)

function getSystemConstDefs

map[loc,set[ConstItemExp]] getSystemConstDefs(map[loc,Signature] sigs)