Skip to content

Commit 18aeaaf

Browse files
committed
bug(#4559): refine XSL template to exclude positioned objects from auto-phi cleanup
1 parent 32c2eec commit 18aeaaf

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

eo-integration-tests/src/test/resources/org/eolang/snippets/auto-phi-with-application-precendence.yaml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,24 @@
33
---
44
# yamllint disable rule:line-length
55
out: []
6-
file: org/eolang/snippets/auto.eo
7-
args: ["org.eolang.snippets.auto"]
6+
file: org/eolang/snippets/foo.eo
7+
args: ["org.eolang.snippets.foo"]
88
eo: |
99
+alias org.eolang.io.stdout
10+
+alias org.eolang.txt.text
11+
+alias org.eolang.structs.list
1012
+package org.eolang.snippets
1113
12-
# No comments.
13-
[] > auto
14-
malloc.of > @
15-
8
16-
[m]
17-
while > @
18-
m.get.eq 42 >> [i]
19-
m.put 42 >> [i]
14+
[] > foo
15+
"abcdefghijk" > origin
16+
origin > @
17+
[cont-list] > custom-map
18+
mapped. > @
19+
cont-list
20+
(text orgn).contains x >> [x]
21+
origin > orgn!
22+
23+
[] +> test-custom-map
24+
eq. > @
25+
list (* true true)
26+
foo.custom-map (list (* "abc" "ghi"))

eo-parser/src/main/resources/org/eolang/parser/parse/auto-phi-formation-restruct.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@
6363
</xsl:copy>
6464
</xsl:template>
6565
<!-- Remove redundant ξ.X for void attributes, located inside the auto-phi formation -->
66-
<xsl:template match="o[starts-with(@base,'ξ.') and ancestor::o[contains(@name,'ap🌵')][descendant::o[@base='∅' and @name=substring-after(current()/@base,'ξ.')]]]"/>
66+
<xsl:template match="o[starts-with(@base,'ξ.') and not(@pos) and ancestor::o[contains(@name,'ap🌵')][descendant::o[@base='∅' and @name=substring-after(current()/@base,'ξ.')]]]"/>
6767
</xsl:stylesheet>

eo-parser/src/test/resources/org/eolang/parser/eo-syntax/auto-phi-formation-with-application-precedence.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ asserts:
88
- //o[not(@base) and @name='ap🌵34' and o[@name='φ' and @base='.ttt']/o[@base='.what']/o[@base='Φ.org.eolang.text']/o[@base='ξ.ρ.orgn']]
99
- //o[not(@base) and @name='ap🌵54' and o[@name='φ' and @base='.g']/o[@base='.e']/o[@base='.c']]
1010
- //o[not(@base) and @name='ap🌵86' and o[@name='φ' and @base='.contains']/o[@base='Φ.org.eolang.text']/o[@base='ξ.ρ.orgn']]
11+
- //o[not(@base) and @name='ap🌵86' and o[@name='φ' and @base='.contains']/o[@base='ξ.x']]
1112
input: |
1213
[cont-list] > custom-map
1314
foo > boom

0 commit comments

Comments
 (0)