Exemplo n.º 1
0
        public IEmitVal EmitAttributeRef(
            MidAttributeDecl decl,
            IEmitBlock block,
            EmitEnv env)
        {
            if (env.ContainsKey(decl))
            {
                return(env.Lookup(decl, block));
            }

            IEmitVal attributeVal = null;

            if (decl.Exp != null)
            {
                attributeVal = block.Temp(
                    decl.Name.ToString(),
                    EmitExp(decl.Exp, block, env));
            }
            else
            {
                // \todo: This is a *huge* hack,
                // since we use @Constant attributes
                // to make various D3D constants visible... :(
                attributeVal = block.BuiltinApp(
                    EmitType(decl.Type, env),
                    decl.Name.ToString(),
                    null);
            }

            env.Insert(decl, (b) => attributeVal);
            return(attributeVal);
        }
Exemplo n.º 2
0
 private IEmitVal EmitExpImpl(
     MidVarRef exp,
     IEmitBlock block,
     EmitEnv env)
 {
     return(env.Lookup(exp.Var, block));
 }