本文整理汇总了C#中Boo.Lang.Compiler.Ast.SlicingExpression.IsTargetOfAssignment方法的典型用法代码示例。如果您正苦于以下问题:C# SlicingExpression.IsTargetOfAssignment方法的具体用法?C# SlicingExpression.IsTargetOfAssignment怎么用?C# SlicingExpression.IsTargetOfAssignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boo.Lang.Compiler.Ast.SlicingExpression
的用法示例。
在下文中一共展示了SlicingExpression.IsTargetOfAssignment方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSlicingExpression
public override void OnSlicingExpression(SlicingExpression node)
{
base.OnSlicingExpression(node);
if (!node.IsComplexSlicing())
return;
if (node.IsTargetOfAssignment())
return;
CompleteOmittedExpressions(node);
ExpandComplexSlicing(node);
}
示例2: SliceMember
void SliceMember(SlicingExpression node, IEntity member)
{
EnsureRelatedNodeWasVisited(node, member);
if (node.IsTargetOfAssignment())
{
// leave it to LeaveBinaryExpression to resolve
Bind(node, member);
return;
}
MethodInvocationExpression mie = new MethodInvocationExpression(node.LexicalInfo);
foreach (Slice index in node.Indices)
{
mie.Arguments.Add(index.Begin);
}
IMethod getter = null;
if (EntityType.Ambiguous == member.EntityType)
{
IEntity result = ResolveAmbiguousPropertyReference((ReferenceExpression)node.Target, (Ambiguous)member, mie.Arguments);
IProperty found = result as IProperty;
if (null != found)
{
getter = found.GetGetMethod();
}
else if (EntityType.Ambiguous == result.EntityType)
{
Error(node);
return;
}
}
else if (EntityType.Property == member.EntityType)
{
getter = ((IProperty)member).GetGetMethod();
}
if (null != getter)
{
if (AssertParameters(node, getter, mie.Arguments))
{
Expression target = GetIndexedPropertySlicingTarget(node);
mie.Target = CodeBuilder.CreateMemberReference(target, getter);
BindExpressionType(mie, getter.ReturnType);
node.ParentNode.Replace(node, mie);
}
else
{
Error(node);
}
}
else
{
NotImplemented(node, "slice for anything but arrays and default properties");
}
}
示例3: OnSlicingExpression
override public void OnSlicingExpression(SlicingExpression node)
{
if (node.IsTargetOfAssignment())
return;
Visit(node.Target);
var type = (IArrayType)PopType();
if (type.Rank == 1)
LoadSingleDimensionalArrayElement(node, type);
else
LoadMultiDimensionalArrayElement(node, type);
PushType(type.ElementType);
}
示例4: LeaveSlicingExpression
override public void LeaveSlicingExpression(SlicingExpression node)
{
if (!IsDuckTyped(node.Target)) return;
if (node.IsTargetOfAssignment()) return;
// todo
// a[foo]
// RuntimeServices.GetSlice(a, "", (foo,))
MethodInvocationExpression mie = CodeBuilder.CreateMethodInvocation(
node.LexicalInfo,
RuntimeServices_GetSlice,
GetSlicingTarget(node),
CodeBuilder.CreateStringLiteral(GetSlicingMemberName(node)),
GetArrayForIndices(node));
Replace(mie);
}