Skip to content

Commit d5876f0

Browse files
committed
fix compilation failure
1 parent c201d52 commit d5876f0

20 files changed

+9654
-137
lines changed

example/icse25/rules/ecg.gdl

+191
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// script
22
use coref::java::*
3+
34
schema ECGNode extends ElementParent {}
45

56
impl ECGNode {
@@ -460,6 +461,196 @@ impl ECGNode {
460461
}
461462
}
462463

464+
pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode {
465+
for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) {
466+
if (type = "CD") {
467+
if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) {
468+
for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) {
469+
if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) {
470+
return e
471+
}
472+
}
473+
}
474+
}
475+
}
476+
}
477+
478+
pub fn getECGDependsNode(self, type: string, direction: string) -> ECGNode {
479+
for (e in ECGNode(__all_data__)) {
480+
if (e = self.getCDDependsNode(type, direction)) {
481+
return e
482+
}
483+
if (e = self.getDDDependsNode(type, direction)) {
484+
return e
485+
}
486+
}
487+
}
488+
489+
pub fn getCDDependsNode(self, type: string, direction: string) -> ECGNode {
490+
for (e in ECGNode(__all_data__),
491+
c in Callable(__all_data__),
492+
r in ReferenceExpression(__all_data__)) {
493+
if (self.key_eq(c)) {
494+
if (type = "CD") {
495+
for (e1 in c.getCallee()) {
496+
if (direction = "Depends") {
497+
if (e.key_eq(e1)) {
498+
return e
499+
}
500+
}
501+
}
502+
}
503+
}
504+
for (v in Variable(__all_data__)) {
505+
if (self.key_eq(v)) {
506+
if (v.key_eq(r.getDefinition())) {
507+
if (c = r.getEnclosingCallable()) {
508+
if (type = "CD") {
509+
for (e1 in c.getCallee()) {
510+
if (direction = "Depends") {
511+
if (e.key_eq(e1)) {
512+
return e
513+
}
514+
}
515+
}
516+
}
517+
}
518+
}
519+
}
520+
}
521+
}
522+
}
523+
524+
pub fn getDDDependsNode(self, type: string, direction: string) -> ECGNode {
525+
for (e1 in ECGNode(__all_data__)) {
526+
for (r in ReturnStatement(__all_data__),
527+
c in Method(__all_data__),
528+
e in Expression(__all_data__)) {
529+
if (e.key_eq(e1)) {
530+
if (self.key_eq(c)) {
531+
if (c.key_eq(r.getEnclosingCallable())) {
532+
if (e = r.getResult()) {
533+
if (direction = "Depends") {
534+
if (type = "DD") {
535+
return e1
536+
}
537+
}
538+
}
539+
}
540+
}
541+
}
542+
}
543+
for (e in Callable(__all_data__),
544+
c in Field(__all_data__),
545+
r in ReferenceExpression(__all_data__)) {
546+
if (e.key_eq(e1)) {
547+
if (self.key_eq(c)) {
548+
if (c.key_eq(r.getDefinition())) {
549+
if (e = r.getEnclosingCallable()) {
550+
if (direction = "Depends") {
551+
if (type = "DD") {
552+
return e1
553+
}
554+
}
555+
}
556+
}
557+
}
558+
}
559+
}
560+
for (e in Callable(__all_data__),
561+
c in EnumConstant(__all_data__),
562+
r in ReferenceExpression(__all_data__)) {
563+
if (e.key_eq(e1)) {
564+
if (self.key_eq(c)) {
565+
if (c.key_eq(r.getDefinition())) {
566+
if (e = r.getEnclosingCallable()) {
567+
if (direction = "Depends") {
568+
if (type = "DD") {
569+
return e1
570+
}
571+
}
572+
}
573+
}
574+
}
575+
}
576+
}
577+
for (n in string::__undetermined_all__()) {
578+
for (e in LombokField(__all_data__),
579+
c in CallExpression(__all_data__)) {
580+
if (e.key_eq(e1)) {
581+
if (self.key_eq(c)) {
582+
if (e = c.getLombokField()) {
583+
let (tmp = CallExpression(__all_data__).find(e)) {
584+
if (!isDirectCall(tmp)) {
585+
if (n = c.getMethodName()) {
586+
if (!n.matches("get.*")) {
587+
if (direction = "Depends") {
588+
if (type = "DD") {
589+
return e1
590+
}
591+
}
592+
}
593+
}
594+
}
595+
}
596+
}
597+
}
598+
}
599+
}
600+
}
601+
}
602+
}
603+
604+
pub fn getAnAncestorCDDependsNode(self, type: string, direction: string) -> ECGNode {
605+
for (e in ECGNode(__all_data__),
606+
c in Callable(__all_data__),
607+
r in ReferenceExpression(__all_data__)) {
608+
if (type = "CD") {
609+
if (self.key_eq(c)) {
610+
for (e1 in c.getAnAncestorCallee()) {
611+
if (direction = "Depends") {
612+
if (e.key_eq(e1)) {
613+
return e
614+
}
615+
}
616+
}
617+
}
618+
if (self.key_eq(r.getDefinition())) {
619+
if (c = r.getEnclosingCallable()) {
620+
for (e1 in c.getAnAncestorCallee()) {
621+
if (direction = "Depends") {
622+
if (e.key_eq(e1)) {
623+
return e
624+
}
625+
}
626+
}
627+
}
628+
}
629+
}
630+
}
631+
}
632+
633+
pub fn getPath(self) -> string {
634+
for (line in int::__undetermined_all__(),
635+
t in string::__undetermined_all__(),
636+
path in string::__undetermined_all__(),
637+
info in string::__undetermined_all__()) {
638+
for (l in coref::java::Location(__all_data__)) {
639+
if (l = self.getLocation()) {
640+
if (path = l.getFile().getRelativePath()) {
641+
if (line = l.getStartLineNumber()) {
642+
if (t = line.to_string()) {
643+
if (info = path + ":" + t) {
644+
return info
645+
}
646+
}
647+
}
648+
}
649+
}
650+
}
651+
}
652+
}
653+
463654
fn tmp_0(n: string) -> bool {
464655
if (n.matches("get.*")) {
465656
return true

example/icse25/rules/ecgxml.gdl

+36-5
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,6 @@ schema ECGXmlNode {
332332
}
333333

334334
impl ECGXmlNode {
335-
336-
@data_constraint
337-
@inline
338335
pub fn __all__(db: XmlDB) -> *ECGXmlNode {
339336
for (e in XmlPomElement(db)) {
340337
yield ECGXmlNode {id : e.id}
@@ -401,8 +398,42 @@ impl ECGXmlNode {
401398
}
402399
}
403400
}
404-
405-
401+
402+
pub fn getText(self) -> string {
403+
for (e in XmlElement(__all_data__)) {
404+
if (self.key_eq(e)) {
405+
return e.getName()
406+
}
407+
}
408+
for (e in XmlAttribute(__all_data__)) {
409+
if (self.key_eq(e)) {
410+
return e.getName() + " = " + e.getValue()
411+
}
412+
}
413+
for (e in XmlCharacter(__all_data__)) {
414+
if (self.key_eq(e)) {
415+
return e.getText()
416+
}
417+
}
418+
}
419+
420+
pub fn getEnclosingECGXmlNode(self) -> ECGXmlNode {
421+
for (e in XmlElement(__all_data__)) {
422+
if (self.key_eq(e)) {
423+
return e.to<ECGXmlNode>()
424+
}
425+
}
426+
for (e in XmlAttribute(__all_data__)) {
427+
if (self.key_eq(e)) {
428+
return e.getXmlElement().to<ECGXmlNode>()
429+
}
430+
}
431+
for (e in XmlCharacter(__all_data__)) {
432+
if (self.key_eq(e)) {
433+
return e.getBelongedElement().to<ECGXmlNode>()
434+
}
435+
}
436+
}
406437
}
407438

408439
pub fn gitdiff(filePath: string, lineNo: int) -> bool {

0 commit comments

Comments
 (0)