def build_NameConstant(ctx, expr): r = ctx.make_range(expr.lineno, expr.col_offset, expr.col_offset + len(str(expr.value))) if expr.value is True: return TrueLiteral(r) elif expr.value is False: return FalseLiteral(r) elif expr.value is None: return NoneLiteral(r) else: raise ValueError("Name constant value unsupported: " + str(expr.value))
def build_Name(ctx, expr): r = ctx.make_range(expr.lineno, expr.col_offset, expr.col_offset + len(expr.id)) if expr.id.startswith(_reserved_prefix): raise NotSupportedError(r, "names of variables used in JIT-ed functions " "can't start with " + _reserved_prefix) if expr.id == "True": return TrueLiteral(r) elif expr.id == "False": return FalseLiteral(r) elif expr.id == "None": return NoneLiteral(r) return Var(Ident(r, expr.id))