mirror of https://github.com/m-labs/artiq.git
core: add ConstGeneric
This commit is contained in:
parent
985da815ae
commit
c618d5daa8
|
@ -12,7 +12,7 @@ from artiq.language import import_cache
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Kernel", "KernelInvariant", "virtual",
|
"Kernel", "KernelInvariant", "virtual", "ConstGeneric",
|
||||||
"round64", "floor64", "ceil64",
|
"round64", "floor64", "ceil64",
|
||||||
"extern", "kernel", "portable", "nac3", "rpc",
|
"extern", "kernel", "portable", "nac3", "rpc",
|
||||||
"print_rpc",
|
"print_rpc",
|
||||||
|
@ -35,6 +35,12 @@ class KernelInvariant(Generic[T]):
|
||||||
class virtual(Generic[T]):
|
class virtual(Generic[T]):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class _ConstGenericMarker:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def ConstGeneric(name, constraint):
|
||||||
|
return TypeVar(name, _ConstGenericMarker, constraint)
|
||||||
|
|
||||||
|
|
||||||
def round64(x):
|
def round64(x):
|
||||||
return round(x)
|
return round(x)
|
||||||
|
|
Loading…
Reference in New Issue