Exemplo n.º 1
0
        public virtual T VisitConstListExprNode(ConstListExprNode n)
        {
            for (int i = 0; i < n.ListValue.Count; i++)
            {
                n.ListValue[i].Accept(this);
            }

            return(default(T));
        }
Exemplo n.º 2
0
        public object VisitConstListExprNode(ConstListExprNode n)
        {
            WriteLine(n.kind);
            Indent();
            foreach (Expression e in n.ListValue)
            {
                Visit(e);
            }
            Dedent();

            return(null);
        }
Exemplo n.º 3
0
        public override MIPSRegister VisitConstListExprNode(ConstListExprNode n)
        {
            var reg = GetMIPSRegister();

            emit.EmitMalloc(reg, (short)(n.ListValue.Count + 1));
            for (int i = 0; i < n.ListValue.Count; i++)
            {
                var idx = Gen(n.ListValue[i]);
                emit.EmitLoadStore("sw", idx, (short)((i + 1) * 4), reg);
                rm.ReleaseRegister(idx);
            }
            return(reg);
        }
Exemplo n.º 4
0
            public override object VisitConstListExprNode(ConstListExprNode n)
            {
                if (n.Type.ArrayType.Kind == TypeSymbol.TypeKind.FUNCTION)
                {
                    foreach (var e in n.ListValue)
                    {
                    }
                }
                else
                {
                    foreach (Expression e in n.ListValue)
                    {
                        Visit(e);
                    }
                }

                semanticChecker.CheckAndReport(n.ListValue.All((e) => e.Type.Match(n.Type.ArrayType)), n.sourceLoc, "At least one element has a different Type of the others");
                return(null);
            }
Exemplo n.º 5
0
 public override object VisitConstListExprNode(ConstListExprNode n)
 {
     if (n.ListValue.Count > 0)
     {
         TypeSymbol arrType = null;
         foreach (Expression e in n.ListValue)
         {
             Visit(e);
             var et = e.Type;
             if (arrType == null)
             {
                 arrType = et;
             }
             else
             {
                 if (et.Kind == TypeSymbol.TypeKind.INFER && et.inferOptions != null && et.inferOptions.Count > 0)
                 {
                     foreach (var ts in et.inferOptions)
                     {
                         if (ts.Match(arrType))
                         {
                             e.Type = ts;
                             break;
                         }
                     }
                 }
             }
         }
         n.Type = TypeSymbol.ARRAY_SYMBOL(arrType);
     }
     else
     {
         n.Type = TypeSymbol.INFER_SYMOBOL("[]");
     }
     return(null);
 }
Exemplo n.º 6
0
 public override LLVMRegister VisitConstListExprNode(ConstListExprNode n)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
            public override LData VisitConstListExprNode(ConstListExprNode n)
            {
                var arr = new LArray(n.ListValue.Select(e => Visit(e)).ToArray());

                return(arr);
            }