Skip to content

Commit bded25a

Browse files
committed
Updated to match AST datatype changes
1 parent 8ea9ffa commit bded25a

File tree

13 files changed

+38
-41
lines changed

13 files changed

+38
-41
lines changed

src/main/rascal/lang/php/analysis/callgraph/SimpleCG.rsc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1313
module lang::php::analysis::callgraph::SimpleCG
1414

1515
import lang::php::ast::AbstractSyntax;
16-
import lang::php::analysis::NamePaths;
1716
import lang::php::analysis::signatures::Summaries;
1817
import lang::php::analysis::signatures::Signatures;
1918
import lang::php::ast::System;

src/main/rascal/lang/php/analysis/cfg/BasicBlocks.rsc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ module lang::php::analysis::cfg::BasicBlocks
1515

1616
import lang::php::analysis::cfg::CFG;
1717
import lang::php::analysis::cfg::FlowEdge;
18-
import lang::php::analysis::cfg::Label;
1918
import lang::php::analysis::NamePaths;
2019

2120
import Relation;

src/main/rascal/lang/php/analysis/cfg/BuildCFG.rsc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ private tuple[CFG methodCFG, LabelState lstate] createMethodCFG(loc np, ClassIte
221221
// Add initial nodes to represent initializing parameters with default values,
222222
// plus add flow edges between these default initializers
223223
list[CFGNode] paramNodes = [ ];
224-
for (param(paramName,paramDefault,byRef,_,_,_,_) <- m.params) {
224+
for (param(paramName,paramDefault,byRef,_,_,_,_,_) <- m.params) {
225225
newLabel = incLabel();
226226
newNode = (someExpr(e) := paramDefault)
227227
? actualNotProvided(paramName, e, byRef, newLabel)[lab=newLabel]
@@ -309,7 +309,7 @@ private tuple[CFG functionCFG, LabelState lstate] createFunctionCFG(loc np, Stmt
309309
// Add initial nodes to represent initializing parameters with default values,
310310
// plus add flow edges between these default initializers
311311
list[CFGNode] paramNodes = [ ];
312-
for (param(paramName,paramDefault,byRef,_,_,_,_) <- f.params) {
312+
for (param(paramName,paramDefault,byRef,_,_,_,_,_) <- f.params) {
313313
newLabel = incLabel();
314314
newNode = (someExpr(e) := paramDefault)
315315
? actualNotProvided(paramName, e, byRef, newLabel)[lab=newLabel]
@@ -376,7 +376,7 @@ public set[Lab] init(Stmt s, LabelState lstate) {
376376
377377
// Given a list of constants, the first thing that occurs is the expression that is
378378
// assigned to the first constant in the list.
379-
case const(list[Const] consts) : {
379+
case const(list[Const] consts, _) : {
380380
return init(head(consts).constValue, lstate);
381381
}
382382
@@ -668,7 +668,7 @@ private set[Lab] final(Stmt s, LabelState lstate) {
668668
}
669669
670670
// We always have at least one const; the final const provides the labels.
671-
case const(list[Const] consts) : {
671+
case const(list[Const] consts, _) : {
672672
return final(last(consts).constValue, lstate);
673673
}
674674
@@ -968,7 +968,7 @@ public tuple[FlowEdges,LabelState] internalFlow(Stmt s, LabelState lstate) {
968968
// For consts, we add the edges internal to each const expression, plus we link up
969969
// the expressions. The final labels are already the final labels for the last
970970
// const initializer expression, so we don't need to further link those up here.
971-
case const(list[Const] consts) : {
971+
case const(list[Const] consts, _) : {
972972
vals = [ c.constValue | c <- consts ];
973973
for (v <- vals) < edges, lstate > = addExpEdges(edges, lstate, v);
974974
< edges, lstate > = addExpSeqEdges(edges, lstate, vals);

src/main/rascal/lang/php/analysis/cfg/Label.rsc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1313
@contributor{Mark Hills - [email protected] (CWI)}
1414
module lang::php::analysis::cfg::Label
1515

16-
import lang::php::ast::AbstractSyntax;
17-
1816
@doc{Labels are added to expressions and statements to give us a
1917
shorthand to refer to the various statements, expressions, and
2018
sub-statements/sub-expressions in the code.}

src/main/rascal/lang/php/analysis/composer/Composer.rsc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,10 @@ public Composer loadComposerFile(loc l, bool justPublishedPackages = false) {
233233
if ("authors" in js) {
234234
if (list[node] ats := js["authors"]) {
235235
for (atr <- ats) {
236-
authName = if(atr has name, str s := atr.name) just(s); else nothing();
237-
authEmail = if(atr has email, str s := atr.email) just(s); else nothing();
238-
authHomepage = if (atr has homepage, str s := atr.homepage) just(s); else nothing();
239-
authRole = if (atr has role, str s := atr.role) just(s); else nothing();
236+
authName = (atr has name && str s := atr.name) ? just(s) : nothing();
237+
authEmail = (atr has email && str s := atr.email) ? just(s) : nothing();
238+
authHomepage = (atr has homepage && str s := atr.homepage) ? just(s) : nothing();
239+
authRole = (atr has role && str s := atr.role) ? just(s) : nothing();
240240
authors = authors + author(authName, authEmail, authHomepage, authRole);
241241
}
242242
} else {

src/main/rascal/lang/php/analysis/composer/ComposerAnalysis.rsc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public void dependencyCounts(loc l, rel[str owner, str repo, Composer cinfo] com
176176
177177
map[str,int] dependencyCounts = ( );
178178
179-
for (<owner, repo, cinfo> <- composerInfo, cinfo is composer) {
179+
for (<_, _, cinfo> <- composerInfo, cinfo is composer) {
180180
for ( < vendorName, projectName, _ > <- cinfo.packageDependencies[dependencyType] ) {
181181
dependencyName = "<vendorName>/<projectName>";
182182
if (dependencyName in dependencyCounts) {
@@ -221,7 +221,7 @@ public lrel[str constraintType, PackageVersionConstraint constraint] fetchConstr
221221
222222
// Second, fill the list with all the constraints. We track the dependency type too, but we
223223
// skip suggest dependencies since these are just textual, there are no constraints.
224-
for (< owner, repo, cinfo > <- composerInfo, cinfo is composer) {
224+
for (< _, _, cinfo > <- composerInfo, cinfo is composer) {
225225
for ( < dependencyType, _, _, constraint > <- cinfo.packageDependencies, dependencyType != "suggest") {
226226
constraintList = constraintList + < dependencyType, constraint >;
227227
}

src/main/rascal/lang/php/analysis/composer/VersionSyntax.rsc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private PackageVersionConstraint parseWildcardConstraint(WildcardConstraint wc)
127127
public PackageVersionConstraint parseConstraint(str constraintText) {
128128
try {
129129
return parseConstraint(parse(#VersionConstraint, constraintText));
130-
} catch ParseError(loc l): {
130+
} catch ParseError(loc _): {
131131
return rawConstraint(constraintText);
132132
}
133133
}

src/main/rascal/lang/php/analysis/evaluators/DefinedConstants.rsc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ public set[ConstItem] getScriptConstUses(Script scr) {
107107
}
108108
109109
public set[ConstItemExp] getScriptConstDefs(Script scr) =
110-
{ classConst(cln, cn, ce) | /class(cln,_,_,_,cis,_) := scr, classConst(consts,_,_) <- cis, const(cn,ce) <- consts } + // TODO: Do we need to worry about const modifiers?
110+
{ classConst(cln, cn, ce) | /class(cln,_,_,_,cis,_) := scr, ClassItem::classConst(consts,_,_,_) <- cis, const(cn,ce) <- consts } + // TODO: Do we need to worry about const modifiers?
111111
{ normalConst(cn, ce) | /call(name(name("define")),[actualParameter(scalar(string(cn)),false,false,_),actualParameter(ce,false,false,_)]) := scr } +
112-
{ normalConst(cn, ce) | /Stmt::const(cl) := scr, Const::const(cn,ce) <- cl };
112+
{ normalConst(cn, ce) | /Stmt::const(cl, _) := scr, Const::const(cn,ce) <- cl };
113113
114114
public set[ConstItemExp] getSignatureConsts(Signature sig) {
115115
set[ConstItemExp] res = { };

src/main/rascal/lang/php/analysis/signatures/Signatures.rsc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public Signature getFileSignature(loc fileloc, Script scr, bool buildInfo=false)
5656
}
5757
}
5858
}
59-
for(classConst(consts,_,_) <- cis, const(cn,ce) <- consts) {
59+
for(classConst(consts,_,_,_) <- cis, const(cn,ce) <- consts) {
6060
items += classConstSig(classConstPath(cln, cn), ce);
6161
}
6262
}
@@ -92,7 +92,7 @@ public Signature getFileSignature(loc fileloc, Script scr, bool buildInfo=false)
9292
9393
public Signature getScriptConstants(loc fileloc, Script scr) {
9494
set[SignatureItem] items =
95-
{ classConstSig(classConstPath(cln, cn), ce) | /class(cln,_,_,_,cis,_) := scr, classConst(consts,_,_) <- cis, const(cn,ce) <- consts } +
95+
{ classConstSig(classConstPath(cln, cn), ce) | /class(cln,_,_,_,cis,_) := scr, classConst(consts,_,_,_) <- cis, const(cn,ce) <- consts } +
9696
{ constSig(constPath(cn),e) | /call(name(name("define")),[actualParameter(scalar(string(cn)),false,false,_),actualParameter(e,false,false,_)]) := scr };
9797
return fileSignature(fileloc, items);
9898
}

src/main/rascal/lang/php/ast/NormalizeAST.rsc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ public Script addPublicModifierWhenNotProvided(Script s) {
260260

261261
solve(s) {
262262
s = visit(s) {
263-
case origNode:property(set[Modifier] mfs, prop, ptype, pattrs) =>
264-
setAnnotations( property(mfs + publicModifier, prop, ptype, pattrs), getAnnotations(origNode))
263+
case origNode:property(set[Modifier] mfs, prop, ptype, pattrs, phooks) =>
264+
setAnnotations( property(mfs + publicModifier, prop, ptype, pattrs, phooks), getAnnotations(origNode))
265265
when \public() notin mfs && \private() notin mfs && \protected() notin mfs
266266

267267
case origNode:method(str mname, set[Modifier] mfs, byRef, params, body, rtype, mattrs) =>

0 commit comments

Comments
 (0)