From fea3ff324fc67ed3c34a3060f54d6c64b7c06e67 Mon Sep 17 00:00:00 2001 From: Xiaochun Tong Date: Wed, 25 Dec 2024 17:51:51 -0500 Subject: [PATCH] minor fix --- luisa_lang/hir.py | 9 +++++---- luisa_lang/lang_builtins.py | 4 ++-- luisa_lang/utils.py | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/luisa_lang/hir.py b/luisa_lang/hir.py index 44a0443..2992b33 100644 --- a/luisa_lang/hir.py +++ b/luisa_lang/hir.py @@ -1277,7 +1277,7 @@ class Function: locals: List[Var] complete: bool is_method: bool - _inline_hint: bool | Literal['always', 'never'] + inline_hint: bool | Literal['always', 'never'] returning_ref: bool def __init__( @@ -1296,11 +1296,12 @@ def __init__( self.locals = [] self.complete = False self.is_method = is_method - self._inline_hint = False + self.inline_hint = False self.returning_ref = returning_ref - def inline_hint(self) -> bool | Literal['always', 'never']: - return self._inline_hint + + + def match_template_args( diff --git a/luisa_lang/lang_builtins.py b/luisa_lang/lang_builtins.py index 6cfa89b..32196ae 100644 --- a/luisa_lang/lang_builtins.py +++ b/luisa_lang/lang_builtins.py @@ -135,7 +135,7 @@ def range(start: T, end: T) -> List[T]: ... def range(start: T, end: T, step: T) -> List[T]: ... -def range(*args): +def range(*args, **kwargs): # type: ignore raise NotImplementedError( "range should not be called in host-side Python code. ") @@ -308,7 +308,7 @@ def write(self, value: T) -> None: def __add__(self, offset: i32 | i64 | u32 | u64) -> 'Pointer[T]': return intrinsic("pointer.add", Pointer[T], self, offset) - + def __sub__(self, offset: i32 | i64 | u32 | u64) -> 'Pointer[T]': return intrinsic("pointer.sub", Pointer[T], self, offset) diff --git a/luisa_lang/utils.py b/luisa_lang/utils.py index 0cb0cf0..93a3a0b 100644 --- a/luisa_lang/utils.py +++ b/luisa_lang/utils.py @@ -95,9 +95,9 @@ def from_ast(ast: ast.AST) -> Optional["Span"]: return None if not hasattr(ast, "col_offset"): return None - if not hasattr(ast, "end_lineno") or ast.end_lineno is None: + if not hasattr(ast, "end_lineno") or getattr(ast, "end_lineno") is None: return None - if not hasattr(ast, "end_col_offset") or ast.end_col_offset is None: + if not hasattr(ast, "end_col_offset") or getattr(ast, "end_col_offset") is None: return None file = None if hasattr(ast, "source_file"):