/// <param name="typeSyntax">The argument to typeof.</param> /// <param name="allowedMap"> /// Keys are GenericNameSyntax nodes representing unbound generic types. /// Values are false if the node should result in an error and true otherwise. /// </param> /// <param name="isUnboundGenericType">True if no constructed generic type was encountered.</param> public static void Visit(ExpressionSyntax typeSyntax, out Dictionary<GenericNameSyntax, bool> allowedMap, out bool isUnboundGenericType) { OpenTypeVisitor visitor = new OpenTypeVisitor(); visitor.Visit(typeSyntax); allowedMap = visitor.allowedMap; isUnboundGenericType = visitor.seenGeneric && !visitor.seenConstructed; }
/// <param name="typeSyntax">The argument to typeof.</param> /// <param name="allowedMap"> /// Keys are GenericNameSyntax nodes representing unbound generic types. /// Values are false if the node should result in an error and true otherwise. /// </param> /// <param name="isUnboundGenericType">True if no constructed generic type was encountered.</param> public static void Visit(ExpressionSyntax typeSyntax, out Dictionary <GenericNameSyntax, bool> allowedMap, out bool isUnboundGenericType) { OpenTypeVisitor visitor = new OpenTypeVisitor(); visitor.Visit(typeSyntax); allowedMap = visitor._allowedMap; isUnboundGenericType = visitor._seenGeneric && !visitor._seenConstructed; }
internal TypeofBinder(ExpressionSyntax typeExpression, Binder next) // Unsafe types are not unsafe in typeof, so it is effectively an unsafe region. // Since we only depend on existence of nameable members and nameof(x) produces a constant // string expression usable in an early attribute, we use early attribute binding. : base(next, next.Flags | BinderFlags.UnsafeRegion | BinderFlags.EarlyAttributeBinding) { OpenTypeVisitor.Visit(typeExpression, out this.allowedMap, out this.isTypeExpressionOpen); }
internal TypeofBinder(ExpressionSyntax typeExpression, Binder next) // Unsafe types are not unsafe in typeof, so it is effectively an unsafe region. : base(next, next.Flags | BinderFlags.UnsafeRegion) { OpenTypeVisitor.Visit(typeExpression, out _allowedMap, out _isTypeExpressionOpen); }