mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Reduce errors when a namespace is not found
When the typelib for a namespace is not found, don't emit "namespace not imported" errors. Just emit the one error on the import statement.
This commit is contained in:
parent
402677f687
commit
bc605c5df8
6 changed files with 20 additions and 1 deletions
|
@ -76,6 +76,14 @@ class Import(AstNode):
|
|||
UseNumberText("version").expected("a version number"),
|
||||
)
|
||||
|
||||
@property
|
||||
def namespace(self):
|
||||
return self.tokens["namespace"]
|
||||
|
||||
@property
|
||||
def version(self):
|
||||
return self.tokens["version"]
|
||||
|
||||
@validate("namespace", "version")
|
||||
def namespace_exists(self):
|
||||
gir.get_namespace(self.tokens["namespace"], self.tokens["version"])
|
||||
|
|
|
@ -58,6 +58,8 @@ class UI(AstNode):
|
|||
try:
|
||||
if i.gir_namespace is not None:
|
||||
gir_ctx.add_namespace(i.gir_namespace)
|
||||
else:
|
||||
gir_ctx.not_found_namespaces.add(i.namespace)
|
||||
except CompileError as e:
|
||||
e.start = i.group.tokens["namespace"].start
|
||||
e.end = i.group.tokens["version"].end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue