本文整理汇总了C#中Galaxy_Editor_2.Compiler.Generated.node.AMethodDecl类的典型用法代码示例。如果您正苦于以下问题:C# AMethodDecl类的具体用法?C# AMethodDecl怎么用?C# AMethodDecl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AMethodDecl类属于Galaxy_Editor_2.Compiler.Generated.node命名空间,在下文中一共展示了AMethodDecl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CaseAMethodDecl
public override void CaseAMethodDecl(AMethodDecl node)
{
currentMethod = node;
dependancies[node] = new List<AMethodDecl>();
base.CaseAMethodDecl(node);
currentMethod = null;
}
示例2: Create
public static ControlFlowGraph Create(AMethodDecl method)
{
ControlFlowGraph graph = new ControlFlowGraph(method);
CFGGenerator generator = new CFGGenerator();
method.GetBlock().Apply(generator);
graph.Nodes = new List<Node>(generator.Nodes.Count);
graph.Nodes.AddRange(generator.Nodes);
return graph;
}
示例3: CaseAMethodDecl
public override void CaseAMethodDecl(AMethodDecl node)
{
if (parsedMethods.Contains(node) || methodChain.Contains(node))
return;
methodChain.Add(node);
NeededRefs.Add(node, new List<AALocalDecl>());
base.CaseAMethodDecl(node);
methodChain.Remove(node);
parsedMethods.Add(node);
foreach (AALocalDecl formal in node.GetFormals())
{
if (formal.GetRef() != null && !NeededRefs[node].Contains(formal) && !Util.IsBulkCopy(formal.GetType()))
formal.SetRef(null);
}
}
示例4: MethodDescription
public MethodDescription(AConstructorDecl method, string type)
{
Parser parser = new Parser(method);
Start = parser.Start;
End = parser.End;
ReturnType = type;
Name = parser.Name;
Formals = parser.Formals;
Locals = parser.Locals;
if (method.Parent() != null)
method.Parent().RemoveChild(method);
Decl = new AMethodDecl(new APublicVisibilityModifier(), null, null, null, null, null, new ANamedType(new TIdentifier(type), null),
new TIdentifier(""), new ArrayList(), method.GetBlock());
while (method.GetFormals().Count > 0)
Decl.GetFormals().Add(method.GetFormals()[0]);
Visibility = method.GetVisibilityModifier();
Position = TextPoint.FromCompilerCoords(method.GetName());
}
示例5: CaseAMethodDecl
public override void CaseAMethodDecl(AMethodDecl node)
{
if (data.AllowPrintouts)
Form1.Form.SetStatusText(prefix + " [" + ++methodNr + "/" + methodCount + " " + node.GetName().Text + "]");
if (node.GetName().Text.Contains("t2"))
node = node;
//Move locals to the start
node.Apply(new MoveLocalsToStart(finalTrans.data));
bool changes = true;
while (changes)
{
changes = false;
//Remove foo = foo
RemoveSelfAssignments.Parse(node, data);
//Create cfg
ControlFlowGraph cfg = ControlFlowGraph.Create(node);
RemoveDeadCode.Parse(cfg);
LivenessAnalysis.CalculateLiveVariables(cfg, data);
bool redoLivenessAnalysis;
changes |= RemoveUnusedAssignments.Parse(cfg, data, out redoLivenessAnalysis);
if (redoLivenessAnalysis)
LivenessAnalysis.CalculateLiveVariables(cfg, data);
changes |= VariableJoiner.Parse(cfg, data);
//This phase doesn't use liveness analysis
changes |= RemoveUnusedLocals.Parse(cfg, data);
while (true)
{
bool changed = RemoveSingleUsedAssignments.Parse(cfg, data);
if (changed)
{
changes = true;
LivenessAnalysis.CalculateLiveVariables(cfg, data);
continue;
}
break;
}
changes |= StatementRemover.Parse(node);
}
}
示例6: CaseAMethodDecl
public override void CaseAMethodDecl(AMethodDecl node)
{
if (node.GetName().Text == "InitMap" && node.GetFormals().Count == 0)
{
if (finalTrans.multipleMainEntries)
{
multipleEntryCandidates.Add(new ErrorCollection.Error(node.GetName(), Util.GetAncestor<AASourceFile>(node.GetName()), LocRM.GetString("ErrorText63")));
}
else if (finalTrans.mainEntry != null)
{
multipleEntryCandidates.Add(new ErrorCollection.Error(finalTrans.mainEntry.GetName(), Util.GetAncestor<AASourceFile>(finalTrans.mainEntry.GetName()), LocRM.GetString("ErrorText63")));
multipleEntryCandidates.Add(new ErrorCollection.Error(node.GetName(), Util.GetAncestor<AASourceFile>(node.GetName()), LocRM.GetString("ErrorText63")));
//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;
}
base.CaseAMethodDecl(node);
}
示例7: CaseAMethodDecl
public override void CaseAMethodDecl(AMethodDecl node)
{
if (node.GetInline() == null)
return;
//Variables marked as out can be made into ref
foreach (AALocalDecl formal in node.GetFormals())
{
if (formal.GetOut() != null)
{
formal.SetRef(new TRef("ref"));
formal.SetOut(null);
}
}
assignedToLocals.Clear();
base.CaseAMethodDecl(node);
foreach (AALocalDecl formal in node.GetFormals())
{
if (!assignedToLocals.Contains(formal))
formal.SetRef(new TRef("ref"));
}
}
示例8: CaseAMethodDecl
public override void CaseAMethodDecl(AMethodDecl node)
{
if (node.GetNative() == null && node.GetBlock() == null)
return;
if (node.GetStatic() != null)
return;
string inputStr = "native " + TypeToString(node.GetReturnType()) + " " + node.GetName().Text +
"(";
bool first = true;
foreach (AALocalDecl formal in node.GetFormals())
{
if (!first)
inputStr += ", ";
inputStr += TypeToString(formal.GetType()) + " " + formal.GetName().Text;
first = false;
}
inputStr += ");";
writer.WriteLine(inputStr);
AStructDecl str = Util.GetAncestor<AStructDecl>(node);
List<AMethodDecl> methodList;
if (str != null)
methodList = StructMethods[str];
else
methodList = Methods;
string sig = Util.GetMethodSignature(node);
if (methodList.Any(otherMethod => Util.GetMethodSignature(otherMethod) == sig))
{
return;
}
methodList.Add(node);
node.SetBlock(null);
node.Parent().RemoveChild(node);
}
示例9: LocalDecl
public LocalDecl(AALocalDecl decl, AMethodDecl parentMethod)
{
Decl = decl;
ParentMethod = parentMethod;
if (Name.StartsWith("_"))
Name = "u" + Name;
}
示例10: MethodDecl
public MethodDecl(AMethodDecl decl)
{
Decl = decl;
if (Name.StartsWith("_"))
Name = "u" + Name;
}
示例11: Formals_Cast
internal Formals_Cast(AMethodDecl obj)
{
this.obj = obj;
}
示例12: OutAMethodDecl
public override void OutAMethodDecl(AMethodDecl node)
{
node.GetName().Text = node.GetName().Text.Replace("+", "Plus");
node.GetName().Text = node.GetName().Text.Replace("+", "Plus");
node.GetName().Text = node.GetName().Text.Replace("-", "Minus");
node.GetName().Text = node.GetName().Text.Replace("*", "Mul");
node.GetName().Text = node.GetName().Text.Replace("/", "Div");
node.GetName().Text = node.GetName().Text.Replace("%", "Mod");
node.GetName().Text = node.GetName().Text.Replace("==", "Equals");
node.GetName().Text = node.GetName().Text.Replace("!=", "NotEquals");
node.GetName().Text = node.GetName().Text.Replace("<", "LessThan");
node.GetName().Text = node.GetName().Text.Replace("<=", "LessThanOrEqual");
node.GetName().Text = node.GetName().Text.Replace(">", "GreaterThan");
node.GetName().Text = node.GetName().Text.Replace(">=", "GreaterThanOrEqual");
node.GetName().Text = node.GetName().Text.Replace("&", "And");
node.GetName().Text = node.GetName().Text.Replace("|", "Or");
node.GetName().Text = node.GetName().Text.Replace("^", "Xor");
node.GetName().Text = node.GetName().Text.Replace("<<", "ShiftLeft");
node.GetName().Text = node.GetName().Text.Replace(">>", "ShiftRight");
decls.AddLast(new MethodDecl(node));
}
示例13: CaseAMethodDecl
public override void CaseAMethodDecl(AMethodDecl node)
{
End = Start = TextPoint.FromCompilerCoords(node.GetName().Line, node.GetName().Pos);
ReturnType = Util.TypeToString(node.GetReturnType());
Name = node.GetName().Text;
base.CaseAMethodDecl(node);
}
示例14: OutAMethodDecl
//Rename trigger refferences
public override void OutAMethodDecl(AMethodDecl node)
{
if (finalTrans.data.TriggerDeclarations.ContainsKey(node))
{
foreach (TStringLiteral stringLiteral in finalTrans.data.TriggerDeclarations[node])
{
stringLiteral.Text = "\"" + node.GetName().Text + "\"";
}
}
}
示例15: OutAMethodDecl
public override void OutAMethodDecl(AMethodDecl node)
{
currentMethod = null;
}