semantic: add Function semantic type, which is a special case of Type
Also define display in builtin context
This commit is contained in:
parent
5252f772ed
commit
5b42c05eab
1 changed files with 8 additions and 0 deletions
|
|
@ -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"])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue