semantic: add Function semantic type, which is a special case of Type

Also define display in builtin context
This commit is contained in:
Antoine Viallon 2023-05-23 23:13:16 +02:00
parent 5252f772ed
commit 5b42c05eab
Signed by: aviallon
GPG key ID: D126B13AB555E16F

View file

@ -38,6 +38,10 @@ class Type(SymbolABC):
super().__init__(context, name, value)
class Function(Type):
pass
class Variable(SymbolABC):
@typecheck
def __init__(self, context: Context, name: str, value: nodes.Value | None = None, typedef: Type | None = None):
@ -160,5 +164,9 @@ class BuiltinContext(Context):
super().__init__(name="builtins", parent=None)
self.types = {
"__unknown": Type(self, "__unknown", "builtin"),
"__function": Function(self, "__function", "builtin"),
"uint32": Type(self, "uint32", "builtin")
}
self.variables = {
"display": Variable(self, "display", None, self.types["__function"])
}