本文整理汇总了C#中Galaxy_Editor_2.Compiler.Generated.node.ALvalueExp类的典型用法代码示例。如果您正苦于以下问题:C# ALvalueExp类的具体用法?C# ALvalueExp怎么用?C# ALvalueExp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ALvalueExp类属于Galaxy_Editor_2.Compiler.Generated.node命名空间,在下文中一共展示了ALvalueExp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CaseAAssignmentExp
public override void CaseAAssignmentExp(AAssignmentExp node)
{
if (!(node.Parent() is AExpStm))
{
PStm parentStm = Util.GetAncestor<PStm>(node);
MoveMethodDeclsOut mover = new MoveMethodDeclsOut("multipleAssignmentsVar", finalTrans.data);
node.GetLvalue().Apply(mover);
PLvalue lvalue = Util.MakeClone(node.GetLvalue(), finalTrans.data);
ALvalueExp exp = new ALvalueExp(lvalue);
finalTrans.data.ExpTypes[exp] = finalTrans.data.LvalueTypes[lvalue];
node.ReplaceBy(exp);
AExpStm stm = new AExpStm(new TSemicolon(";"), node);
AABlock block = (AABlock) parentStm.Parent();
//block.GetStatements().Insert(block.GetStatements().IndexOf(parentStm), localDeclStm);
block.GetStatements().Insert(block.GetStatements().IndexOf(parentStm), stm);
//localDeclStm.Apply(this);
stm.Apply(this);
if (parentStm is AWhileStm && Util.IsAncestor(exp, ((AWhileStm)parentStm).GetCondition()))
{
AWhileStm aStm = (AWhileStm)parentStm;
//Copy assignment before continues
//Before each continue in the while, and at the end.
//Add continue statement, if not present
block = (AABlock)((ABlockStm)aStm.GetBody()).GetBlock();
if (block.GetStatements().Count == 0 || !(block.GetStatements()[block.GetStatements().Count - 1] is AContinueStm))
block.GetStatements().Add(new AContinueStm(new TContinue("continue")));
//Get all continue statements in the while
ContinueFinder finder = new ContinueFinder();
block.Apply(finder);
foreach (AContinueStm continueStm in finder.Continues)
{
stm = new AExpStm(new TSemicolon(";"), Util.MakeClone(node, finalTrans.data));
block.GetStatements().Insert(block.GetStatements().IndexOf(continueStm), stm);
stm.Apply(this);
}
}
return;
}
base.CaseAAssignmentExp(node);
}
示例2: CaseASimpleInvokeExp
public override void CaseASimpleInvokeExp(ASimpleInvokeExp node)
{
PExp expNode = (PExp)node;
PType type = data.ExpTypes[expNode];
if (type is APointerType) type = new ANamedType(new TIdentifier("string"), null);
ALocalLvalue local = new ALocalLvalue(new TIdentifier("tempName", 0, 0));
ALvalueExp exp = new ALvalueExp(local);
PStm stm = Util.GetAncestor<PStm>(node);
AABlock block = (AABlock)stm.Parent();
node.ReplaceBy(exp);
AALocalDecl localDecl = new AALocalDecl(new APublicVisibilityModifier(), null, null, null, null,
Util.MakeClone(type, data),
new TIdentifier(varName, 0, 0), expNode);
ALocalDeclStm newStm = new ALocalDeclStm(new TSemicolon(";"), localDecl);
block.GetStatements().Insert(block.GetStatements().IndexOf(stm), newStm);
NewStatements.Add(newStm);
data.LvalueTypes[local] = type;
data.ExpTypes[exp] = type;
data.LocalLinks[local] = localDecl;
//localDecl.Apply(this);
exp.Apply(this);
return;
}
示例3: OutAIncDecExp
public override void OutAIncDecExp(AIncDecExp node)
{
PIncDecOp op = node.GetIncDecOp();
if (!Util.HasAncestor<AABlock>(node))
{
Token token = null;
if (op is APostDecIncDecOp)
token = ((APostDecIncDecOp) op).GetToken();
else if (op is APreDecIncDecOp)
token = ((APreDecIncDecOp)op).GetToken();
else if (op is APostIncIncDecOp)
token = ((APostIncIncDecOp)op).GetToken();
else if (op is APreIncIncDecOp)
token = ((APreIncIncDecOp)op).GetToken();
errors.Add(new ErrorCollection.Error(token, LocRM.GetString("ErrorText114")));
throw new ParserException(token, "TypeChecking.OutAIncDecExp");
}
bool plus = op is APreIncIncDecOp || op is APostIncIncDecOp;
if (op is APreIncIncDecOp || op is APreDecIncDecOp || node.Parent() is AExpStm)
{//++i, --i, i++; or i--;
//Replace with assignment
//<exp>++ => <exp> + 1
//(... foo = <exp> ...)++ => (... foo = <exp> ...) = (... foo ...) + 1
//(... foo++ ...)++ => (... foo++ ...) = (... foo ...) + 1
PLvalue clone = Util.MakeClone(node.GetLvalue(), data);
clone.Apply(new AssignFixup(data));
PBinop binop;
if (plus)
{
binop = new APlusBinop(new TPlus("+"));
}
else
{
binop = new AMinusBinop(new TMinus("-"));
}
ABinopExp addExp = new ABinopExp(new ALvalueExp(clone), binop, new AIntConstExp(new TIntegerLiteral("1")));
AAssignmentExp exp = new AAssignmentExp(new TAssign("="), node.GetLvalue(), addExp);
node.ReplaceBy(exp);
exp.Apply(this);
return;
}
{//i++ or i--
//Make a new local so
//int newLocal = i;
//++i;
//...newLocal...;
PLvalue lvalueClone = Util.MakeClone(node.GetLvalue(), data);
PExp exp = new ALvalueExp(Util.MakeClone(node.GetLvalue(), data));
data.ExpTypes[exp] = data.LvalueTypes[node.GetLvalue()];
AALocalDecl localDecl = new AALocalDecl(new APublicVisibilityModifier(), null, null, null, null, Util.MakeClone(data.LvalueTypes[node.GetLvalue()], data), new TIdentifier("incDecVar"), exp);
ALocalDeclStm localDeclStm = new ALocalDeclStm(new TSemicolon(";"), localDecl);
node.SetIncDecOp(plus
? (PIncDecOp) new APreIncIncDecOp(new TPlusPlus("++"))
: new APreDecIncDecOp(new TMinusMinus("--")));
ALocalLvalue lvalue = new ALocalLvalue(new TIdentifier(localDecl.GetName().Text));
exp = new ALvalueExp(lvalue);
data.ExpTypes[exp] = data.LvalueTypes[lvalue] = data.LvalueTypes[node.GetLvalue()];
data.LocalLinks[lvalue] = localDecl;
PStm pStm = Util.GetAncestor<PStm>(node);
node.ReplaceBy(exp);
PStm nodeStm = new AExpStm(new TSemicolon(";"), node);
AABlock block = (AABlock) pStm.Parent();
block.GetStatements().Insert(block.GetStatements().IndexOf(pStm), localDeclStm);
block.GetStatements().Insert(block.GetStatements().IndexOf(pStm), nodeStm);
localDeclStm.Apply(this);
nodeStm.Apply(this);
exp.Apply(this);
if (pStm is AWhileStm && Util.IsAncestor(exp, ((AWhileStm)pStm).GetCondition()))
{
AWhileStm aStm = (AWhileStm)pStm;
//Insert
// newLocal = i
// ++i
//Before each continue in the while, and at the end.
//Add continue statement, if not present
block = (AABlock)((ABlockStm)aStm.GetBody()).GetBlock();
if (block.GetStatements().Count == 0 || !(block.GetStatements()[block.GetStatements().Count - 1] is AContinueStm))
block.GetStatements().Add(new AContinueStm(new TContinue("continue")));
//Get all continue statements in the while
ContinueFinder finder = new ContinueFinder();
block.Apply(finder);
foreach (AContinueStm continueStm in finder.Continues)
{
PLvalue nodeLvalue1 = Util.MakeClone(lvalueClone, data);
PExp nodeLvalue1Exp = new ALvalueExp(nodeLvalue1);
PLvalue nodeLvalue2 = Util.MakeClone(lvalueClone, data);
ALocalLvalue newLocalLvalue = new ALocalLvalue(new TIdentifier("newLocal"));
data.LocalLinks[newLocalLvalue] = localDecl;
AAssignmentExp assignment = new AAssignmentExp(new TAssign("="), newLocalLvalue, nodeLvalue1Exp);
PStm assignmentStm = new AExpStm(new TSemicolon(";"), assignment);
//.........这里部分代码省略.........
示例4: New388
ArrayList New388()
{
ArrayList nodeList = new ArrayList();
ArrayList nodeArrayList6 = (ArrayList) Pop();
ArrayList nodeArrayList5 = (ArrayList) Pop();
ArrayList nodeArrayList4 = (ArrayList) Pop();
ArrayList nodeArrayList3 = (ArrayList) Pop();
ArrayList nodeArrayList2 = (ArrayList) Pop();
ArrayList nodeArrayList1 = (ArrayList) Pop();
TypedList listNode8 = new TypedList();
PLvalue plvalueNode3 = (PLvalue)nodeArrayList1[0];
ALvalueExp pexpNode2 = new ALvalueExp (
plvalueNode3
);
TDot tdotNode5 = (TDot)nodeArrayList2[0];
ADotDotType pdottypeNode4 = new ADotDotType (
tdotNode5
);
TIdentifier tidentifierNode6 = (TIdentifier)nodeArrayList3[0];
TypedList listNode7 = (TypedList)nodeArrayList5[0];
if ( listNode7 != null )
{
listNode8.AddAll(listNode7);
}
ANonstaticInvokeExp pexpNode1 = new ANonstaticInvokeExp (
pexpNode2,
pdottypeNode4,
tidentifierNode6,
listNode8
);
nodeList.Add(pexpNode1);
return nodeList;
}
示例5: OutACastExp
public override void OutACastExp(ACastExp node)
{
string toType = ((AAName)((ANamedType) node.GetType()).GetName()).AsString();
string fromType;
PType fromPType = data.ExpTypes[node.GetExp()];
AStructDecl toEnum = null;
AStructDecl fromEnum = null;
if (data.StructTypeLinks.ContainsKey((ANamedType)node.GetType()))
{
AStructDecl str = data.StructTypeLinks[(ANamedType)node.GetType()];
if (data.Enums.ContainsKey(str))
toEnum = str;
}
if (fromPType is ANamedType)
{
fromType = ((AAName)((ANamedType)fromPType).GetName()).AsString();
//Namespace ignored
if (data.StructTypeLinks.ContainsKey((ANamedType) fromPType))
{
AStructDecl str = data.StructTypeLinks[(ANamedType) fromPType];
if (data.Enums.ContainsKey(str))
fromEnum = str;
}
}
else
{
errors.Add(new ErrorCollection.Error(node.GetToken(), currentSourceFile, LocRM.GetString("ErrorText121")));
throw new ParserException(node.GetToken(), "Invalid cast");
}
if (toEnum != null && (fromType == "int" || fromType == "byte"))
{
ANamedType type = new ANamedType(new TIdentifier(toEnum.GetName().Text), null);
data.StructTypeLinks[type] = toEnum;
data.ExpTypes[node.GetExp()] = type;
node.ReplaceBy(node.GetExp());
return;
}
if (fromEnum != null && (toType == "int" || toType == "byte"))
{
int enumDefinitions = 0;
foreach (PLocalDecl local in fromEnum.GetLocals())
{
if (local is AALocalDecl)
enumDefinitions++;
}
string typeName = enumDefinitions > 255 ? "int" : "byte";
ANamedType type = new ANamedType(new TIdentifier(typeName), null);
data.ExpTypes[node.GetExp()] = new ANamedType(new TIdentifier(typeName), null);
node.ReplaceBy(node.GetExp());
return;
}
if (fromEnum != null && toType == "string")
{
AMethodDecl targetMethod = data.StructMethods[fromEnum][0];
ASimpleInvokeExp invokeExp = new ASimpleInvokeExp(new TIdentifier("toString"), new ArrayList(){node.GetExp()});
data.SimpleMethodLinks[invokeExp] = targetMethod;
data.ExpTypes[invokeExp] = targetMethod.GetReturnType();
node.ReplaceBy(invokeExp);
return;
}
ASimpleInvokeExp replacementMethod = null;
switch (toType)
{
case "string":
switch (fromType)
{
case "wave":
replacementMethod = new ASimpleInvokeExp(new TIdentifier("AIWaveToString"), new ArrayList{node.GetExp()});
break;
case "fixed"://Implicit
AFieldLvalue precisionArg = new AFieldLvalue(new TIdentifier("c_fixedPrecisionAny"));
ALvalueExp exp = new ALvalueExp(precisionArg);
data.FieldLinks[precisionArg] =
data.Libraries.Fields.First(field => field.GetName().Text == precisionArg.GetName().Text);
replacementMethod = new ASimpleInvokeExp(new TIdentifier("FixedToString"), new ArrayList { node.GetExp(), exp});
break;
case "int"://Implicit
case "byte"://Implicit
replacementMethod = new ASimpleInvokeExp(new TIdentifier("IntToString"), new ArrayList { node.GetExp()});
break;
case "bool"://Implicit
replacementMethod = new ASimpleInvokeExp(new TIdentifier("libNtve_gf_ConvertBooleanToString"), new ArrayList { node.GetExp() });
break;
case "color"://Implicit
replacementMethod = new ASimpleInvokeExp(new TIdentifier("libNtve_gf_ConvertColorToString"), new ArrayList { node.GetExp() });
break;
}
break;
case "text":
switch (fromType)
{
case "wave":
replacementMethod = new ASimpleInvokeExp(new TIdentifier("AIWaveToText"), new ArrayList { node.GetExp() });
break;
case "fixed"://Implicit
//.........这里部分代码省略.........
示例6: InALvalueExp
public virtual void InALvalueExp(ALvalueExp node)
{
DefaultIn(node);
}
示例7: New393
ArrayList New393()
{
ArrayList nodeList = new ArrayList();
ArrayList nodeArrayList6 = (ArrayList) Pop();
ArrayList nodeArrayList5 = (ArrayList) Pop();
ArrayList nodeArrayList4 = (ArrayList) Pop();
ArrayList nodeArrayList3 = (ArrayList) Pop();
ArrayList nodeArrayList2 = (ArrayList) Pop();
ArrayList nodeArrayList1 = (ArrayList) Pop();
TypedList listNode9 = new TypedList();
TValue tvalueNode4 = (TValue)nodeArrayList1[0];
AValueLvalue plvalueNode3 = new AValueLvalue (
tvalueNode4
);
ALvalueExp pexpNode2 = new ALvalueExp (
plvalueNode3
);
TArrow tarrowNode6 = (TArrow)nodeArrayList2[0];
AArrowDotType pdottypeNode5 = new AArrowDotType (
tarrowNode6
);
TIdentifier tidentifierNode7 = (TIdentifier)nodeArrayList3[0];
TypedList listNode8 = (TypedList)nodeArrayList5[0];
if ( listNode8 != null )
{
listNode9.AddAll(listNode8);
}
ANonstaticInvokeExp pexpNode1 = new ANonstaticInvokeExp (
pexpNode2,
pdottypeNode5,
tidentifierNode7,
listNode9
);
nodeList.Add(pexpNode1);
return nodeList;
}
示例8: CaseAAssignmentExp
public override void CaseAAssignmentExp(AAssignmentExp node)
{
ALvalueExp replacer = new ALvalueExp(node.GetLvalue());
data.ExpTypes[replacer] = data.LvalueTypes[replacer.GetLvalue()];
node.ReplaceBy(replacer);
replacer.Apply(this);
}
示例9: OutAPointerMultiLvalue
public override void OutAPointerMultiLvalue(APointerMultiLvalue node)
{
ALvalueExp lvalueExp;
APointerLvalue pointerLvalue = new APointerLvalue((TStar) node.GetTokens()[0], node.GetBase());
while (node.GetTokens().Count > 0)
{
lvalueExp = new ALvalueExp(pointerLvalue);
pointerLvalue = new APointerLvalue((TStar) node.GetTokens()[0], lvalueExp);
}
node.ReplaceBy(pointerLvalue);
pointerLvalue.Apply(this);
}
示例10: New575
ArrayList New575()
{
ArrayList nodeList = new ArrayList();
ArrayList nodeArrayList3 = (ArrayList) Pop();
ArrayList nodeArrayList2 = (ArrayList) Pop();
ArrayList nodeArrayList1 = (ArrayList) Pop();
PLvalue plvalueNode3 = (PLvalue)nodeArrayList1[0];
ALvalueExp pexpNode2 = new ALvalueExp (
plvalueNode3
);
TDot tdotNode5 = (TDot)nodeArrayList2[0];
ADotDotType pdottypeNode4 = new ADotDotType (
tdotNode5
);
TIdentifier tidentifierNode6 = (TIdentifier)nodeArrayList3[0];
AStructLvalue plvalueNode1 = new AStructLvalue (
pexpNode2,
pdottypeNode4,
tidentifierNode6
);
nodeList.Add(plvalueNode1);
return nodeList;
}
示例11: New576
ArrayList New576()
{
ArrayList nodeList = new ArrayList();
ArrayList nodeArrayList3 = (ArrayList) Pop();
ArrayList nodeArrayList2 = (ArrayList) Pop();
ArrayList nodeArrayList1 = (ArrayList) Pop();
TThis tthisNode4 = (TThis)nodeArrayList1[0];
AThisLvalue plvalueNode3 = new AThisLvalue (
tthisNode4
);
ALvalueExp pexpNode2 = new ALvalueExp (
plvalueNode3
);
TDot tdotNode6 = (TDot)nodeArrayList2[0];
ADotDotType pdottypeNode5 = new ADotDotType (
tdotNode6
);
TIdentifier tidentifierNode7 = (TIdentifier)nodeArrayList3[0];
AStructLvalue plvalueNode1 = new AStructLvalue (
pexpNode2,
pdottypeNode5,
tidentifierNode7
);
nodeList.Add(plvalueNode1);
return nodeList;
}
示例12: New427
ArrayList New427()
{
ArrayList nodeList = new ArrayList();
ArrayList nodeArrayList1 = (ArrayList) Pop();
TThis tthisNode3 = (TThis)nodeArrayList1[0];
AThisLvalue plvalueNode2 = new AThisLvalue (
tthisNode3
);
ALvalueExp pexpNode1 = new ALvalueExp (
plvalueNode2
);
nodeList.Add(pexpNode1);
return nodeList;
}
示例13: New428
ArrayList New428()
{
ArrayList nodeList = new ArrayList();
ArrayList nodeArrayList1 = (ArrayList) Pop();
TValue tvalueNode3 = (TValue)nodeArrayList1[0];
AValueLvalue plvalueNode2 = new AValueLvalue (
tvalueNode3
);
ALvalueExp pexpNode1 = new ALvalueExp (
plvalueNode2
);
nodeList.Add(pexpNode1);
return nodeList;
}
示例14: New426
ArrayList New426()
{
ArrayList nodeList = new ArrayList();
ArrayList nodeArrayList1 = (ArrayList) Pop();
PLvalue plvalueNode2 = (PLvalue)nodeArrayList1[0];
ALvalueExp pexpNode1 = new ALvalueExp (
plvalueNode2
);
nodeList.Add(pexpNode1);
return nodeList;
}
示例15: New425
ArrayList New425()
{
ArrayList nodeList = new ArrayList();
ArrayList nodeArrayList3 = (ArrayList) Pop();
ArrayList nodeArrayList2 = (ArrayList) Pop();
ArrayList nodeArrayList1 = (ArrayList) Pop();
TIdentifier tidentifierNode3 = (TIdentifier)nodeArrayList3[0];
AStructFieldLvalue plvalueNode2 = new AStructFieldLvalue (
tidentifierNode3
);
ALvalueExp pexpNode1 = new ALvalueExp (
plvalueNode2
);
nodeList.Add(pexpNode1);
return nodeList;
}