Exemplo n.º 1
0
        private MidPath EmitPath(IResExp resExp, MidEmitEnv env)
        {
            var midType = EmitTypeExp(resExp.Type, env);
            var midExp  = EmitExpRaw(resExp, env);

            return(env.MaybeMoveTemp <MidPath>(midExp, midType));
        }
Exemplo n.º 2
0
 public ResElementCtorArg(
     IResAttributeRef attribute,
     IResExp value)
 {
     this.Attribute = attribute;
     this.Value     = value;
 }
Exemplo n.º 3
0
 public ResCase(
     SourceRange range,
     IResExp value,
     IResExp body)
 {
     _range = range;
     _value = value;
     _body  = body;
 }
Exemplo n.º 4
0
 public ResLabelExp(
     SourceRange range,
     ResLabel label,
     IResExp body)
     : base(range, label.Type)
 {
     _label = label;
     _body  = body;
 }
Exemplo n.º 5
0
 public ResBreakExp(
     SourceRange range,
     ResLabel label,
     IResExp exp)
     : base(range, new ResBottomType())
 {
     _label = label;
     _exp   = exp;
 }
Exemplo n.º 6
0
 public ResAssignExp(
     SourceRange range,
     IResExp dest,
     IResExp src)
     : base(range, new ResVoidType())
 {
     _dest = dest;
     _src  = src;
 }
Exemplo n.º 7
0
 public ResSeqExp(
     SourceRange range,
     IResExp head,
     IResExp tail)
     : base(range, new ResBottomType())
 {
     _head = head;
     _tail = tail;
 }
Exemplo n.º 8
0
 public ResMemberCategoryGroupRef(
     SourceRange range,
     IResExp obj,
     ResMemberCategoryGroupSpec spec)
 {
     _range = range;
     _obj   = obj;
     _spec  = spec;
 }
Exemplo n.º 9
0
 public ResSwitchExp(
     SourceRange range,
     IResExp value,
     IEnumerable <ResCase> cases)
     : base(range, new ResVoidType())
 {
     _value = value;
     _cases = cases.ToArray();
 }
Exemplo n.º 10
0
 public ResAttributeFetch(
     SourceRange range,
     IResTypeExp type,
     IResExp obj,
     IResExp attribute)
     : base(range, type)
 {
     _obj       = obj;
     _attribute = attribute;
 }
Exemplo n.º 11
0
        private MidExp EmitLocalExp(
            IResExp resExp,
            MidEmitEnv env,
            MidElementDecl element = null)
        {
            var localEnv = new MidLocalEmitEnv(env, _identifiers, element, _exps);
            var midExp   = EmitExpRaw(resExp, localEnv);

            return(localEnv.Wrap(midExp));
        }
 public ResAttributeFetch(
     SourceRange range,
     IResTypeExp type,
     IResExp obj,
     IResExp attribute)
     : base(range, type)
 {
     _obj = obj;
     _attribute = attribute;
 }
Exemplo n.º 13
0
 public ResLetExp(
     SourceRange range,
     IResVarDecl var,
     IResExp value,
     IResExp body)
     : base(range, body.Type)
 {
     _var   = var;
     _value = value;
     _body  = body;
 }
Exemplo n.º 14
0
 public ResForExp(
     SourceRange range,
     IResVarDecl var,
     IResExp sequence,
     IResExp body)
     : base(range, new ResVoidType())
 {
     _var      = var;
     _sequence = sequence;
     _body     = body;
 }
Exemplo n.º 15
0
 public ResIfExp(
     SourceRange range,
     IResExp condition,
     IResExp thenExp,
     IResExp elseExp)
     : base(range, thenExp.Type)
 {
     _condition = condition;
     _thenExp   = thenExp;
     _elseExp   = elseExp;
 }
Exemplo n.º 16
0
        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);
        }
Exemplo n.º 17
0
        private MidExp EmitAttrExp(
            MidElementDecl midElement,
            MidType midType,
            IResExp resExp,
            MidEmitEnv env)
        {
            var savedElement = _currentElement;

            _currentElement = midElement;

            var result = EmitLocalExp(resExp, env, midElement);

            _currentElement = savedElement;

            return(result);
        }
Exemplo n.º 18
0
        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);
        }
Exemplo n.º 19
0
        private MidVal EmitValToElementImpl(
            IResExp resExp,
            MidElementDecl element,
            MidEmitEnv parentEnv)
        {
            var midExp = EmitLocalExp(resExp, parentEnv, element);

            if (midExp is MidVal)
            {
                return((MidVal)midExp);
            }

            var midType = EmitTypeExp(resExp.Type, parentEnv);
            var attr    = element.CacheAttr(
                midExp,
                midType);

            return(_exps.AttributeRef(resExp.Range, attr));
        }
Exemplo n.º 20
0
        private MidVal EmitValToElement(
            IResExp resExp,
            MidElementDecl element,
            MidEmitEnv parentEnv)
        {
            if (element == _currentElement)
            {
                return(EmitVal(resExp, parentEnv));
            }

            var savedElement = _currentElement;

            _currentElement = element;

            var result = EmitValToElementImpl(
                resExp,
                element,
                parentEnv);

            _currentElement = savedElement;
            return(result);
        }
Exemplo n.º 21
0
 public ResLabelExp(
     SourceRange range,
     ResLabel label,
     IResExp body )
     : base(range, label.Type)
 {
     _label = label;
     _body = body;
 }
Exemplo n.º 22
0
 public IResMemberCategoryGroupRef Bind(SourceRange range, IResExp obj)
 {
     return(new ResMemberCategoryGroupRef(range, obj, this));
 }
Exemplo n.º 23
0
 private MidExp EmitExpRaw(IResExp exp, MidEmitEnv env)
 {
     return(EmitExpImpl((dynamic)exp, env));
 }
Exemplo n.º 24
0
 public ResGenericValueArg(
     IResExp value)
 {
     _value = value;
 }
Exemplo n.º 25
0
 public IResMemberRef Bind(SourceRange range, IResExp obj)
 {
     return _decl.MakeRef(
         range,
         new ResMemberBind(range, obj, this));
 }
Exemplo n.º 26
0
 public IResMemberRef Bind(SourceRange range, IResExp obj)
 {
     return(_decl.MakeRef(
                range,
                new ResMemberBind(range, obj, this)));
 }