private IEntity TryToResolveMemberAsExtension(MemberReferenceExpression node) { IEntity extension = NameResolutionService.ResolveExtension(GetReferenceNamespace(node), node.Name); if (null != extension) node.Annotate(ResolvedAsExtensionAnnotation); return extension; }
bool BindNullableOperation(BinaryExpression node) { if (!IsNullableOperation(node)) return false; if (BinaryOperatorType.ReferenceEquality == node.Operator) { node.Operator = BinaryOperatorType.Equality; return BindNullableComparison(node); } else if (BinaryOperatorType.ReferenceInequality == node.Operator) { node.Operator = BinaryOperatorType.Inequality; return BindNullableComparison(node); } IType lhs = GetExpressionType(node.Left); IType rhs = GetExpressionType(node.Right); bool lhsIsNullable = TypeSystemServices.IsNullable(lhs); bool rhsIsNullable = TypeSystemServices.IsNullable(rhs); if (BinaryOperatorType.Assign == node.Operator) { if (lhsIsNullable) { if (rhsIsNullable) return false; BindNullableInitializer(node, node.Right, lhs); return false; } } if (lhsIsNullable) { MemberReferenceExpression mre = new MemberReferenceExpression(node.Left, "Value"); node.Replace(node.Left, mre); Visit(mre); mre.Annotate("nullableTarget", true); } if (rhsIsNullable) { MemberReferenceExpression mre = new MemberReferenceExpression(node.Right, "Value"); node.Replace(node.Right, mre); Visit(mre); mre.Annotate("nullableTarget", true); } return false; }