aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-03-03 20:10:52 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-03-03 20:10:52 +0200
commit3717fce14ff732658d542c13890b226c8367e272 (patch)
treefea72a29626249bdf2961ae7ce0fb15891ad41cd
parente4f4f0bed9befbde2117af6f128d9323be3f1638 (diff)
Resolve anonymous bases in the multi-schema compilation
Also, resolve anonymous specialization arguments (list and union).
-rw-r--r--tests/schema/union/makefile2
-rw-r--r--tests/schema/union/test-001.std15
-rw-r--r--tests/schema/union/test-001.xsd21
-rw-r--r--xsd-frontend/parser.cxx28
4 files changed, 65 insertions, 1 deletions
diff --git a/tests/schema/union/makefile b/tests/schema/union/makefile
index 498c3cc..7f01070 100644
--- a/tests/schema/union/makefile
+++ b/tests/schema/union/makefile
@@ -5,7 +5,7 @@
include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
-tests := 000
+tests := 000 001
driver := $(out_root)/tests/dump/driver
test := $(out_base)/.test
diff --git a/tests/schema/union/test-001.std b/tests/schema/union/test-001.std
new file mode 100644
index 0000000..f407b30
--- /dev/null
+++ b/tests/schema/union/test-001.std
@@ -0,0 +1,15 @@
+primary
+{
+ namespace test
+ {
+ list list
+ {
+ union <anonymous> http://www.w3.org/2001/XMLSchema#int test#enum
+ }
+ enumeration enum: http://www.w3.org/2001/XMLSchema#string
+ {
+ enumerator male
+ enumerator female
+ }
+ }
+}
diff --git a/tests/schema/union/test-001.xsd b/tests/schema/union/test-001.xsd
new file mode 100644
index 0000000..00fd8ce
--- /dev/null
+++ b/tests/schema/union/test-001.xsd
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- Test resolution of anonymous argument types. -->
+
+ <simpleType name="list">
+ <list>
+ <simpleType>
+ <union memberTypes="int t:enum"/>
+ </simpleType>
+ </list>
+ </simpleType>
+
+ <simpleType name="enum">
+ <restriction base="string">
+ <enumeration value="male"/>
+ <enumeration value="female"/>
+ </restriction>
+ </simpleType>
+
+</schema>
diff --git a/xsd-frontend/parser.cxx b/xsd-frontend/parser.cxx
index d40cda2..b9c76d2 100644
--- a/xsd-frontend/parser.cxx
+++ b/xsd-frontend/parser.cxx
@@ -599,6 +599,8 @@ namespace XSDFrontend
valid_ = false;
}
}
+
+ Traversal::List::traverse (l);
}
Void
@@ -638,6 +640,8 @@ namespace XSDFrontend
u.context ().remove ("union-member-types");
}
+
+ Traversal::Union::traverse (u);
}
Void
@@ -1979,9 +1983,11 @@ namespace XSDFrontend
Traversal::Names names;
Traversal::Inherits inherits;
+ Traversal::Argumented argumented;
resolver >> names >> resolver;
names >> anonymous_member;
resolver >> inherits >> anonymous_base;
+ resolver >> argumented >> anonymous_base;
if (trace_)
wcout << "starting resolution pass" << endl;
@@ -2201,12 +2207,34 @@ namespace XSDFrontend
Traversal::Belongs belongs_;
} anonymous_member (resolver);
+ struct AnonymousBase: Traversal::Type
+ {
+ AnonymousBase (Traversal::NodeDispatcherBase& d)
+ : base_ (d)
+ {
+ }
+
+ virtual Void
+ traverse (SemanticGraph::Type& t)
+ {
+ if (!t.named ())
+ base_.dispatch (t);
+ }
+
+ private:
+ Traversal::NodeDispatcherBase& base_;
+ } anonymous_base (resolver);
+
ns_names >> resolver;
ns_names >> anonymous_member;
Traversal::Names names;
+ Traversal::Inherits inherits;
+ Traversal::Argumented argumented;
resolver >> names >> resolver;
names >> anonymous_member;
+ resolver >> inherits >> anonymous_base;
+ resolver >> argumented >> anonymous_base;
if (trace_)
wcout << "starting resolution pass" << endl;