本文整理汇总了C#中G25.IsPrefixUnary方法的典型用法代码示例。如果您正苦于以下问题:C# G25.IsPrefixUnary方法的具体用法?C# G25.IsPrefixUnary怎么用?C# G25.IsPrefixUnary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G25
的用法示例。
在下文中一共展示了G25.IsPrefixUnary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteOperator
private static void WriteOperator(StringBuilder SB, Specification S, G25.CG.Shared.CGdata cgd, bool declOnly, G25.fgs FGS, G25.Operator op)
{
bool comment = declOnly || S.m_inlineOperators;
bool returnTypeEqualsFirstArgument = FGS.ReturnTypeName == FGS.ArgumentTypeNames[0];
foreach (string floatName in FGS.FloatNames)
{
G25.FloatType FT = S.GetFloatType(floatName);
string funcName = FGS.OutputName;
{ // regular operator
bool assign = false;
bool returnByReference = returnTypeEqualsFirstArgument && op.IsPrefixUnary() && op.IsUnaryInPlace(); // for unary prefix ++ and --, needs to return by reference (&)
bool constVal = !(op.IsUnaryInPlace() && returnTypeEqualsFirstArgument);
string funcDecl = GetFuncDecl(S, declOnly, FGS, op, FT, assign, constVal, returnByReference);
if (comment) // comment?
SB.AppendLine("/// " + GetComment(S, declOnly, FGS, op, FT, assign));
SB.Append(funcDecl);
if (declOnly) SB.AppendLine(";");
else
{
SB.AppendLine(" {");
WriteOperatorBody(SB, S, cgd, FGS, op, funcName);
SB.AppendLine("}");
}
}
// add an extra operator with assignment (like +=) ?
if (op.IsBinary() && returnTypeEqualsFirstArgument)
{
bool assign = true;
bool constVal = false;
bool returnByReference = true; // todo: for unary prefix ++ needs to return by reference (&)
string funcDecl = GetFuncDecl(S, declOnly, FGS, op, FT, assign, constVal, returnByReference);
if (comment) // comment?
SB.AppendLine("/// " + GetComment(S, declOnly, FGS, op, FT, assign));
SB.Append(funcDecl);
if (declOnly) SB.AppendLine(";");
else
{
SB.AppendLine(" {");
SB.Append("\treturn (" + FGS.ArgumentVariableNames[0] + " = " + funcName + "(" + FGS.ArgumentVariableNames[0]);
SB.AppendLine(", " + FGS.ArgumentVariableNames[1] + "));");
SB.AppendLine("}");
}
}
}
}