Lines Matching refs:Effect
17 // An effect can either be definite, if the write is known to have taken place,
23 // effect cancels out any previous effect upon sequencing. A possible effect
24 // merges into a previous effect, i.e., type bounds are merged. Alternative
25 // composition always merges bounds. It yields a possible effect if at least
27 struct Effect {
33 Effect() : modality(DEFINITE) {}
34 explicit Effect(Bounds b, Modality m = DEFINITE) : modality(m), bounds(b) {}
36 // The unknown effect.
37 static Effect Unknown(Zone* zone) {
38 return Effect(Bounds::Unbounded(), POSSIBLE);
41 static Effect Forget(Zone* zone) {
42 return Effect(Bounds::Unbounded(), DEFINITE);
46 static Effect Seq(Effect e1, Effect e2, Zone* zone) {
48 return Effect(Bounds::Either(e1.bounds, e2.bounds, zone), e1.modality);
52 static Effect Alt(Effect e1, Effect e2, Zone* zone) {
53 return Effect(
81 Effect Lookup(Var var) {
84 ? locator.value() : Effect::Unknown(Base::zone());
88 Effect effect = Lookup(var);
89 return effect.modality == Effect::DEFINITE
90 ? effect.bounds : Bounds::Unbounded();
94 void Seq(Var var, Effect effect) {
97 effect = Effect::Seq(locator.value(), effect, Base::zone());
99 locator.set_value(effect);
108 void Alt(Var var, Effect effect) {
111 effect = Effect::Alt(locator.value(), effect, Base::zone());
113 locator.set_value(effect);
126 Effect::Forget(Base::zone()), Effects(Base::zone()) };
136 void Call(Var var, Effect effect) { self.Seq(var, effect); }
142 void Call(Var var, Effect effect) { self.Alt(var, effect); }
148 void Call(Var var, Effect effect) {
149 if (effect.modality == Effect::DEFINITE && !other.Contains(var)) {
150 effect.modality = Effect::POSSIBLE;
153 locator.set_value(effect);
161 void Call(Var var, Effect effect) { effects.Seq(var, new_effect); }
162 Effect new_effect;
187 typedef Effect Value;
189 static Effect NoValue() { return Effect(); }
316 // Create an extension of the current effect set. The current set should not