本文整理汇总了C#中Mono.CSharp.Expression.DoResolveLValue方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.DoResolveLValue方法的具体用法?C# Expression.DoResolveLValue怎么用?C# Expression.DoResolveLValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.Expression
的用法示例。
在下文中一共展示了Expression.DoResolveLValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoResolveLValue
public override Expression DoResolveLValue(ResolveContext rc, Expression right_side)
{
if (right_side == EmptyExpression.OutAccess.Instance) {
right_side.DoResolveLValue (rc, this);
return null;
}
if (DoResolveCore (rc)) {
setter_args = new Arguments (Arguments.Count + 1);
setter_args.AddRange (Arguments);
setter_args.Add (new Argument (right_side));
setter = CreateCallSiteBinder (rc, setter_args, true);
}
eclass = ExprClass.Variable;
return this;
}
示例2: DoResolveLValue
public override Expression DoResolveLValue (ResolveContext rc, Expression right_side)
{
if (right_side == EmptyExpression.OutAccess) {
right_side.DoResolveLValue (rc, this);
return null;
}
if (DoResolveCore (rc)) {
setter_args = CreateSetterArguments (rc, right_side);
setter = CreateCallSiteBinder (rc, setter_args, true);
}
eclass = ExprClass.Variable;
return this;
}
示例3: DoResolveLValue
public override Expression DoResolveLValue (ResolveContext rc, Expression right_side)
{
if (right_side == EmptyExpression.OutAccess) {
right_side.DoResolveLValue (rc, this);
return null;
}
var res_right_side = right_side.Resolve (rc);
if (DoResolveCore (rc) && res_right_side != null) {
setter_args = CreateSetterArguments (rc, res_right_side);
// create setter callsite
var dc = (binder as IDynamicCallSite);
if (rc.Module.PredefinedTypes.IsPlayScriptAotMode && (dc != null) && dc.UseCallSite(rc, setter_args)) {
this.useDelegateInvoke = false;
setter_args.CreateDynamicBinderArguments(rc);
setter = CreateCallSite(rc, setter_args, true);
} else {
this.useDelegateInvoke = true;
setter = CreateCallSiteBinder (rc, setter_args, true);
}
}
eclass = ExprClass.Variable;
return this;
}
示例4: DoResolveLValue
public override Expression DoResolveLValue(ResolveContext ec, Expression right_side)
{
eclass = ExprClass.PropertyAccess;
if (right_side == EmptyExpression.OutAccess.Instance) {
if (ec.CurrentBlock.Toplevel.GetParameterReference (spec.Name, loc) is MemberAccess) {
ec.Report.Error (1939, loc, "A range variable `{0}' may not be passes as `ref' or `out' parameter",
spec.Name);
} else {
right_side.DoResolveLValue (ec, this);
}
return null;
}
if (right_side == EmptyExpression.LValueMemberAccess || right_side == EmptyExpression.LValueMemberOutAccess) {
Error_CannotModifyIntermediateExpressionValue (ec);
}
if (spec.IsNotRealProperty) {
Error_PropertyNotValid (ec);
return null;
}
if (!spec.HasSet){
if (ec.CurrentBlock.Toplevel.GetParameterReference (spec.Name, loc) is MemberAccess) {
ec.Report.Error (1947, loc, "A range variable `{0}' cannot be assigned to. Consider using `let' clause to store the value",
spec.Name);
} else {
ec.Report.Error (200, loc, "Property or indexer `{0}' cannot be assigned to (it is read only)",
GetSignatureForError ());
}
return null;
}
if (targs != null) {
base.SetTypeArguments (ec, targs);
return null;
}
bool must_do_cs1540_check;
if (!IsMemberAccessible (ec.CurrentType, spec.Set, out must_do_cs1540_check)) {
if (spec.HasDifferentAccessibility) {
ec.Report.SymbolRelatedToPreviousError (spec.Set);
ec.Report.Error (272, loc, "The property or indexer `{0}' cannot be used in this context because the set accessor is inaccessible",
TypeManager.CSharpSignature (spec));
} else {
ec.Report.SymbolRelatedToPreviousError (spec.Set);
ErrorIsInaccesible (loc, TypeManager.CSharpSignature (spec.Set), ec.Report);
}
return null;
}
if (!InstanceResolve (ec, TypeManager.IsStruct (spec.DeclaringType), must_do_cs1540_check))
return null;
//
// Only base will allow this invocation to happen.
//
if (IsBase && spec.IsAbstract){
Error_CannotCallAbstractBase (ec, TypeManager.GetFullNameSignature (spec));
}
if (spec.MemberType.IsPointer && !ec.IsUnsafe) {
UnsafeError (ec, loc);
}
if (!ec.IsObsolete) {
ObsoleteAttribute oa = spec.GetAttributeObsolete ();
if (oa != null)
AttributeTester.Report_ObsoleteMessage (oa, GetSignatureForError (), loc, ec.Report);
}
return this;
}
示例5: DoResolve
public Expression DoResolve (EmitContext ec, Expression right_side, ResolveFlags flags)
{
if (type != null)
throw new Exception ();
//
// Resolve the expression with flow analysis turned off, we'll do the definite
// assignment checks later. This is because we don't know yet what the expression
// will resolve to - it may resolve to a FieldExpr and in this case we must do the
// definite assignment check on the actual field and not on the whole struct.
//
Expression original = expr;
expr = expr.Resolve (ec, flags | ResolveFlags.DisableFlowAnalysis);
if (expr == null)
return null;
if (expr is SimpleName){
SimpleName child_expr = (SimpleName) expr;
Expression new_expr = new SimpleName (child_expr.Name, Identifier, loc);
return new_expr.Resolve (ec, flags);
}
//
// TODO: I mailed Ravi about this, and apparently we can get rid
// of this and put it in the right place.
//
// Handle enums here when they are in transit.
// Note that we cannot afford to hit MemberLookup in this case because
// it will fail to find any members at all
//
int errors = Report.Errors;
Type expr_type = expr.Type;
if ((expr is TypeExpr) &&
(expr_type == TypeManager.enum_type ||
expr_type.IsSubclassOf (TypeManager.enum_type))){
Enum en = TypeManager.LookupEnum (expr_type);
if (en != null) {
object value = en.LookupEnumValue (ec, Identifier, loc);
if (value != null){
Constant c = Constantify (value, en.UnderlyingType);
return new EnumConstant (c, expr_type);
}
}
}
if (expr_type.IsPointer){
Error (23, "The `.' operator can not be applied to pointer operands (" +
TypeManager.CSharpName (expr_type) + ")");
return null;
}
member_lookup = MemberLookupFinal (ec, expr_type, expr_type, Identifier, loc);
if (member_lookup == null)
return null;
if (member_lookup is TypeExpr){
member_lookup.Resolve (ec, ResolveFlags.Type);
return member_lookup;
} else if ((flags & ResolveFlags.MaskExprClass) == ResolveFlags.Type)
return null;
member_lookup = ResolveMemberAccess (ec, member_lookup, expr, loc, original);
if (member_lookup == null)
return null;
// The following DoResolve/DoResolveLValue will do the definite assignment
// check.
if (right_side != null)
member_lookup = member_lookup.DoResolveLValue (ec, right_side);
else
member_lookup = member_lookup.DoResolve (ec);
return member_lookup;
}