mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Add warning for confusing object IDs
This commit is contained in:
parent
77dc9350e9
commit
43fbf8cf8e
2 changed files with 14 additions and 0 deletions
|
@ -23,6 +23,7 @@ from blueprintcompiler.language.values import StringValue
|
|||
|
||||
from .common import *
|
||||
from .contexts import ValueTypeCtx
|
||||
from .gobject_object import RESERVED_IDS
|
||||
|
||||
|
||||
class Menu(AstNode):
|
||||
|
@ -47,6 +48,11 @@ class Menu(AstNode):
|
|||
if self.tokens["tag"] == "menu" and self.tokens["id"] is None:
|
||||
raise CompileError("Menu requires an ID")
|
||||
|
||||
@validate("id")
|
||||
def object_id_not_reserved(self):
|
||||
if self.id in RESERVED_IDS:
|
||||
raise CompileWarning(f"{self.id} may be a confusing object ID")
|
||||
|
||||
|
||||
class MenuAttribute(AstNode):
|
||||
tag_name = "attribute"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue