本文整理汇总了C#中Galaxy_Editor_2.Compiler.Generated.node.AMethodDecl.SetStatic方法的典型用法代码示例。如果您正苦于以下问题:C# AMethodDecl.SetStatic方法的具体用法?C# AMethodDecl.SetStatic怎么用?C# AMethodDecl.SetStatic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Galaxy_Editor_2.Compiler.Generated.node.AMethodDecl
的用法示例。
在下文中一共展示了AMethodDecl.SetStatic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Apply
//.........这里部分代码省略.........
continue;
}
if (includeItem.Children.Count == 0)
{
if (includeItem.Parent == null)
break;
i++;
continue;
}
i = 0;
//Put all children into this
while (includeItem.Children.Count > 0)
{
int childNr = includeItem.Children.Count - 1;
allItems.Remove(includeItem.Children[childNr]);
if (includeItem.Children[childNr] is FieldItem)
{
FieldItem aItem = (FieldItem)includeItem.Children[childNr];
Node node = aItem.FieldDecl;
node.Parent().RemoveChild(node);
includeItem.Current.GetDecl().Insert(0, node);
}
else if (includeItem.Children[childNr] is StructItem)
{
StructItem aItem = (StructItem)includeItem.Children[childNr];
Node node = aItem.StructDecl;
node.Parent().RemoveChild(node);
includeItem.Current.GetDecl().Insert(0, node);
}
else if (includeItem.Children[childNr] is MethodDeclItem)
{
MethodDeclItem aItem = (MethodDeclItem)includeItem.Children[childNr];
AMethodDecl aNode = new AMethodDecl();
if (aItem.RealDecl.GetStatic() != null) aNode.SetStatic(new TStatic("static"));
aNode.SetReturnType(Util.MakeClone(aItem.RealDecl.GetReturnType(), finalTrans.data));
aNode.SetName(new TIdentifier(aItem.RealDecl.GetName().Text));
foreach (AALocalDecl formal in aItem.RealDecl.GetFormals())
{
AALocalDecl clone = new AALocalDecl(new APublicVisibilityModifier(), null, null, null, null, Util.MakeClone(formal.GetType(), finalTrans.data), new TIdentifier(formal.GetName().Text), null);
aNode.GetFormals().Add(clone);
}
includeItem.Current.GetDecl().Insert(0, aNode);
}
else if (includeItem.Children[childNr] is IncludeItem)
{
IncludeItem aChild = (IncludeItem)includeItem.Children[childNr];
if (aChild.Current == null)
{
AIncludeDecl node = new AIncludeDecl(new TInclude("include"),
new TStringLiteral("\"TriggerLibs/NativeLib\""));
includeItem.Current.GetDecl().Insert(0, node);
}
else
{
PDecl[] decls = new PDecl[aChild.Current.GetDecl().Count];
aChild.Current.GetDecl().CopyTo(decls, 0);
for (int k = decls.Length - 1; k >= 0; k--)
{
includeItem.Current.GetDecl().Insert(0, decls[k]);
}
aChild.Current.Parent().RemoveChild(aChild.Current);
//i = -1;
}
}
includeItem.Children.RemoveAt(childNr);
}
示例2: CaseAMethodDecl
//private List<ErrorCollection.Error> multipleEntryCandidates = new List<ErrorCollection.Error>();
public override void CaseAMethodDecl(AMethodDecl node)
{
//Done in a previous iteration
/*if (node.GetName().Text == "InitMap" && node.GetFormals().Count == 0)
{
if (finalTrans.multipleMainEntries)
{
multipleEntryCandidates.Add(new ErrorCollection.Error(node.GetName(), Util.GetAncestor<AASourceFile>(node.GetName()), "Candidate"));
}
else if (finalTrans.mainEntry != null)
{
multipleEntryCandidates.Add(new ErrorCollection.Error(finalTrans.mainEntry.GetName(), Util.GetAncestor<AASourceFile>(finalTrans.mainEntry.GetName()), "Candidate"));
multipleEntryCandidates.Add(new ErrorCollection.Error(node.GetName(), Util.GetAncestor<AASourceFile>(node.GetName()), "Candidate"));
//finalTrans.errors.Add(new ErrorCollection.Error(node.GetName(), Util.GetAncestor<AASourceFile>(node), "Found multiple candidates for a main entry", true));
finalTrans.multipleMainEntries = true;
finalTrans.mainEntry = null;
}
else
finalTrans.mainEntry = node;
}*/
AStructDecl str = Util.GetAncestor<AStructDecl>(node);
if (str != null)
{
if (node.GetStatic() == null)
structMethods.Add(node);
//Move the method outside the struct
str.RemoveChild(node.Parent());
AASourceFile file = (AASourceFile)str.Parent();
int i = file.GetDecl().IndexOf(str);
file.GetDecl().Insert(i/* + 1*/, node);
node.GetName().Text = GetUniqueStructMethodName(str.GetName().Text + "_" + node.GetName().Text);
if (node.GetStatic() == null)
{
//Add the struct as a parameter
PType structType = new ANamedType(new TIdentifier(str.GetName().Text), null);
finalTrans.data.StructTypeLinks[(ANamedType) structType] = str;
if (str.GetClassToken() != null)
{
structType = new APointerType(new TStar("*"), structType);
}
structFormal = new AALocalDecl(new APublicVisibilityModifier(), null,
str.GetClassToken() == null ? new TRef("ref") : null, null, null,
structType,
new TIdentifier("currentStruct", node.GetName().Line,
node.GetName().Pos), null);
node.GetFormals().Add(structFormal);
data.Locals[(AABlock) node.GetBlock()].Add(structFormal);
}
else
node.SetStatic(null);
finalTrans.data.Methods.Add(new SharedData.DeclItem<AMethodDecl>(file, node));
if (node.GetStatic() == null)
OldParentStruct[node] = str;
//Fix refferences to other struct stuff);
base.CaseAMethodDecl(node);
//Will visit later, since it's added after the struct
//base.CaseAMethodDecl(node);
//if (str.GetLocals().Count == 0)
// str.Parent().RemoveChild(str);
return;
}
AEnrichmentDecl enrichment = Util.GetAncestor<AEnrichmentDecl>(node);
if (enrichment != null)
{
if (node.GetStatic() == null)
structMethods.Add(node);
//Move the method outside the struct
enrichment.RemoveChild(node);
AASourceFile file = (AASourceFile)enrichment.Parent();
int i = file.GetDecl().IndexOf(enrichment);
file.GetDecl().Insert(i/* + 1*/, node);
node.GetName().Text = GetUniqueStructMethodName(Util.TypeToIdentifierString(enrichment.GetType()) + "_" + node.GetName().Text);
if (node.GetStatic() == null)
{
//Add the struct as a parameter
PType structType = Util.MakeClone(enrichment.GetType(), finalTrans.data);
structFormal = new AALocalDecl(new APublicVisibilityModifier(), null, new TRef("ref"), null, null,
structType,
new TIdentifier("currentEnrichment", node.GetName().Line,
node.GetName().Pos), null);
node.GetFormals().Add(structFormal);
}
finalTrans.data.Methods.Add(new SharedData.DeclItem<AMethodDecl>(file, node));
//Fix refferences to other struct stuff);
base.CaseAMethodDecl(node);
//Will visit later, since it's added after the struct
//base.CaseAMethodDecl(node);
//if (str.GetLocals().Count == 0)
// str.Parent().RemoveChild(str);
return;
}
//Build a list of overloads
List<AMethodDecl> overloads = new List<AMethodDecl>();
List<string> prefixMatches = new List<string>();
foreach (SharedData.DeclItem<AMethodDecl> declItem in finalTrans.data.Methods)
//.........这里部分代码省略.........