Represents a property declaration in a Whiley source file. For example: property contains(int[] xs, int x) where some { i in 0..|xs| | xs[i] == x} Here, a property contains is defined which captures the concept of an element being contained in an array.
| 1054 | * |
| 1055 | */ |
| 1056 | public static class Property extends Callable { |
| 1057 | |
| 1058 | public Property(Tuple<Modifier> modifiers, Identifier name, Tuple<Template.Variable> template, |
| 1059 | Tuple<Decl.Variable> parameters, Tuple<Decl.Variable> returns, Tuple<Expr> requires, Stmt.Block body) { |
| 1060 | super(DECL_property, modifiers, name, template, parameters, returns,requires, body); |
| 1061 | } |
| 1062 | |
| 1063 | @Override |
| 1064 | public WyilFile.Type.Property getType() { |
| 1065 | return new WyilFile.Type.Property(project(getParameters()), project(getReturns())); |
| 1066 | } |
| 1067 | |
| 1068 | @SuppressWarnings("unchecked") |
| 1069 | public Tuple<Expr> getRequires() { |
| 1070 | return (Tuple<Expr>) get(5); |
| 1071 | } |
| 1072 | |
| 1073 | @Override |
| 1074 | @SuppressWarnings("unchecked") |
| 1075 | public Stmt.Block getBody() { |
| 1076 | return (Stmt.Block) get(6); |
| 1077 | } |
| 1078 | |
| 1079 | @SuppressWarnings("unchecked") |
| 1080 | @Override |
| 1081 | public Property clone(Syntactic.Item[] operands) { |
| 1082 | return new Property((Tuple<Modifier>) operands[0], (Identifier) operands[1], |
| 1083 | (Tuple<Template.Variable>) operands[2], (Tuple<Decl.Variable>) operands[3], |
| 1084 | (Tuple<Decl.Variable>) operands[4], (Tuple<Expr>) operands[5], (Stmt.Block) operands[6]); |
| 1085 | } |
| 1086 | |
| 1087 | public static final Descriptor DESCRIPTOR_0 = new Descriptor(Operands.SIX, Data.ZERO, "DECL_property") { |
| 1088 | @SuppressWarnings("unchecked") |
| 1089 | @Override |
| 1090 | public Syntactic.Item construct(int opcode, Syntactic.Item[] operands, byte[] data) { |
| 1091 | Tuple<Expr> es = (Tuple<Expr>) operands[5]; |
| 1092 | Stmt.Block block = new Stmt.Block(new Stmt.Return(new Expr.LogicalAnd(es))); |
| 1093 | return new Property((Tuple<Modifier>) operands[0], (Identifier) operands[1], |
| 1094 | (Tuple<Template.Variable>) operands[2], (Tuple<Decl.Variable>) operands[3], |
| 1095 | (Tuple<Decl.Variable>) operands[4], new Tuple<Expr>(), block); |
| 1096 | } |
| 1097 | }; |
| 1098 | |
| 1099 | public static final Descriptor DESCRIPTOR_1 = new Descriptor(Operands.SEVEN, Data.ZERO, "DECL_property") { |
| 1100 | @SuppressWarnings("unchecked") |
| 1101 | @Override |
| 1102 | public Syntactic.Item construct(int opcode, Syntactic.Item[] operands, byte[] data) { |
| 1103 | return new Property((Tuple<Modifier>) operands[0], (Identifier) operands[1], |
| 1104 | (Tuple<Template.Variable>) operands[2], (Tuple<Decl.Variable>) operands[3], |
| 1105 | (Tuple<Decl.Variable>) operands[4], (Tuple<Expr>) operands[5], (Stmt.Block) operands[5]); |
| 1106 | } |
| 1107 | }; |
| 1108 | } |
| 1109 | |
| 1110 | /** |
| 1111 | * A variant is a two state property. |
nothing calls this directly
no outgoing calls
no test coverage detected