Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <gerwitzm@lovullo.com>2017-07-12 14:26:30 -0400
committerMike Gerwitz <gerwitzm@lovullo.com>2017-07-12 14:32:33 -0400
commit52c1bb5ebe732582606116342730e76aaaba0c55 (patch)
treec20c0102f8f666c5935cbe1a805effa4808a6c52 /src/current/include/preproc/symtable.xsl
parent7472cb882c0b2d13d7d8304b805e0a19c7cc38e4 (diff)
downloadtame-52c1bb5ebe732582606116342730e76aaaba0c55.tar.gz
tame-52c1bb5ebe732582606116342730e76aaaba0c55.tar.bz2
tame-52c1bb5ebe732582606116342730e76aaaba0c55.zip
Properly resolve paths of symbols of imports
This solves a long-standing problem whereby relative paths are not properly resolved, leading to incorrect symbol conflicts when relative paths to the same package vary between two imports. See doc/notes/path-processing for an illustration. * src/current/include/preproc/path.xsl (preproc:resolve-relative-import): Add function. (preproc:resolv-path, preproc:resolve-path, preproc:get-path): Add functions to invoke existing templates. * src/current/include/preproc/symtable.xsl (preproc:symimport): Use `preproc:resolve-relative-import'. * doc/notes/path-processing: Add notes.
Diffstat (limited to 'src/current/include/preproc/symtable.xsl')
-rw-r--r--src/current/include/preproc/symtable.xsl40
1 files changed, 13 insertions, 27 deletions
diff --git a/src/current/include/preproc/symtable.xsl b/src/current/include/preproc/symtable.xsl
index 2cf726c..e9a7c61 100644
--- a/src/current/include/preproc/symtable.xsl
+++ b/src/current/include/preproc/symtable.xsl
@@ -521,12 +521,18 @@
<xsl:param name="no-extclass" select="@no-extclass" />
<xsl:param name="keep-classes" select="@keep-classes" />
- <xsl:variable name="path" select="concat( $package, '.xmlo' )" />
+ <xsl:variable name="path" as="xs:string"
+ select="concat( $package, '.xmlo' )" />
<xsl:variable name="syms"
- select="document( $path, $orig-root )/lv:*/preproc:symtable" />
+ select="document( $path, $orig-root )/lv:*/preproc:symtable" />
<xsl:variable name="import-path" select="$package" />
+ <xsl:variable name="src-root" as="xs:string"
+ select="ancestor::lv:package/@__rootpath" />
+ <xsl:variable name="src-name" as="xs:string"
+ select="ancestor::lv:package/@name" />
+
<!-- if they're including a program package, do they realize what they're
doing!? -->
<!-- FIXME: @allow-nonpkg is no longer accurate terminology; change to
@@ -542,14 +548,6 @@
</xsl:message>
</xsl:if>
- <!-- determine our path from our name -->
- <xsl:variable name="our-path">
- <xsl:call-template name="preproc:get-path">
- <xsl:with-param name="path"
- select="ancestor::lv:package/@name" />
- </xsl:call-template>
- </xsl:variable>
-
<!-- to keep everything consistent and to simplify package equality
assertions, resolve relative paths -->
<xsl:variable name="import-default-path" select="$import-path" />
@@ -626,23 +624,11 @@
itself) onto the existing relative path and resolving relative
paths -->
<xsl:otherwise>
- <xsl:call-template name="preproc:resolv-path">
- <xsl:with-param name="path">
- <!-- get the path of the import, sans package name -->
- <xsl:variable name="path">
- <xsl:call-template name="preproc:get-path">
- <xsl:with-param name="path" select="$import-path" />
- </xsl:call-template>
- </xsl:variable>
-
- <!-- concatenate it with the existing relative path -->
- <xsl:if test="not( $path = '' )">
- <xsl:value-of select="concat( $path, '/' )" />
- </xsl:if>
-
- <xsl:value-of select="@src" />
- </xsl:with-param>
- </xsl:call-template>
+ <xsl:sequence select="preproc:resolve-relative-import(
+ $src-root,
+ $src-name,
+ $import-path,
+ @src )" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>