Kaydet (Commit) a37c6614 authored tarafından Miklos Vajna's avatar Miklos Vajna

writerfilter: prevent introducing new references to non-existing defines

f77981e3 fixed the last such problem,
let's not introduce those again.

Change-Id: I8f193b7e234242b5c283d04ca20f83ee901dfbed
üst e16cc171
......@@ -57,6 +57,13 @@ def defaultNamespaceAliases():
}
def check(model):
defines = [i.getAttribute("name") for i in model.getElementsByTagName("define")]
for reference in [i.getAttribute("name") for i in model.getElementsByTagName("ref")]:
if not reference in defines:
raise Exception("Unknown define with name '%s'" % reference)
def preprocess(model):
for i in model.getElementsByTagName("namespace-alias"):
name = i.getAttribute("name")
......@@ -163,6 +170,7 @@ parseNamespaces(namespacesPath)
# URL -> alias
namespaceAliases = {}
model = minidom.parse(modelPath)
check(model)
preprocess(model)
model.writexml(sys.stdout)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment