@@ -735,6 +735,17 @@ relation evaluate_graphical_api: (InteractiveStmts, InteractiveSymbolTable) =>
735735 ),
736736 st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
737737
738+ rule is_protected(cr,class,p) => b1 &
739+ Util.bool_string(b1) => s1 &
740+ string_append(s1,"\n") => resstr
741+ -----------------------
742+ evaluate_graphical_api(
743+ ISTMTS([IEXP(Absyn.CALL(
744+ Absyn.CREF_IDENT("isProtected",_),
745+ Absyn.FUNCTIONARGS([Absyn.CREF(cr),Absyn.CREF(class)],_)))],_
746+ ),
747+ st as SYMBOLTABLE(p,s,ic,iv,cf)) => (resstr,st)
748+
738749 rule is_constant(cr,class,p) => b1 &
739750 Util.bool_string(b1) => s1 &
740751 string_append(s1,"\n") => resstr
@@ -952,6 +963,29 @@ relation is_parameter: (Absyn.ComponentRef, Absyn.ComponentRef, Absyn.Program) =
952963 axiom is_parameter (_,_,_) => false
953964end
954965
966+ (** relation: is_protected
967+ ** This relation takes a class and a component reference and a program
968+ ** and returns true if the component referenced is in a protected section.
969+ **)
970+ relation is_protected: (Absyn.ComponentRef, Absyn.ComponentRef, Absyn.Program) => bool =
971+
972+ rule Absyn.cref_to_path(classname) => path &
973+ get_pathed_class_in_program(path,p) => Absyn.CLASS(i,p,f,e,r,Absyn.PARTS(parts,_)) &
974+ get_public_list(parts) => publst &
975+ get_components_contains_name(cr,publst) => _
976+ ------------------------
977+ is_protected (cr,classname,p) => false
978+
979+ rule Absyn.cref_to_path(classname) => path &
980+ get_pathed_class_in_program(path,p) => Absyn.CLASS(i,p,f,e,r,Absyn.PARTS(parts,_)) &
981+ get_protected_list(parts) => protlst &
982+ get_components_contains_name(cr,protlst) => _
983+ ---------------------------------------------
984+ is_protected (cr,classname,p) => true
985+
986+ axiom is_protected (_,_,_) => false
987+ end
988+
955989(** relation: is_constant
956990 ** This relation takes a class and a component reference and a program
957991 ** and returns true if the component referenced is a constant.
@@ -3423,7 +3457,7 @@ relation get_public_list: Absyn.ClassPart list => Absyn.ElementItem list =
34233457end
34243458
34253459
3426- (** relation: get_public_list
3460+ (** relation: get_protected_list
34273461 ** This relation takes a ClassPart List and returns an appended list of all protected lists.
34283462 **
34293463*)
0 commit comments