26 lines
506 B
Python
26 lines
506 B
Python
from tango.value import TangoIdent, TangoExpr
|
|
|
|
def is_callable(fn):
|
|
return hasattr(fn, '__call__')
|
|
|
|
|
|
def is_ident(ident):
|
|
return isinstance(ident, TangoIdent)
|
|
|
|
|
|
def is_expr(expr):
|
|
return isinstance(expr, TangoExpr)
|
|
|
|
|
|
def resolve_if_ident(scope, val):
|
|
if is_ident(val):
|
|
scope.get_def(val)
|
|
else:
|
|
val
|
|
|
|
|
|
def resolve_idents(scope, vals):
|
|
resolved = []
|
|
for val in vals:
|
|
resolved.append(resolve_if_ident(scope, val))
|
|
return resolved |