private static BoundExpression GetSpeculativelyBoundExpressionHelper(Binder binder, ExpressionSyntax expression, SpeculativeBindingOption bindingOption, DiagnosticBag diagnostics) { Debug.Assert(binder != null); Debug.Assert(binder.IsSemanticModelBinder); Debug.Assert(expression != null); Debug.Assert(bindingOption != SpeculativeBindingOption.BindAsTypeOrNamespace || expression is TypeSyntax); BoundExpression boundNode; if (bindingOption == SpeculativeBindingOption.BindAsTypeOrNamespace || binder.Flags.Includes(BinderFlags.CrefParameterOrReturnType)) { boundNode = binder.BindNamespaceOrType(expression, diagnostics); } else { Debug.Assert(bindingOption == SpeculativeBindingOption.BindAsExpression); boundNode = binder.BindExpression(expression, diagnostics); } return boundNode; }