Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expr typeinfo #1278

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions jac/jaclang/compiler/absyntree.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ def __init__(self) -> None:
class Expr(AstNode):
"""Expr node type for Jac Ast."""

def __init__(self) -> None:
"""Initialize expression node."""
self.expr_type = ""


class AtomExpr(Expr, AstSymbolStubNode):
"""AtomExpr node type for Jac Ast."""
Expand Down Expand Up @@ -437,6 +441,7 @@ def __init__(self) -> None:
self._py_ctx_func: Type[ast3.AST] = ast3.Load
self._sym_type: str = "NoType"
self._type_sym_tab: Optional[SymbolTable] = None
AtomExpr.__init__(self)

@property
def sym(self) -> Optional[Symbol]:
Expand Down Expand Up @@ -2527,6 +2532,7 @@ def __init__(
"""Initialize sync statement node."""
self.target = target
AstNode.__init__(self, kid=kid)
Expr.__init__(self)

def normalize(self, deep: bool = False) -> bool:
"""Normalize sync statement node."""
Expand Down Expand Up @@ -2655,6 +2661,7 @@ def __init__(
self.right = right
self.op = op
AstNode.__init__(self, kid=kid)
Expr.__init__(self)

def normalize(self, deep: bool = False) -> bool:
"""Normalize ast node."""
Expand Down Expand Up @@ -2689,6 +2696,7 @@ def __init__(
self.rights = rights
self.ops = ops
AstNode.__init__(self, kid=kid)
Expr.__init__(self)

def normalize(self, deep: bool = False) -> bool:
"""Normalize ast node."""
Expand Down Expand Up @@ -2720,6 +2728,7 @@ def __init__(
self.values = values
self.op = op
AstNode.__init__(self, kid=kid)
Expr.__init__(self)

def normalize(self, deep: bool = False) -> bool:
"""Normalize ast node."""
Expand Down Expand Up @@ -2750,6 +2759,7 @@ def __init__(
self.signature = signature
self.body = body
AstNode.__init__(self, kid=kid)
Expr.__init__(self)

def normalize(self, deep: bool = False) -> bool:
"""Normalize ast node."""
Expand Down Expand Up @@ -2782,6 +2792,7 @@ def __init__(
self.operand = operand
self.op = op
AstNode.__init__(self, kid=kid)
Expr.__init__(self)

def normalize(self, deep: bool = False) -> bool:
"""Normalize ast node."""
Expand Down Expand Up @@ -2809,6 +2820,7 @@ def __init__(
self.value = value
self.else_value = else_value
AstNode.__init__(self, kid=kid)
Expr.__init__(self)

def normalize(self, deep: bool = False) -> bool:
"""Normalize ast node."""
Expand Down Expand Up @@ -2839,6 +2851,7 @@ def __init__(
"""Initialize multi string expression node."""
self.strings = strings
AstNode.__init__(self, kid=kid)
Expr.__init__(self)
AstSymbolStubNode.__init__(self, sym_type=SymbolType.STRING)

def normalize(self, deep: bool = False) -> bool:
Expand All @@ -2865,6 +2878,7 @@ def __init__(
"""Initialize fstring expression node."""
self.parts = parts
AstNode.__init__(self, kid=kid)
Expr.__init__(self)
AstSymbolStubNode.__init__(self, sym_type=SymbolType.STRING)

def normalize(self, deep: bool = False) -> bool:
Expand Down Expand Up @@ -2895,6 +2909,7 @@ def __init__(
"""Initialize value node."""
self.values = values
AstNode.__init__(self, kid=kid)
Expr.__init__(self)
AstSymbolStubNode.__init__(self, sym_type=SymbolType.SEQUENCE)

def normalize(self, deep: bool = False) -> bool:
Expand Down Expand Up @@ -2923,6 +2938,7 @@ def __init__(
"""Initialize value node."""
self.values = values
AstNode.__init__(self, kid=kid)
Expr.__init__(self)
AstSymbolStubNode.__init__(self, sym_type=SymbolType.SEQUENCE)

def normalize(self, deep: bool = False) -> bool:
Expand Down Expand Up @@ -2951,6 +2967,7 @@ def __init__(
"""Initialize tuple value node."""
self.values = values
AstNode.__init__(self, kid=kid)
Expr.__init__(self)
AstSymbolStubNode.__init__(self, sym_type=SymbolType.SEQUENCE)

def normalize(self, deep: bool = False) -> bool:
Expand Down Expand Up @@ -2994,6 +3011,7 @@ def __init__(
"""Initialize dict expression node."""
self.kv_pairs = kv_pairs
AstNode.__init__(self, kid=kid)
Expr.__init__(self)
AstSymbolStubNode.__init__(self, sym_type=SymbolType.SEQUENCE)

def normalize(self, deep: bool = False) -> bool:
Expand Down Expand Up @@ -3127,6 +3145,7 @@ def __init__(
self.out_expr = out_expr
self.compr = compr
AstNode.__init__(self, kid=kid)
Expr.__init__(self)
AstSymbolStubNode.__init__(self, sym_type=SymbolType.SEQUENCE)

def normalize(self, deep: bool = False) -> bool:
Expand Down Expand Up @@ -3202,6 +3221,7 @@ def __init__(
self.kv_pair = kv_pair
self.compr = compr
AstNode.__init__(self, kid=kid)
Expr.__init__(self)
AstSymbolStubNode.__init__(self, sym_type=SymbolType.SEQUENCE)

def normalize(self, deep: bool = False) -> bool:
Expand Down Expand Up @@ -3240,6 +3260,7 @@ def __init__(
self.is_null_ok = is_null_ok
self.is_genai = is_genai
AstNode.__init__(self, kid=kid)
Expr.__init__(self)

def normalize(self, deep: bool = True) -> bool:
"""Normalize ast node."""
Expand Down Expand Up @@ -3285,6 +3306,7 @@ def __init__(
"""Initialize atom unit expression node."""
self.value = value
AstNode.__init__(self, kid=kid)
Expr.__init__(self)

def normalize(self, deep: bool = True) -> bool:
"""Normalize ast node."""
Expand Down Expand Up @@ -3312,6 +3334,7 @@ def __init__(
self.expr = expr
self.with_from = with_from
AstNode.__init__(self, kid=kid)
Expr.__init__(self)

def normalize(self, deep: bool = False) -> bool:
"""Normalize yield statement node."""
Expand Down Expand Up @@ -3343,6 +3366,7 @@ def __init__(
self.params = params
self.genai_call = genai_call
AstNode.__init__(self, kid=kid)
Expr.__init__(self)

def normalize(self, deep: bool = True) -> bool:
"""Normalize ast node."""
Expand Down Expand Up @@ -3377,6 +3401,7 @@ def __init__(
self.step = step
self.is_range = is_range
AstNode.__init__(self, kid=kid)
Expr.__init__(self)
AstSymbolStubNode.__init__(self, sym_type=SymbolType.SEQUENCE)

def normalize(self, deep: bool = True) -> bool:
Expand Down Expand Up @@ -3419,6 +3444,7 @@ def __init__(
self.arch_name = arch_name
self.arch_type = arch_type
AstNode.__init__(self, kid=kid)
Expr.__init__(self)
AstSymbolNode.__init__(
self,
sym_name=arch_name.sym_name,
Expand Down Expand Up @@ -3449,6 +3475,7 @@ def __init__(
self.chain = chain
self.edges_only = edges_only
AstNode.__init__(self, kid=kid)
Expr.__init__(self)

def normalize(self, deep: bool = True) -> bool:
"""Normalize ast node."""
Expand Down Expand Up @@ -3478,6 +3505,7 @@ def __init__(
self.filter_cond = filter_cond
self.edge_dir = edge_dir
AstNode.__init__(self, kid=kid)
Expr.__init__(self)
WalkerStmtOnlyNode.__init__(self)
AstSymbolStubNode.__init__(self, sym_type=SymbolType.SEQUENCE)

Expand Down Expand Up @@ -3608,6 +3636,7 @@ def __init__(
self.f_type = f_type
self.compares = compares
AstNode.__init__(self, kid=kid)
Expr.__init__(self)
AstSymbolStubNode.__init__(self, sym_type=SymbolType.SEQUENCE)

def normalize(self, deep: bool = False) -> bool:
Expand Down Expand Up @@ -3645,6 +3674,7 @@ def __init__(
"""Initialize assign compr expression node."""
self.assigns = assigns
AstNode.__init__(self, kid=kid)
Expr.__init__(self)
AstSymbolStubNode.__init__(self, sym_type=SymbolType.SEQUENCE)

def normalize(self, deep: bool = False) -> bool:
Expand Down Expand Up @@ -4203,6 +4233,7 @@ def __init__(
pos_end=pos_end,
)
AstSymbolStubNode.__init__(self, sym_type=self.SYMBOL_TYPE)
Expr.__init__(self)

@property
def lit_value(
Expand Down
Loading
Loading