예제 #1
0
 private MidExp SimplifyExpImpl(MidAttributeRef val, SimplifyEnv env)
 {
     if (val.IsLazy)
     {
         return(_exps.AttributeRef(val.Range, val.Decl));
     }
     return(val);
 }
예제 #2
0
        public MidAttributeRef CleanupExp(MidAttributeRef exp)
        {
            var oldAttr = exp.Decl;
            var newAttr = MapOldToNew(oldAttr);

            if (newAttr == oldAttr)
            {
                return(exp);
            }

            newAttr.TrySetName(oldAttr.Name, oldAttr.Range);
            return(_exps.AttributeRef(exp.Range, newAttr));
        }
예제 #3
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));
        }