System.Linq.Dynamic.ExpressionParser.ParseTypeAccess C# (CSharp) Method

ParseTypeAccess() private method

private ParseTypeAccess ( Type type ) : Expression
type Type
return Expression
		private Expression ParseTypeAccess(Type type)
		{
			int errorPos = _token.Position;
			NextToken();
			if (_token.ID == TokenId.Question)
			{
				if (!type.IsValueType || IsNullableType(type))
					throw ParseError(errorPos, Res.TypeHasNoNullableForm(GetTypeName(type)));
				type = typeof(Nullable<>).MakeGenericType(type);
				NextToken();
			}
			if (_token.ID == TokenId.OpenParen)
			{
				Expression[] args = ParseArgumentList();
				MethodBase method;
				switch (FindBestMethod(type.GetConstructors(), Maybe.Nothing, args, out method))
				{
					case 0:
						if (args.Length == 1)
							return GenerateConversion(args[0], type, errorPos);
						throw ParseError(errorPos, Res.NoMatchingConstructor(GetTypeName(type)));
					case 1:
						return Expression.New((ConstructorInfo) method, args);
					default:
						throw ParseError(errorPos, Res.AmbiguousConstructorInvocation(GetTypeName(type)));
				}
			}
			ValidateToken(TokenId.Dot, Res.DotOrOpenParenExpected);
			NextToken();
			return ParseMemberAccess(type, null);
		}
ExpressionParser