summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwtschueller <wtschueller@users.noreply.github.com>2014-07-12 18:34:46 (GMT)
committerwtschueller <wtschueller@users.noreply.github.com>2014-07-12 18:34:46 (GMT)
commit470143192d0c8cf90ad84a66226d48060cc713db (patch)
treec6b8ab35c3a1d48b14a29e2f3fc395b8db5edb10
parent06bd53ac6acee5fb83d9f2b5ded1c55c8a069b29 (diff)
downloadDoxygen-470143192d0c8cf90ad84a66226d48060cc713db.zip
Doxygen-470143192d0c8cf90ad84a66226d48060cc713db.tar.gz
Doxygen-470143192d0c8cf90ad84a66226d48060cc713db.tar.bz2
Tcl: correct namespace resolution in case of INLINE_SOURCES = YES
-rw-r--r--src/tclscanner.l20
-rw-r--r--testing/062/namespacen1.xml42
-rw-r--r--testing/062/namespacen2.xml42
-rw-r--r--testing/062/namespacen3.xml42
-rw-r--r--testing/062_namespace_resolution.tcl68
5 files changed, 213 insertions, 1 deletions
diff --git a/src/tclscanner.l b/src/tclscanner.l
index 24c0a7b..e93152b 100644
--- a/src/tclscanner.l
+++ b/src/tclscanner.l
@@ -534,6 +534,24 @@ static void tcl_name(const QCString &ns0, const QCString &name0, QCString &ns, Q
}
}
+//! Check name. Strip namespace qualifiers from name0 if inside inlined code segment.
+// @return 'ns' and 'name' of given current 'ns0' and 'name0'
+static void tcl_name_SnippetAware(const QCString &ns0, const QCString &name0, QCString &ns, QCString &name)
+{
+ // If we are inside an inlined code snippet then ns0
+ // already containes the complete namespace path.
+ // Any namespace qualifiers in name0 are redundant.
+ int i = name0.findRev("::");
+ if (i>=0 && tcl.memberdef)
+ {
+ tcl_name(ns0, name0.mid(i+2), ns, name);
+ }
+ else
+ {
+ tcl_name(ns0, name0, ns, name);
+ }
+}
+
// Check and return namespace entry.
// @return namespace entry
Entry* tcl_entry_namespace(const QCString ns)
@@ -2099,7 +2117,7 @@ D
tcl_codify_cmd(NULL,3);
tcl_codify_cmd(NULL,4);
tcl_codify_cmd(NULL,5);
- tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName);
+ tcl_name_SnippetAware(myScan->ns,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName);
if (myNs.length())
{
myEntryNs = tcl_entry_namespace(myNs);
diff --git a/testing/062/namespacen1.xml b/testing/062/namespacen1.xml
new file mode 100644
index 0000000..0ef31ff
--- /dev/null
+++ b/testing/062/namespacen1.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="">
+ <compounddef id="namespacen1" kind="namespace">
+ <compoundname>n1</compoundname>
+ <innernamespace refid="namespacen1_1_1n1">n1::n1</innernamespace>
+ <sectiondef kind="func">
+ <memberdef kind="function" id="namespacen1_1a9f23d7a7f141915457e8e26023d70cb4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type/>
+ <definition>n1::p1</definition>
+ <argsstring>args</argsstring>
+ <name>p1</name>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="062_namespace_resolution.tcl" bodystart="12" bodyend="16"/>
+ <references refid="namespacen1_1a0bff29f718fa43e49b7ca79985afb5fa" compoundref="062__namespace__resolution_8tcl" startline="17" endline="20">p2</references>
+ </memberdef>
+ <memberdef kind="function" id="namespacen1_1a0bff29f718fa43e49b7ca79985afb5fa" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type/>
+ <definition>n1::p2</definition>
+ <argsstring>args</argsstring>
+ <name>p2</name>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="062_namespace_resolution.tcl" bodystart="17" bodyend="20"/>
+ <referencedby refid="namespacen1_1a9f23d7a7f141915457e8e26023d70cb4" compoundref="062__namespace__resolution_8tcl" startline="12" endline="16">p1</referencedby>
+ </memberdef>
+ </sectiondef>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <location file="062_namespace_resolution.tcl" line="11" column="1"/>
+ </compounddef>
+</doxygen>
diff --git a/testing/062/namespacen2.xml b/testing/062/namespacen2.xml
new file mode 100644
index 0000000..39c21d2
--- /dev/null
+++ b/testing/062/namespacen2.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="">
+ <compounddef id="namespacen2" kind="namespace">
+ <compoundname>n2</compoundname>
+ <innernamespace refid="namespacen2_1_1n2">n2::n2</innernamespace>
+ <sectiondef kind="func">
+ <memberdef kind="function" id="namespacen2_1a74950c0185232e374220a0707b4903c6" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type/>
+ <definition>n2::p1</definition>
+ <argsstring>args</argsstring>
+ <name>p1</name>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="062_namespace_resolution.tcl" bodystart="31" bodyend="35"/>
+ <references refid="namespacen2_1a49fadfbefa795204a3c566ec76ff632f" compoundref="062__namespace__resolution_8tcl" startline="36" endline="39">p2</references>
+ </memberdef>
+ <memberdef kind="function" id="namespacen2_1a49fadfbefa795204a3c566ec76ff632f" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type/>
+ <definition>n2::p2</definition>
+ <argsstring>args</argsstring>
+ <name>p2</name>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="062_namespace_resolution.tcl" bodystart="36" bodyend="39"/>
+ <referencedby refid="namespacen2_1a74950c0185232e374220a0707b4903c6" compoundref="062__namespace__resolution_8tcl" startline="31" endline="35">p1</referencedby>
+ </memberdef>
+ </sectiondef>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <location file="062_namespace_resolution.tcl" line="29" column="1"/>
+ </compounddef>
+</doxygen>
diff --git a/testing/062/namespacen3.xml b/testing/062/namespacen3.xml
new file mode 100644
index 0000000..25c803c
--- /dev/null
+++ b/testing/062/namespacen3.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="">
+ <compounddef id="namespacen3" kind="namespace">
+ <compoundname>n3</compoundname>
+ <innernamespace refid="namespacen3_1_1n3">n3::n3</innernamespace>
+ <sectiondef kind="func">
+ <memberdef kind="function" id="namespacen3_1ae7e87e49507bd56dad087cffecd35b29" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type/>
+ <definition>n3::p1</definition>
+ <argsstring>args</argsstring>
+ <name>p1</name>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="062_namespace_resolution.tcl" bodystart="47" bodyend="51"/>
+ <references refid="namespacen3_1a14e9fe1b27a6d36db9ace2eef4509979" compoundref="062__namespace__resolution_8tcl" startline="52" endline="55">p2</references>
+ </memberdef>
+ <memberdef kind="function" id="namespacen3_1a14e9fe1b27a6d36db9ace2eef4509979" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type/>
+ <definition>n3::p2</definition>
+ <argsstring>args</argsstring>
+ <name>p2</name>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="062_namespace_resolution.tcl" bodystart="52" bodyend="55"/>
+ <referencedby refid="namespacen3_1ae7e87e49507bd56dad087cffecd35b29" compoundref="062__namespace__resolution_8tcl" startline="47" endline="51">p1</referencedby>
+ </memberdef>
+ </sectiondef>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <location file="062_namespace_resolution.tcl" line="45" column="1"/>
+ </compounddef>
+</doxygen>
diff --git a/testing/062_namespace_resolution.tcl b/testing/062_namespace_resolution.tcl
new file mode 100644
index 0000000..dcc6701
--- /dev/null
+++ b/testing/062_namespace_resolution.tcl
@@ -0,0 +1,68 @@
+#// objective: tests correct namespace resolution, only references/referencedby relations are relevant
+#// check: namespacen1.xml
+#// check: namespacen2.xml
+#// check: namespacen3.xml
+#// config: REFERENCED_BY_RELATION = yes
+#// config: REFERENCES_RELATION = yes
+#// config: EXTRACT_ALL = yes
+#// config: INLINE_SOURCES = yes
+
+# now: combine namespace eval and qualified names
+namespace eval n1 {
+ proc p1 args {
+ array set info [info frame 0]; puts -nonewline ->$info(proc)
+ p2
+ return
+ }
+ proc p2 args {
+ array set info [info frame 0]; puts -nonewline ->$info(proc)
+ return
+ }
+ namespace eval n1 {
+ proc p1 args {
+ array set info [info frame 0]; puts -nonewline ->$info(proc)
+ return
+ }
+ }
+}
+# same thing, but fully qualified proc names
+namespace eval ::n2 {}
+namespace eval ::n2::n2 {}
+proc ::n2::p1 args {
+ array set info [info frame 0]; puts -nonewline ->$info(proc)
+ p2
+ return
+}
+proc ::n2::p2 args {
+ array set info [info frame 0]; puts -nonewline ->$info(proc)
+ return
+}
+proc ::n2::n2::p2 args {
+ array set info [info frame 0]; puts -nonewline ->$info(proc)
+ return
+}
+# same thing, without leading ::
+namespace eval n3 {}
+namespace eval n3::n3 {}
+proc n3::p1 args {
+ array set info [info frame 0]; puts -nonewline ->$info(proc)
+ p2
+ return
+}
+proc n3::p2 args {
+ array set info [info frame 0]; puts -nonewline ->$info(proc)
+ return
+}
+proc n3::n3::p2 args {
+ array set info [info frame 0]; puts -nonewline ->$info(proc)
+ return
+}
+# now, check with tcl what is called
+n1::p1
+puts ""
+n2::p1
+puts ""
+n3::p1
+puts ""
+exit
+