Ejemplo n.º 1
0
        /// <summary>
        /// Trys to add a type declaration node to the extract depending on whether it has
        /// the <see cref="ScriptObjectAttribute"/>
        /// </summary>
        /// <param name="node">The type declaration node</param>
        private void TryAddTypeDeclaration(TypeDeclarationSyntax node)
        {
            INamedTypeSymbol namedType = Compilation.GetSemanticModel(node.SyntaxTree).GetDeclaredSymbol(node);

            RoslynNamedType namedTypeResult = RoslynType.CreateNamedType(
                namedType,
                new ParseContext(Compilation, new SourceCommentsDocumentationProvider())
                );

            _visitor.Visit(namedTypeResult);
        }
Ejemplo n.º 2
0
 public override IList <UIBinding> Visit(ComputedQuestion node)
 {
     if (IsUnique(node))
     {
         var binding = new UIBinding
         {
             QuestionId = node.Id,
             Label      = LabelForQuestion(node),
             Control    = WidgetFactory.Visit((dynamic)node.Type)
         };
         binding.Control.CanReceiveValue = true;
         Bindings.Add(binding);
     }
     return(Bindings);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Calls the given visitor for the type's component.
        /// </summary>
        /// <param name="visitor">Visitor to use.</param>
        public void Accept(ITypeVisitor visitor)
        {
            if (visitor == null) throw new ArgumentNullException("visitor");

              visitor.Visit(_type);
              if (_type.HasSecurityDeclarations) visitor.Visit(_type.SecurityDeclarations);
              if (_type.HasGenericParameters) visitor.Visit(_type.GenericParameters);
              if (_type.HasInterfaces) visitor.Visit(_type.Interfaces);
              if (_type.HasCustomAttributes) visitor.Visit(_type.CustomAttributes);
              if (_type.HasEvents) visitor.Visit(_type.Events);
              if (_type.HasFields) visitor.Visit(_type.Fields);
              if (_type.HasProperties) visitor.Visit(_type.Properties);
              if (_type.HasMethods) visitor.Visit(_type.Methods);
              if (_type.HasNestedTypes) visitor.Visit(_type.NestedTypes);
        }
Ejemplo n.º 4
0
 public override TResult Accept <TResult>(ITypeVisitor <TResult> defaultTypeVisitor)
 {
     return(defaultTypeVisitor.Visit(this));
 }
Ejemplo n.º 5
0
 public override SemanticAtom Accept(ITypeVisitor v)
 {
     return(v.Visit(this));
 }
Ejemplo n.º 6
0
 public override object Accept <T>(ITypeVisitor <T> visitor)
 {
     return(visitor.Visit(this));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Accept a visit from the given visitor
 /// </summary>
 public static T Accept <T, DataT>(this TypeReference type, ITypeVisitor <T, DataT> visitor, DataT data)
 {
     if (type == null)
     {
         return(default(T));
     }
     if (type.IsDefinition)
     {
         return(visitor.Visit((TypeDefinition)type, data));
     }
     if (type.IsGenericParameter)
     {
         return(visitor.Visit((GenericParameter)type, data));
     }
     if (type is TypeSpecification)
     {
         if (type.IsArray)
         {
             return(visitor.Visit((ArrayType)type, data));
         }
         if (type.IsByReference)
         {
             return(visitor.Visit((ByReferenceType)type, data));
         }
         if (type.IsFunctionPointer)
         {
             return(visitor.Visit((FunctionPointerType)type, data));
         }
         if (type.IsGenericInstance)
         {
             return(visitor.Visit((GenericInstanceType)type, data));
         }
         if (type.IsOptionalModifier)
         {
             return(visitor.Visit((OptionalModifierType)type, data));
         }
         if (type.IsPinned)
         {
             return(visitor.Visit((PinnedType)type, data));
         }
         if (type.IsPointer)
         {
             return(visitor.Visit((PointerType)type, data));
         }
         if (type.IsRequiredModifier)
         {
             return(visitor.Visit((RequiredModifierType)type, data));
         }
         if (type.IsSentinel)
         {
             return(visitor.Visit((SentinelType)type, data));
         }
         throw new ArgumentException("Unknown TypeReference: " + type.GetType().FullName);
     }
     else
     {
         return(visitor.Visit(type, data));
     }
 }
Ejemplo n.º 8
0
 public override void Visit(ITypeVisitor visitor) => visitor.Visit(this);