public ResMemberGenericApp( IResGenericRef fun, IEnumerable <IResGenericArg> args) { _fun = fun; _args = args.ToArray(); _subst = new Substitution(_fun.MemberTerm.Subst); foreach (var pair in _fun.Parameters.Zip(_args, Tuple.Create)) { _subst.Insert(pair.Item1.Decl, pair.Item2); } }
public ResMemberBind( SourceRange range, IResExp obj, IResMemberSpec memberSpec) { _range = range; _obj = obj; _memberSpec = memberSpec; _subst = new Substitution(memberSpec.Container.MemberTerm.Subst); // \todo: Need to ensure "obj" is clone-able... // \todo: Need to iteratively re-subst... _subst.Insert( memberSpec.Container.ThisParameter, (r) => obj); }
public override IResExp Substitute(Substitution subst) { var newVar = new ResVarDecl( _var.Range, _var.Name, _var.Type.Substitute(subst)); var newSubst = new Substitution(subst); newSubst.Insert(_var, newVar); return(new ResForExp( this.Range, newVar, _sequence.Substitute(subst), _body.Substitute(newSubst))); }
public override IResExp Substitute(Substitution subst) { var newLabel = new ResLabel( _label.Range, _label.Name, _label.Type.Substitute(subst)); var newSubst = new Substitution(subst); newSubst.Insert(_label, newLabel); return(new ResLabelExp( this.Range, newLabel, this.Body.Substitute(newSubst))); throw new NotImplementedException(); }
public override IResExp Substitute(Substitution subst) { var newVar = new ResVarDecl( _var.Range, _var.Name, _var.Type.Substitute(subst)); var newSubst = new Substitution(subst); newSubst.Insert(_var, newVar); var newValue = _value == null ? null : _value.Substitute(subst); return(new ResLetExp( this.Range, newVar, newValue, _body.Substitute(newSubst))); }