本文整理汇总了C#中Galaxy_Editor_2.Compiler.Generated.node.ALvalueExp.SetLvalue方法的典型用法代码示例。如果您正苦于以下问题:C# ALvalueExp.SetLvalue方法的具体用法?C# ALvalueExp.SetLvalue怎么用?C# ALvalueExp.SetLvalue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Galaxy_Editor_2.Compiler.Generated.node.ALvalueExp
的用法示例。
在下文中一共展示了ALvalueExp.SetLvalue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CaseAMethodDecl
public override void CaseAMethodDecl(AMethodDecl node)
{
if (processedMethods.Contains(node))
return;
processedMethods.Add(node);
//For each bulk copy param, make it a pointer type
foreach (AALocalDecl formal in node.GetFormals())
{
PType type = formal.GetType();
if (Util.IsBulkCopy(type) || formal.GetRef() != null || formal.GetOut() != null)
{
if (type is AArrayTempType)
{//make dynamic array
AArrayTempType aType = (AArrayTempType) type;
List<PExp> exps = new List<PExp>();
PType newType = new APointerType(new TStar("*"),
new ADynamicArrayType((TLBracket)aType.GetToken().Clone(),
Util.MakeClone(aType.GetType(), data)));
/*exps.AddRange(data.ExpTypes.Where(k => k.Value == type).Select(k => k.Key));
foreach (PExp exp in exps)
{
data.ExpTypes[exp] = newType;
}*/
formal.SetType(newType);
foreach (KeyValuePair<ALocalLvalue, AALocalDecl> pair in data.LocalLinks)
{
if (pair.Value == formal)
{//Replace with *lvalue
ALvalueExp innerExp = new ALvalueExp();
APointerLvalue replacement = new APointerLvalue(new TStar("*"), innerExp);
pair.Key.ReplaceBy(replacement);
innerExp.SetLvalue(pair.Key);
data.ExpTypes[innerExp] = data.LvalueTypes[pair.Key] = formal.GetType();
data.LvalueTypes[replacement] = ((APointerType)newType).GetType();
//if (replacement.Parent() is ALvalueExp)
// data.ExpTypes[(PExp)replacement.Parent()] = data.LvalueTypes[replacement];
}
}
}
else
{//Make pointer
formal.SetType(new APointerType(new TStar("*"), type));
foreach (KeyValuePair<ALocalLvalue, AALocalDecl> pair in data.LocalLinks)
{
if (pair.Value == formal)
{//Replace with *lvalue
ALvalueExp innerExp = new ALvalueExp();
APointerLvalue replacement = new APointerLvalue(new TStar("*"), innerExp);
pair.Key.ReplaceBy(replacement);
innerExp.SetLvalue(pair.Key);
data.ExpTypes[innerExp] = data.LvalueTypes[pair.Key] = formal.GetType();
data.LvalueTypes[replacement] = type;
}
}
}
}
}
if (Util.IsBulkCopy(node.GetReturnType()))
{
PType oldType = node.GetReturnType();
PType newType;
if (node.GetReturnType() is AArrayTempType)
{//make dynamic array
AArrayTempType aType = (AArrayTempType) node.GetReturnType();
newType = new APointerType(new TStar("*"),
new ADynamicArrayType((TLBracket) aType.GetToken().Clone(),
Util.MakeClone(aType.GetType(), data)));
node.SetReturnType(newType);
}
else
{//Make pointer
newType = new APointerType(new TStar("*"), node.GetReturnType());
node.SetReturnType(newType);
}
/*List<PExp> exps = new List<PExp>();
exps.AddRange(data.ExpTypes.Where(k => k.Value == oldType).Select(k => k.Key));
foreach (PExp exp in exps)
{
data.ExpTypes[exp] = newType;
}
List<PLvalue> lvalues = new List<PLvalue>();
lvalues.AddRange(data.LvalueTypes.Where(k => k.Value == oldType).Select(k => k.Key));
foreach (PLvalue lvalue in lvalues)
{
data.LvalueTypes[lvalue] = newType;
}*/
}
base.CaseAMethodDecl(node);
}