本文整理汇总了C#中Galaxy_Editor_2.Compiler.Generated.node.AMethodDecl.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# AMethodDecl.GetName方法的具体用法?C# AMethodDecl.GetName怎么用?C# AMethodDecl.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Galaxy_Editor_2.Compiler.Generated.node.AMethodDecl
的用法示例。
在下文中一共展示了AMethodDecl.GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: 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);
}
示例3: MethodDescription
public MethodDescription(AMethodDecl method)
{
Parser parser = new Parser(method);
Start = parser.Start;
End = parser.End;
ReturnType = parser.ReturnType;
Name = parser.Name;
Formals = parser.Formals;
Locals = parser.Locals;
if (method.Parent() != null)
method.Parent().RemoveChild(method);
IsDelegate = method.GetDelegate() != null;
//if (!IsDelegate)
Decl = method;
IsStatic = method.GetStatic() != null;
Visibility = method.GetVisibilityModifier();
realType = (PType)method.GetReturnType().Clone();
Position = TextPoint.FromCompilerCoords(method.GetName());
}
示例4: 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);
}
示例5: 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);
}
示例6: CaseAMethodDecl
public override void CaseAMethodDecl(AMethodDecl node)
{
InAMethodDecl(node);
if (node.GetBlock() != null)
{
node.GetBlock().Apply(this);
}
{
Object[] temp = new Object[node.GetFormals().Count];
node.GetFormals().CopyTo(temp, 0);
for (int i = temp.Length - 1; i >= 0; i--)
{
((PLocalDecl)temp[i]).Apply(this);
}
}
if (node.GetName() != null)
{
node.GetName().Apply(this);
}
if (node.GetReturnType() != null)
{
node.GetReturnType().Apply(this);
}
if (node.GetDelegate() != null)
{
node.GetDelegate().Apply(this);
}
if (node.GetInline() != null)
{
node.GetInline().Apply(this);
}
if (node.GetNative() != null)
{
node.GetNative().Apply(this);
}
if (node.GetStatic() != null)
{
node.GetStatic().Apply(this);
}
if (node.GetTrigger() != null)
{
node.GetTrigger().Apply(this);
}
if (node.GetVisibilityModifier() != null)
{
node.GetVisibilityModifier().Apply(this);
}
OutAMethodDecl(node);
}
示例7: GetModifyData
private static ModifyData GetModifyData(AMethodDecl method)
{
if (methodData.ContainsKey(method))
return methodData[method];
if (Util.GetAncestor<AAProgram>(method) == null)
{
ModifyData modifyData = new ModifyData();
string name = method.GetName().Text.ToLower();
if (name.Contains("datatable"))
{
modifyData.DataTable.Reads |= name.Contains("get");
modifyData.DataTable.Writes |= name.Contains("set") || name.Contains("remove") || name.Contains("clear");
}
else
{
modifyData.GameData.Writes |= name.Contains("set") || name.Contains("create");
modifyData.GameData.Reads = true;
}
if (name == "wait")
modifyData.Waits = true;
methodData[method] = modifyData;
return modifyData;
}
return null;
}
示例8: OutAMethodDecl
public override void OutAMethodDecl(AMethodDecl node)
{
//If void return is missing, insert it.
if (node.GetReturnType() is AVoidType && node.GetBlock() != null)
{
AABlock block = (AABlock)node.GetBlock();
bool insertReturn = false;
while (true)
{
if (block.GetStatements().Count == 0)
{
insertReturn = true;
break;
}
PStm lastStm = (PStm)block.GetStatements()[block.GetStatements().Count - 1];
if (lastStm is AVoidReturnStm)
break;
if (lastStm is ABlockStm)
{
block = (AABlock)((ABlockStm)block.GetStatements()[block.GetStatements().Count - 1]).GetBlock();
continue;
}
insertReturn = true;
break;
}
if (insertReturn)
{
block.GetStatements().Add(new AVoidReturnStm(new TReturn("return", block.GetToken().Line, block.GetToken().Pos)));
}
}
//Check if delegate is valid
if (node.GetDelegate() != null)
{
if (node.GetBlock() != null)
errors.Add(new ErrorCollection.Error(node.GetDelegate(), currentSourceFile, LocRM.GetString("ErrorText195")));
if (node.GetInline() != null)
errors.Add(new ErrorCollection.Error(node.GetDelegate(), currentSourceFile, LocRM.GetString("ErrorText196")));
if (node.GetTrigger() != null)
errors.Add(new ErrorCollection.Error(node.GetDelegate(), currentSourceFile, LocRM.GetString("ErrorText197")));
if (node.GetStatic() != null)
errors.Add(new ErrorCollection.Error(node.GetDelegate(), currentSourceFile, LocRM.GetString("ErrorText198")));
if (node.GetNative() != null)
errors.Add(new ErrorCollection.Error(node.GetDelegate(), currentSourceFile, LocRM.GetString("ErrorText199")));
}
//If it's protected, it must be in a struct
if (!Util.HasAncestor<AStructDecl>(node))
{
if (node.GetVisibilityModifier() is AProtectedVisibilityModifier)
errors.Add(new ErrorCollection.Error(node.GetName(),
LocRM.GetString("ErrorText200")));
}
base.OutAMethodDecl(node);
}
示例9: OutAMethodDecl
public override void OutAMethodDecl(AMethodDecl node)
{
if (node.GetTrigger() != null)
{
bool validSignature = IsBoolType(node.GetReturnType());
validSignature &= node.GetFormals().Count == 2;
foreach (AALocalDecl formal in node.GetFormals())
{
validSignature &= IsBoolType(formal.GetType());
validSignature &= formal.GetRef() == null && formal.GetOut() == null;
}
if (!validSignature)
{
errors.Add(new ErrorCollection.Error(node.GetName(), currentSourceFile,
LocRM.GetString("ErrorText156")));
}
}
//Check that all code paths return a value
if (!(node.GetReturnType() is AVoidType))
{
CheckReturns returnChecker = new CheckReturns();
node.GetBlock().Apply(returnChecker);
if (!returnChecker.Returned)
{
errors.Add(new ErrorCollection.Error(node.GetName(), currentSourceFile, LocRM.GetString("ErrorText157")));
}
}
//If the return type or the type of any formals is a private struct, and the method is a public context, give an error
{
AStructDecl pStruct = Util.GetAncestor<AStructDecl>(node);
//Is public context
if (pStruct == null && node.GetVisibilityModifier() is APublicVisibilityModifier ||
pStruct != null && pStruct.GetVisibilityModifier() is APublicVisibilityModifier && !(node.GetVisibilityModifier() is APrivateVisibilityModifier))
{
PType type = node.GetReturnType();
int i = 0;
FindPrivateTypes finder = new FindPrivateTypes(data);
while (true)
{
type.Apply(finder);
if (i == node.GetFormals().Count)
break;
AALocalDecl formal = (AALocalDecl) node.GetFormals()[i];
type = formal.GetType();
i++;
}
if (finder.PrivateTypes.Count > 0)
{
List<ErrorCollection.Error> subErrors = new List<ErrorCollection.Error>();
List<PDecl> usedDecls = new List<PDecl>();
foreach (ANamedType namedType in finder.PrivateTypes)
{
if (data.StructTypeLinks.ContainsKey(namedType))
{
AStructDecl decl = data.StructTypeLinks[namedType];
if (usedDecls.Contains(decl))
continue;
usedDecls.Add(decl);
subErrors.Add(new ErrorCollection.Error(decl.GetName(), LocRM.GetString("ErrorText64")));
}
else if (data.DelegateTypeLinks.ContainsKey(namedType))
{
AMethodDecl decl = data.DelegateTypeLinks[namedType];
if (usedDecls.Contains(decl))
continue;
usedDecls.Add(decl);
subErrors.Add(new ErrorCollection.Error(decl.GetName(), LocRM.GetString("ErrorText154")));
}
}
errors.Add(new ErrorCollection.Error(node.GetName(), LocRM.GetString("ErrorText155"), false, subErrors.ToArray()));
}
}
}
base.OutAMethodDecl(node);
}
示例10: CaseAMethodDecl
public override void CaseAMethodDecl(AMethodDecl node)
{
Write("\n");
if (node.GetStatic() != null) Write("static ");
if (node.GetNative() != null) Write("native ");
node.GetReturnType().Apply(this);
Write(" " + node.GetName().Text + "(");
bool first = true;
foreach (AALocalDecl formal in node.GetFormals())
{
if (!first) Write(", ");
formal.Apply(this);
first = false;
}
if (node.GetBlock() != null)
{
Write(")\n");
node.GetBlock().Apply(this);
}
else
Write(");\n\n");
}
示例11: CaseAConstructorDecl
public override void CaseAConstructorDecl(AConstructorDecl node)
{
AStructDecl str = Util.GetAncestor<AStructDecl>(node);
AEnrichmentDecl enrichment = Util.GetAncestor<AEnrichmentDecl>(node);
AMethodDecl replacer = new AMethodDecl(new APublicVisibilityModifier(), null, null, null, null, null, new AVoidType(new TVoid("void")),
node.GetName(), new ArrayList(), node.GetBlock());
replacer.GetName().Text += "_Constructor";
while (node.GetFormals().Count > 0)
{
replacer.GetFormals().Add(node.GetFormals()[0]);
}
//Move the method outside the struct
AASourceFile file = Util.GetAncestor<AASourceFile>(node);
if (str != null)
str.RemoveChild(node.Parent());
else
enrichment.RemoveChild(node);
int i = file.GetDecl().IndexOf(str ?? (PDecl)enrichment);
file.GetDecl().Insert(i/* + 1*/, replacer);
//Add the struct as a parameter
PType type;
if (str != null)
{
ANamedType structType = new ANamedType(new TIdentifier(str.GetName().Text), null);
finalTrans.data.StructTypeLinks[structType] = str;
type = structType;
}
else
{
type = Util.MakeClone(enrichment.GetType(), finalTrans.data);
}
finalTrans.data.ConstructorMap[node] = replacer;
structFormal = new AALocalDecl(new APublicVisibilityModifier(), null, null, null, null, new APointerType(new TStar("*"), type), new TIdentifier("currentStruct", replacer.GetName().Line, replacer.GetName().Pos), null);
replacer.GetFormals().Add(structFormal);
finalTrans.data.Methods.Add(new SharedData.DeclItem<AMethodDecl>(file, replacer));
//Add return stm
replacer.SetReturnType(new APointerType(new TStar("*"), Util.MakeClone(type, data)));
replacer.Apply(new TransformConstructorReturns(structFormal, data));
//Insert call to base constructor););
if (finalTrans.data.ConstructorBaseLinks.ContainsKey(node))
{
AMethodDecl baseConstructor = finalTrans.data.ConstructorMap[finalTrans.data.ConstructorBaseLinks[node]];
ASimpleInvokeExp invoke = new ASimpleInvokeExp(new TIdentifier(baseConstructor.GetName().Text), new ArrayList());
while (node.GetBaseArgs().Count > 0)
{
invoke.GetArgs().Add(node.GetBaseArgs()[0]);
}
AThisLvalue thisLvalue1 = new AThisLvalue(new TThis("this"));
ALvalueExp thisExp1 = new ALvalueExp(thisLvalue1);
invoke.GetArgs().Add(thisExp1);
AThisLvalue thisLvalue2 = new AThisLvalue(new TThis("this"));
AAssignmentExp assignExp = new AAssignmentExp(new TAssign("="), thisLvalue2, invoke);
ANamedType structType = new ANamedType(new TIdentifier(str.GetName().Text), null);
finalTrans.data.StructTypeLinks[structType] = str;
finalTrans.data.LvalueTypes[thisLvalue1] =
finalTrans.data.LvalueTypes[thisLvalue2] =
finalTrans.data.ExpTypes[thisExp1] =
finalTrans.data.ExpTypes[assignExp] =
finalTrans.data.ExpTypes[invoke] = new APointerType(new TStar("*"), structType);
//finalTrans.data.ExpTypes[invoke] = new AVoidType(new TVoid("void"));
finalTrans.data.SimpleMethodLinks[invoke] = baseConstructor;
((AABlock)replacer.GetBlock()).GetStatements().Insert(0, new AExpStm(new TSemicolon(";"), assignExp));
//Inline if base and current are two different kinds of pointer types (int/string)
AStructDecl baseStruct = null;
AConstructorDecl baseC = finalTrans.data.ConstructorBaseLinks[node];
foreach (KeyValuePair<AStructDecl, List<AConstructorDecl>> pair in finalTrans.data.StructConstructors)
{
bool found = false;
foreach (AConstructorDecl decl in pair.Value)
{
if (baseC == decl)
{
found = true;
break;
}
}
if (found)
{
baseStruct = pair.Key;
break;
}
}
if ((str.GetIntDim() == null) != (baseStruct.GetIntDim() == null))
{
//For the inilining, change the type to the type of the caller
AALocalDecl lastFormal = baseConstructor.GetFormals().OfType<AALocalDecl>().Last();
lastFormal.SetRef(new TRef("ref"));
APointerType oldType = (APointerType) lastFormal.GetType();
structType = new ANamedType(new TIdentifier(str.GetName().Text), null);
//.........这里部分代码省略.........
示例12: 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)
//.........这里部分代码省略.........
示例13: IsThisOnLeftSide
/*private class IsThisOnLeftSide : DepthFirstAdapter
{
private PType type;
private SharedData data;
public bool IsAssignedTo;
private List<AMethodDecl> investigatedMethods = new List<AMethodDecl>();
public IsThisOnLeftSide(PType type, SharedData data)
{
this.type = type;
this.data = data;
}
//Check assignments, method invocations and nonstatic method invocations.
public override void CaseAMethodDecl(AMethodDecl node)
{
investigatedMethods.Add(node);
}
public override void CaseAThisLvalue(AThisLvalue node)
{
if (IsAssignedTo)
return;
Node iParent = GetClosestNodeOfType(node, typeof (AAssignmentExp),
typeof (ASimpleInvokeExp),
typeof (ANonstaticInvokeExp),
typeof (AAsyncInvokeStm),
typeof (ASyncInvokeExp),
typeof(AArrayLvalue),
typeof(APointerLvalue),
typeof(APropertyLvalue),
typeof(AStructLvalue));
if (iParent == null)
return;
if (iParent is AAssignmentExp)
{
AAssignmentExp aParent = (AAssignmentExp) iParent;
if (Util.IsAncestor(node, aParent.GetLvalue()))
{
IsAssignedTo = true;
}
return;
}
if (iParent is ASimpleInvokeExp)
{
ASimpleInvokeExp aParent = (ASimpleInvokeExp) iParent;
AMethodDecl method = data.SimpleMethodLinks[aParent];
if (investigatedMethods.Contains(method))
return;
if (Util.IsAncestor(node, aParent.GetLvalue()))
{
IsAssignedTo = true;
}
return;
}
}
private Node GetClosestNodeOfType(Node node, params Type[] types)
{
if (node == null)
return null;
if (types.Contains(node.GetType()))
return node;
return GetClosestNodeOfType(node.Parent(), types);
}
}*/
public override void CaseADeconstructorDecl(ADeconstructorDecl node)
{
AStructDecl str = Util.GetAncestor<AStructDecl>(node);
AEnrichmentDecl enrichment = Util.GetAncestor<AEnrichmentDecl>(node);
AMethodDecl replacer = new AMethodDecl(new APublicVisibilityModifier(), null, null, null, null, null, new AVoidType(new TVoid("void")),
node.GetName(), new ArrayList(), node.GetBlock());
replacer.GetName().Text += "_Deconstructor";
//Move the method outside the struct
AASourceFile file = Util.GetAncestor<AASourceFile>(node);
if (str != null)
str.RemoveChild(node.Parent());
/*else
enrichment.RemoveChild(node);*/
int i = file.GetDecl().IndexOf(str ?? (PDecl)enrichment);
file.GetDecl().Insert(i/* + 1*/, replacer);
//Add the struct as a parameter
PType type;
if (str != null)
{
ANamedType structType = new ANamedType(new TIdentifier(str.GetName().Text), null);
finalTrans.data.StructTypeLinks[structType] = str;
type = structType;
}
else
{
type = Util.MakeClone(enrichment.GetType(), finalTrans.data);
}
finalTrans.data.DeconstructorMap[node] = replacer;
AALocalDecl structFormal = new AALocalDecl(new APublicVisibilityModifier(), null, null, null, null, new APointerType(new TStar("*"), type), new TIdentifier("currentStruct", replacer.GetName().Line, replacer.GetName().Pos), null);
//.........这里部分代码省略.........
示例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: CheckInlineMethod
private void CheckInlineMethod(AMethodDecl method, List<AMethodDecl> checkedMethods, List<AMethodDecl> path)
{
if (path.Contains(method))
{
List<ErrorCollection.Error> subErrors = new List<ErrorCollection.Error>();
for (int i = path.IndexOf(method); i < path.Count; i++)
{
subErrors.Add(new ErrorCollection.Error(path[i].GetName(), Util.GetAncestor<AASourceFile>(path[i]), LocRM.GetString("ErrorText68")));
}
subErrors.Add(new ErrorCollection.Error(method.GetName(), Util.GetAncestor<AASourceFile>(method), LocRM.GetString("ErrorText68")));
errors.Add(new ErrorCollection.Error(method.GetName(), Util.GetAncestor<AASourceFile>(method),
LocRM.GetString("ErrorText69"),
false, subErrors.ToArray()));
}
if (!checkedMethods.Contains(method))
{
checkedMethods.Add(method);
path.Add(method);
foreach (AMethodDecl nextMethod in InlineMethodCalls[method])
{
CheckInlineMethod(nextMethod, checkedMethods, path);
}
path.Remove(method);
}
}