Beispiel #1
0
 internal void OutputStructFieldsValue(StringBuilder codeBuilder, int indent, CsDslTranslater cs2dsl, string varPrefix, string varPostfix)
 {
     for (int i = 0; i < ReturnValueArgFlags.Count; ++i)
     {
         bool flag = ReturnValueArgFlags[i];
         if (flag)
         {
             var exp     = ReturnArgs[i];
             var oper    = ReturnArgOperations[i];
             var leftSym = ReturnArgSymbols[i];
             if (null != leftSym && SymbolTable.Instance.IsCs2DslSymbol(leftSym) && SymbolTable.Instance.IsFieldSymbolKind(leftSym))
             {
                 codeBuilder.Append(CsDslTranslater.GetIndentString(indent));
                 codeBuilder.AppendFormat("local({0}_{1}_{2}); {0}_{1}_{2} = ", varPrefix, i, varPostfix);
                 cs2dsl.OutputExpressionSyntax(exp);
                 codeBuilder.AppendLine(";");
             }
         }
     }
 }
Beispiel #2
0
 internal void OutputWrapStructFields(StringBuilder codeBuilder, int indent, CsDslTranslater cs2dsl)
 {
     for (int i = 0; i < ReturnValueArgFlags.Count; ++i)
     {
         bool flag = ReturnValueArgFlags[i];
         if (flag)
         {
             var exp     = ReturnArgs[i];
             var oper    = ReturnArgOperations[i];
             var leftSym = ReturnArgSymbols[i];
             if (null != leftSym && (leftSym.Kind == SymbolKind.Local || leftSym.Kind == SymbolKind.Parameter || SymbolTable.Instance.IsFieldSymbolKind(leftSym)))
             {
                 if (SymbolTable.Instance.IsCs2DslSymbol(oper.Type))
                 {
                     cs2dsl.MarkNeedFuncInfo();
                     codeBuilder.Append(CsDslTranslater.GetIndentString(indent));
                     cs2dsl.OutputExpressionSyntax(exp);
                     codeBuilder.Append(" = wrapstruct(");
                     cs2dsl.OutputExpressionSyntax(exp);
                     codeBuilder.AppendFormat(", {0});", ClassInfo.GetFullName(oper.Type));
                     codeBuilder.AppendLine();
                 }
                 else
                 {
                     string ns = ClassInfo.GetNamespaces(oper.Type);
                     if (ns != "System")
                     {
                         cs2dsl.MarkNeedFuncInfo();
                         codeBuilder.Append(CsDslTranslater.GetIndentString(indent));
                         cs2dsl.OutputExpressionSyntax(exp);
                         codeBuilder.Append(" = wrapexternstruct(");
                         cs2dsl.OutputExpressionSyntax(exp);
                         codeBuilder.AppendFormat(", {0});", ClassInfo.GetFullName(oper.Type));
                         codeBuilder.AppendLine();
                     }
                 }
             }
         }
     }
 }
Beispiel #3
0
 internal void OutputRecycleAndKeepStructFields(StringBuilder codeBuilder, int indent, CsDslTranslater cs2dsl, string oldVarPrefix, string newVarPrefix, string varPostfix)
 {
     for (int i = 0; i < ReturnValueArgFlags.Count; ++i)
     {
         bool flag = ReturnValueArgFlags[i];
         if (flag)
         {
             var exp     = ReturnArgs[i];
             var oper    = ReturnArgOperations[i];
             var leftSym = ReturnArgSymbols[i];
             if (null != leftSym && SymbolTable.Instance.IsCs2DslSymbol(leftSym) && SymbolTable.Instance.IsFieldSymbolKind(leftSym))
             {
                 cs2dsl.MarkNeedFuncInfo();
                 string fieldType = fieldType = ClassInfo.GetFullName(oper.Type);
                 //回收旧值,保持新值
                 codeBuilder.Append(CsDslTranslater.GetIndentString(indent));
                 codeBuilder.Append("recycleandkeepstructvalue(");
                 codeBuilder.Append(fieldType);
                 codeBuilder.AppendFormat(", {0}_{2}_{3}, {1}_{2}_{3});", oldVarPrefix, newVarPrefix, i, varPostfix);
                 codeBuilder.AppendLine();
             }
         }
     }
 }