/// <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;
 }
Beispiel #2
0
            /// <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;
            }
Beispiel #3
0
 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);
 }
Beispiel #4
0
 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);
 }