Ejemplo n.º 1
0
 public EocCallExpression(CodeConverter c, EocCmdInfo cmdInfo, EocExpression target, List <EocExpression> paramList, Assembly superTemplateAssembly = null) : base(c)
 {
     CmdInfo               = cmdInfo;
     Target                = target;
     ParamList             = paramList;
     SuperTemplateAssembly = superTemplateAssembly;
 }
Ejemplo n.º 2
0
 public static EocArrayLiteralExpression Translate(CodeConverter C, ArrayLiteralExpression expr)
 {
     if (expr == null)
     {
         return(null);
     }
     return(new EocArrayLiteralExpression(C, expr.Select(x => EocExpression.Translate(C, x)).ToList()));
 }
 public static EocAccessArrayExpression Translate(CodeConverter C, AccessArrayExpression expr)
 {
     if (expr == null)
     {
         return(null);
     }
     return(new EocAccessArrayExpression(C, EocExpression.Translate(C, expr.Target), EocExpression.Translate(C, expr.Index)));
 }
 public static EocAccessMemberExpression Translate(CodeConverter C, AccessMemberExpression expr)
 {
     if (expr == null)
     {
         return(null);
     }
     return(new EocAccessMemberExpression(C, EocExpression.Translate(C, expr.Target), C.P.GetEocMemberInfo(expr)));
 }
Ejemplo n.º 5
0
 public static EocCallExpression Translate(CodeConverter C, CallExpression expr)
 {
     if (expr == null)
     {
         return(null);
     }
     return(new EocCallExpression(
                C,
                C.P.GetEocCmdInfo(expr),
                EocExpression.Translate(C, expr.Target),
                expr.ParamList?.Select(x => EocExpression.Translate(C, x)).ToList(),
                expr.LibraryId >= 0 ? C.P.EocLibs[expr.LibraryId]?.SuperTemplateAssembly : null));
 }
 public override void ProcessSubExpression(Func <EocExpression, EocExpression> processor, bool deep = true)
 {
     if (Target != null)
     {
         if (deep)
         {
             Target.ProcessSubExpression(processor, deep);
         }
         Target = processor(Target);
     }
     if (Index != null)
     {
         if (deep)
         {
             Index.ProcessSubExpression(processor, deep);
         }
         Index = processor(Index);
     }
 }
Ejemplo n.º 7
0
        public static EocCallExpression Translate(CodeConverter C, CallExpression expr)
        {
            var P = C.P;

            if (expr == null)
            {
                return(null);
            }
            var result = new EocCallExpression(
                C,
                P.GetEocCmdInfo(expr),
                EocExpression.Translate(C, expr.Target),
                expr.ParamList?.Select(x => EocExpression.Translate(C, x)).ToList(),
                expr.LibraryId >= 0 ? P.EocLibs[expr.LibraryId]?.SuperTemplateAssembly : null);

            if (expr.InvokeSpecial)
            {
                result.SpecialScope = "raw_" + P.GetUserDefinedName_SimpleCppName(P.MethodIdToClassMap[expr.MethodId].Id);
            }
            return(result);
        }
        public override void WriteTo(CodeWriter writer)
        {
            EocExpression target = this;
            var           indexs = new List <EocExpression>();

            while (target is EocAccessArrayExpression t)
            {
                indexs.Add(t.Index);
                target = t.Target;
            }
            indexs.Reverse();
            target.WriteTo(writer);
            writer.Write(".At(");
            for (int i = 0; i < indexs.Count; i++)
            {
                var item = indexs[i];
                if (i != 0)
                {
                    writer.Write(", ");
                }
                item.WriteTo(writer);
            }
            writer.Write(")");
        }
Ejemplo n.º 9
0
        public static EocCallExpression Translate(CodeConverter C, CallExpression expr)
        {
            var P = C.P;

            if (expr == null)
            {
                return(null);
            }
            var paramList           = expr.ParamList?.Select(x => EocExpression.Translate(C, x)).ToList();
            var countOfDefaultAtEnd = 0;

            for (int i = paramList.Count - 1; i >= 0; i--)
            {
                if (paramList[i] != null)
                {
                    break;
                }
                countOfDefaultAtEnd++;
            }
            if (countOfDefaultAtEnd != 0)
            {
                paramList.RemoveRange(paramList.Count - countOfDefaultAtEnd, countOfDefaultAtEnd);
            }
            var result = new EocCallExpression(
                C,
                P.GetEocCmdInfo(expr),
                EocExpression.Translate(C, expr.Target),
                paramList,
                expr.LibraryId >= 0 ? P.EocLibs[expr.LibraryId]?.SuperTemplateAssembly : null);

            if (expr.InvokeSpecial)
            {
                result.SpecialScope = "raw_" + P.GetUserDefinedName_SimpleCppName(P.MethodIdToClassMap[expr.MethodId].Id);
            }
            return(result);
        }
 public EocAccessArrayExpression(CodeConverter c, EocExpression target, EocExpression index) : base(c)
 {
     Target = target;
     Index  = index;
 }
 public EocAccessMemberExpression(CodeConverter c, EocExpression target, EocMemberInfo memberInfo) : base(c)
 {
     Target     = target;
     MemberInfo = memberInfo;
 }