示例#1
0
        private MidExp EmitExpImpl(ResBreakExp exp, MidEmitEnv env)
        {
            MidLabel label = env.Lookup(exp.Label);
            MidVal   val   = EmitVal(exp.Value, env);

            return(new MidBreakExp(exp.Range, label, val));
        }
示例#2
0
文件: MidLabel.cs 项目: kzyg/spark
 public MidBreakExp(
     SourceRange range,
     MidLabel label,
     MidVal value)
     : base(range, new MidVoidType())
 {
     _label = label;
     _value = value;
 }
示例#3
0
 public MidBreakExp(
     SourceRange range,
     MidLabel label,
     MidVal value)
     : base(range, new MidVoidType())
 {
     _label = label;
     _value = value;
 }
示例#4
0
文件: MidLabel.cs 项目: kzyg/spark
 public MidLabelExp(
     SourceRange range,
     MidLabel label,
     MidExp body,
     MidType type)
     : base(range, type)
 {
     _label = label;
     _body  = body;
 }
示例#5
0
        private MidExp EmitExpImpl(ResLabelExp exp, MidEmitEnv env)
        {
            var midType  = EmitTypeExp(exp.Type, env);
            var localEnv = new MidLocalEmitEnv(env, _identifiers, null, _exps);
            var midLabel = new MidLabel();

            localEnv.Insert(exp.Label, midLabel);
            var midBody = EmitLocalExp(exp.Body, localEnv);

            midBody = localEnv.Wrap(midBody);
            return(new MidLabelExp(
                       exp.Range,
                       midLabel,
                       midBody,
                       midType));
        }
示例#6
0
        private bool UsesLabel(
            MidExp exp,
            MidLabel label)
        {
            bool result    = false;
            var  transform = new MidTransform(
                (e) =>
            {
                if (e is MidBreakExp && (e as MidBreakExp).Label == label)
                {
                    result = true;
                }
                return(e);
            });

            transform.Transform(exp);

            return(result);
        }
        void ReleaseDesignerOutlets()
        {
            if (KeyLabel != null)
            {
                KeyLabel.Dispose();
                KeyLabel = null;
            }

            if (MidLabel != null)
            {
                MidLabel.Dispose();
                MidLabel = null;
            }

            if (ValueLabel != null)
            {
                ValueLabel.Dispose();
                ValueLabel = null;
            }
        }
 public BreakLabel(
     MidLabel midLabel,
     EmitContextHLSL context,
     EmitValHLSL resultVar)
 {
     _midLabel = midLabel;
     _context = context;
     _resultVar = resultVar;
 }
        private bool UsesLabel(
            MidExp exp,
            MidLabel label)
        {
            bool result = false;
            var transform = new MidTransform(
                (e) =>
                {
                    if (e is MidBreakExp && (e as MidBreakExp).Label == label)
                        result = true;
                    return e;
                });

            transform.Transform(exp);

            return result;
        }
示例#10
0
 public MidLabelExp(
     SourceRange range,
     MidLabel label,
     MidExp body,
     MidType type)
     : base(range, type)
 {
     _label = label;
     _body = body;
 }
示例#11
0
 public void Insert(ResLabel key, MidLabel value)
 {
     _labels[key] = value;
 }