def make_private(expr: Expression, privacy: Expression, homomorphism: Homomorphism): assert (privacy.privacy_annotation_label() is not None) pl = get_privacy_expr_from_label(privacy.privacy_annotation_label()) r = ReclassifyExpr(expr, pl, homomorphism) # set type r.annotated_type = AnnotatedTypeName(expr.annotated_type.type_name, pl.clone(), homomorphism) TypeCheckVisitor.check_for_invalid_private_type(r) # set statement, parents, location TypeCheckVisitor.assign_location(r, expr) return r
def make_private(expr: Expression, privacy: Expression): assert (privacy.privacy_annotation_label() is not None) pl = get_privacy_expr_from_label(privacy.privacy_annotation_label()) r = ReclassifyExpr(expr, pl) # set type r.annotated_type = AnnotatedTypeName(expr.annotated_type.type_name, pl.clone()) TypeCheckVisitor.check_for_invalid_private_type(r) # set statement r.statement = expr.statement # set parents r.parent = expr.parent r.annotated_type.parent = r expr.parent = r # set source location r.line = expr.line r.column = expr.column return r