Exemplo n.º 1
0
        public void Test()
        {
            PDC <string, string> pdc = new PDC <string, string>();

            pdc = pdc | model.Model1 | BuilderModel <string, string> .Creator | OperatorModel <string, string> .Creator;
            Assert.Equal(@"int btfParameterLength = arg.Length;if( btfParameterLength == 1){
fixed (char* c =  arg){
switch(*(ushort*)(c + 0) ){
case 48:
0
break;
case 49:
1
break;
case 50:
2
break;
case 51:
3
break;
case 52:
4
break;
case 53:
5
break;
case 54:
6
break;
case 55:
7
break;
case 56:
8
break;
case 57:
9
break;
}
}

}
UTProject.Model.OperatorModel<System.String,System.String>.Creator =  UTProject.Model.BuilderModel<System.String,System.String>.Creator(arg);
return UTProject.Model.OperatorModel<System.String,System.String>.Creator(arg);
", pdc.ToString());
        }
Exemplo n.º 2
0
        public static Func <string, DictBase> Ctor(Type type)
        {
            StrTypeCache[type.GetDevelopName()] = type;
            //获得动态生成的类型
            Type result = DictBuilder.InitType(type, Core.Model.FindTreeType.Fuzzy);
            //加入缓存
            string script = $"return new {result.GetDevelopName()}();";

            _str_cache[type.GetDevelopName()] = script;
            _type_cache[type] = script;


            //生成脚本
            PDC <Type, DictBase> handler = default;

            if (_pdc.BuilderInfo != null)
            {
                handler = _pdc | _str_cache;
            }
            else
            {
                handler = (_pdc | _str_cache | DictOperator.CreateFromString | Ctor) % CallerManagement.GetTypeFunc;
            }
            return(NDelegate.UseDomain(type.GetDomain(), builder => builder.LogCompilerError()).UnsafeFunc <string, DictBase>(handler.ToString(), _type_cache.Keys.ToArray(), "NCallerDynamic", "NCaller.Builder"));
        }