protected SyntaxNode CreateTypeDeclaration( SyntaxNode containerNode, TypeKind typeKind, string name, EnvDTE.vsCMAccess access, INamedTypeSymbol baseType = null, ImmutableArray <INamedTypeSymbol> implementedInterfaces = default(ImmutableArray <INamedTypeSymbol>)) { var destination = CodeModelService.GetDestination(containerNode); var newTypeSymbol = CodeGenerationSymbolFactory.CreateNamedTypeSymbol( attributes: default(ImmutableArray <AttributeData>), accessibility: CodeModelService.GetAccessibility(access, SymbolKind.NamedType, destination), modifiers: new DeclarationModifiers(), typeKind: typeKind, name: name, typeParameters: default(ImmutableArray <ITypeParameterSymbol>), baseType: baseType, interfaces: implementedInterfaces, specialType: SpecialType.None, members: default(ImmutableArray <ISymbol>)); return(CodeGenerationService.CreateNamedTypeDeclaration( newTypeSymbol, destination, options: GetCodeGenerationOptions(access, containerNode.SyntaxTree.Options))); }
protected SyntaxNode CreatePropertyDeclaration(SyntaxNode containerNode, string name, bool generateGetter, bool generateSetter, EnvDTE.vsCMAccess access, ITypeSymbol type) { var destination = CodeModelService.GetDestination(containerNode); IMethodSymbol getMethod = null; if (generateGetter) { getMethod = CodeGenerationSymbolFactory.CreateMethodSymbol( attributes: default(ImmutableArray <AttributeData>), accessibility: Accessibility.NotApplicable, modifiers: new DeclarationModifiers(), returnType: null, returnsByRef: false, explicitInterfaceSymbol: null, name: "get_" + name, typeParameters: default(ImmutableArray <ITypeParameterSymbol>), parameters: default(ImmutableArray <IParameterSymbol>), statements: ImmutableArray.Create(CodeModelService.CreateReturnDefaultValueStatement(type))); } IMethodSymbol setMethod = null; if (generateSetter) { setMethod = CodeGenerationSymbolFactory.CreateMethodSymbol( attributes: default(ImmutableArray <AttributeData>), accessibility: Accessibility.NotApplicable, modifiers: new DeclarationModifiers(), returnType: null, returnsByRef: false, explicitInterfaceSymbol: null, name: "set_" + name, typeParameters: default(ImmutableArray <ITypeParameterSymbol>), parameters: default(ImmutableArray <IParameterSymbol>)); } var newPropertySymbol = CodeGenerationSymbolFactory.CreatePropertySymbol( attributes: default(ImmutableArray <AttributeData>), accessibility: CodeModelService.GetAccessibility(access, SymbolKind.Field, destination), modifiers: new DeclarationModifiers(), type: type, returnsByRef: false, explicitInterfaceSymbol: null, name: name, parameters: default(ImmutableArray <IParameterSymbol>), getMethod: getMethod, setMethod: setMethod); return(CodeGenerationService.CreatePropertyDeclaration( newPropertySymbol, destination, options: GetCodeGenerationOptions(access, containerNode.SyntaxTree.Options))); }
protected SyntaxNode CreateConstructorDeclaration(SyntaxNode containerNode, string typeName, EnvDTE.vsCMAccess access) { var destination = CodeModelService.GetDestination(containerNode); var newMethodSymbol = CodeGenerationSymbolFactory.CreateConstructorSymbol( attributes: default(ImmutableArray <AttributeData>), accessibility: CodeModelService.GetAccessibility(access, SymbolKind.Method, destination), modifiers: new DeclarationModifiers(), typeName: typeName, parameters: default(ImmutableArray <IParameterSymbol>)); return(CodeGenerationService.CreateMethodDeclaration( newMethodSymbol, destination, options: GetCodeGenerationOptions(access, containerNode.SyntaxTree.Options))); }
protected SyntaxNode CreateFieldDeclaration(SyntaxNode containerNode, string name, EnvDTE.vsCMAccess access, ITypeSymbol type) { var destination = CodeModelService.GetDestination(containerNode); var newFieldSymbol = CodeGenerationSymbolFactory.CreateFieldSymbol( attributes: default(ImmutableArray <AttributeData>), accessibility: CodeModelService.GetAccessibility(access, SymbolKind.Field, destination), modifiers: new DeclarationModifiers(isWithEvents: CodeModelService.GetWithEvents(access)), type: type, name: name); return(CodeGenerationService.CreateFieldDeclaration( newFieldSymbol, destination, options: GetCodeGenerationOptions(access, containerNode.SyntaxTree.Options))); }
protected SyntaxNode CreateDelegateTypeDeclaration(SyntaxNode containerNode, string name, EnvDTE.vsCMAccess access, INamedTypeSymbol returnType) { var destination = CodeModelService.GetDestination(containerNode); var newTypeSymbol = CodeGenerationSymbolFactory.CreateDelegateTypeSymbol( attributes: null, accessibility: CodeModelService.GetAccessibility(access, SymbolKind.NamedType, destination), modifiers: new DeclarationModifiers(), returnType: returnType, name: name); return(CodeGenerationService.CreateNamedTypeDeclaration( newTypeSymbol, destination, options: GetCodeGenerationOptions(access))); }
protected SyntaxNode CreateEventDeclaration(SyntaxNode containerNode, string name, EnvDTE.vsCMAccess access, ITypeSymbol type, bool createPropertyStyleEvent) { var destination = CodeModelService.GetDestination(containerNode); IMethodSymbol addMethod = null; IMethodSymbol removeMethod = null; if (createPropertyStyleEvent) { addMethod = CodeGenerationSymbolFactory.CreateMethodSymbol( attributes: default(ImmutableArray <AttributeData>), accessibility: Accessibility.NotApplicable, modifiers: new DeclarationModifiers(), returnType: null, returnsByRef: false, explicitInterfaceSymbol: null, name: "add_" + name, typeParameters: default(ImmutableArray <ITypeParameterSymbol>), parameters: default(ImmutableArray <IParameterSymbol>)); removeMethod = CodeGenerationSymbolFactory.CreateMethodSymbol( attributes: default(ImmutableArray <AttributeData>), accessibility: Accessibility.NotApplicable, modifiers: new DeclarationModifiers(), returnType: null, returnsByRef: false, explicitInterfaceSymbol: null, name: "remove_" + name, typeParameters: default(ImmutableArray <ITypeParameterSymbol>), parameters: default(ImmutableArray <IParameterSymbol>)); } var newEventSymbol = CodeGenerationSymbolFactory.CreateEventSymbol( attributes: default(ImmutableArray <AttributeData>), accessibility: CodeModelService.GetAccessibility(access, SymbolKind.Event, destination), modifiers: new DeclarationModifiers(), type: type, explicitInterfaceSymbol: null, name: name, addMethod: addMethod, removeMethod: removeMethod); return(CodeGenerationService.CreateEventDeclaration( newEventSymbol, destination, options: GetCodeGenerationOptions(access, containerNode.SyntaxTree.Options))); }
protected SyntaxNode CreateMethodDeclaration(SyntaxNode containerNode, string name, EnvDTE.vsCMAccess access, ITypeSymbol returnType) { var destination = CodeModelService.GetDestination(containerNode); var newMethodSymbol = CodeGenerationSymbolFactory.CreateMethodSymbol( attributes: null, accessibility: CodeModelService.GetAccessibility(access, SymbolKind.Method, destination), modifiers: new DeclarationModifiers(), returnType: returnType, explicitInterfaceSymbol: null, name: name, typeParameters: null, parameters: null); return(CodeGenerationService.CreateMethodDeclaration( newMethodSymbol, destination, options: GetCodeGenerationOptions(access))); }