Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shiinamiyuki committed Dec 25, 2024
1 parent 4562fc9 commit fea3ff3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions luisa_lang/hir.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand All @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions luisa_lang/lang_builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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. ")

Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions luisa_lang/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down

0 comments on commit fea3ff3

Please sign in to comment.