Ejemplo n.º 1
0
 public static void MakeMeta(string beanFullName, long typeId,
                             List <Types.Variable> vars,
                             System.IO.StreamWriter sw)
 {
     sw.WriteLine("meta.beans[" + typeId + "] = {");
     sw.WriteLine($"    [0] = \"{beanFullName}\", ");
     foreach (var v in vars)
     {
         sw.WriteLine($"    [{v.Id}] = {TypeMeta.Get(v, v.VariableType)},");
     }
     sw.WriteLine("}");
     foreach (var v in vars)
     {
         if (v.VariableType is Types.TypeDynamic d)
         {
             sw.WriteLine($"function Zeze_GetRealBeanTypeIdFromSpecial_{beanFullName}_{v.NamePinyin}(specialTypeId)");
             foreach (var r in d.RealBeans)
             {
                 sw.WriteLine($"    if (specialTypeId == {r.Key}) then");
                 sw.WriteLine($"        return {r.Value.TypeId}");
                 sw.WriteLine($"    end");
             }
             sw.WriteLine($"    return specialTypeId");
             sw.WriteLine($"end");
         }
     }
 }
Ejemplo n.º 2
0
        public static TypeMeta Get(Types.Variable var, Types.Type type)
        {
            TypeMeta v = new TypeMeta(var);

            type.Accept(v);
            return(v);
        }
Ejemplo n.º 3
0
        void Visitor.Visit(TypeSet type)
        {
            Type = Zeze.Serialize.ByteBuffer.SET;
            TypeMeta vm = TypeMeta.Get(Var, type.ValueType);

            Value           = vm.Type;
            ValueBeanTypeId = vm.TypeBeanTypeId;
        }
Ejemplo n.º 4
0
        void Visitor.Visit(TypeMap type)
        {
            Type = Zeze.Serialize.ByteBuffer.MAP;

            TypeMeta km = TypeMeta.Get(Var, type.KeyType);

            Key           = km.Type;
            KeyBeanTypeId = km.TypeBeanTypeId;

            TypeMeta vm = TypeMeta.Get(Var, type.ValueType);

            Value           = vm.Type;
            ValueBeanTypeId = vm.TypeBeanTypeId;
        }