C# Class Rubberduck.Common.DeclarationExtensions

Exibir arquivo Open project: retailcoder/Rubberduck

Public Properties

Property Type Description
ProcedureTypes DeclarationType[]

Public Methods

Method Description
BitmapImage ( this declaration ) : BitmapImage
CountOfDeclarationsInStatement ( this target ) : int

Returns the number of variable declarations in a single statement.

FindBuiltInEventHandlers ( this declarations ) : IEnumerable
FindEventHandlers ( this declarations, Rubberduck.Parsing.Symbols.Declaration control ) : IEnumerable

Finds all event handler procedures for specified control declaration.

FindEventProcedures ( this declarations, Rubberduck.Parsing.Symbols.Declaration withEventsDeclaration ) : IEnumerable
FindFormEventHandlers ( this declarations ) : IEnumerable
FindFormEventHandlers ( this declarations, Rubberduck.Parsing.Symbols.Declaration userForm ) : IEnumerable
FindHandlersForEvent ( this declarations, Rubberduck.Parsing.Symbols.Declaration eventDeclaration ) : Declaration>>.IEnumerable

Gets a tuple containing the WithEvents declaration and the corresponding handler, for each type implementing this event.

FindInterfaceImplementationMembers ( this declarations ) : IEnumerable

Finds all class members that are interface implementation members.

FindInterfaceImplementationMembers ( this declarations, string interfaceMember ) : IEnumerable
FindInterfaceMember ( this declarations, Rubberduck.Parsing.Symbols.Declaration implementation ) : Rubberduck.Parsing.Symbols.Declaration
FindInterfaceMembers ( this declarations ) : IEnumerable

Finds all interface members.

FindInterfaces ( this declarations ) : IEnumerable
FindSelectedDeclaration ( this declarations, QualifiedSelection selection, DeclarationType type, Selection>.Func selector = null ) : Rubberduck.Parsing.Symbols.Declaration

Gets the Declaration of the specified type, at the specified selection. Returns the declaration if selection is on an identifier reference.

FindSelectedDeclaration ( this declarations, QualifiedSelection selection, IEnumerable types, Selection>.Func selector = null ) : Rubberduck.Parsing.Symbols.Declaration

Gets the Declaration of the specified types, at the specified selection. Returns the declaration if selection is on an identifier reference.

FindTarget ( this declarations, QualifiedSelection selection ) : Rubberduck.Parsing.Symbols.Declaration
FindTarget ( this declarations, QualifiedSelection selection, DeclarationType validDeclarationTypes ) : Rubberduck.Parsing.Symbols.Declaration

Returns the declaration contained in a qualified selection. To get the selection of a variable or field, use FindVariable(QualifiedSelection)

FindVariable ( this declarations, QualifiedSelection selection ) : Rubberduck.Parsing.Symbols.Declaration

Returns the variable which contains the passed-in QualifiedSelection. Returns null if the selection is not on a variable.

GetVariableStmtContext ( this target ) : VBAParser.VariableStmtContext

Returns a VariableStmtContext.

GetVariableStmtContextSelection ( this target ) : Rubberduck.VBEditor.Selection

Returns the Selection of a VariableStmtContext.

HasMultipleDeclarationsInStatement ( this target ) : bool

Returns whether a variable declaration statement contains multiple declarations in a single statement.

InScope ( this declarations, [ parent ) : IEnumerable

Gets the declaration for all identifiers declared in or below the specified scope.

InScope ( this declarations, string scope ) : IEnumerable

Gets the declaration for all identifiers declared in or below the specified scope.

IndexOfVariableDeclarationInStatement ( this target ) : int

Returns the number of variable declarations in a single statement. Adjusted to be 1-indexed rather than 0-indexed.

Named ( this declarations, string name ) : IEnumerable
OfType ( this declarations ) : IEnumerable

Gets all declarations of any one of the specified DeclarationType values.

OfType ( this declarations, DeclarationType declarationType ) : IEnumerable

Gets all declarations of the specified DeclarationType.

ToLocalizedString ( this type ) : string

Private Methods

Method Description
FindInterface ( this declarations, QualifiedSelection selection ) : Rubberduck.Parsing.Symbols.Declaration
GetTypeMembers ( this declarations, Rubberduck.Parsing.Symbols.Declaration type ) : IEnumerable

Method Details

BitmapImage() public static method

public static BitmapImage ( this declaration ) : BitmapImage
declaration this
return System.Windows.Media.Imaging.BitmapImage

CountOfDeclarationsInStatement() public static method

Returns the number of variable declarations in a single statement.
Throws when target's DeclarationType is not Variable.
public static CountOfDeclarationsInStatement ( this target ) : int
target this
return int

FindBuiltInEventHandlers() public static method

public static FindBuiltInEventHandlers ( this declarations ) : IEnumerable
declarations this
return IEnumerable

FindEventHandlers() public static method

Finds all event handler procedures for specified control declaration.
public static FindEventHandlers ( this declarations, Rubberduck.Parsing.Symbols.Declaration control ) : IEnumerable
declarations this
control Rubberduck.Parsing.Symbols.Declaration
return IEnumerable

FindEventProcedures() public static method

public static FindEventProcedures ( this declarations, Rubberduck.Parsing.Symbols.Declaration withEventsDeclaration ) : IEnumerable
declarations this
withEventsDeclaration Rubberduck.Parsing.Symbols.Declaration
return IEnumerable

FindFormEventHandlers() public static method

public static FindFormEventHandlers ( this declarations ) : IEnumerable
declarations this
return IEnumerable

FindFormEventHandlers() public static method

public static FindFormEventHandlers ( this declarations, Rubberduck.Parsing.Symbols.Declaration userForm ) : IEnumerable
declarations this
userForm Rubberduck.Parsing.Symbols.Declaration
return IEnumerable

FindHandlersForEvent() public static method

Gets a tuple containing the WithEvents declaration and the corresponding handler, for each type implementing this event.
public static FindHandlersForEvent ( this declarations, Rubberduck.Parsing.Symbols.Declaration eventDeclaration ) : Declaration>>.IEnumerable
declarations this
eventDeclaration Rubberduck.Parsing.Symbols.Declaration
return Declaration>>.IEnumerable

FindInterfaceImplementationMembers() public static method

Finds all class members that are interface implementation members.
public static FindInterfaceImplementationMembers ( this declarations ) : IEnumerable
declarations this
return IEnumerable

FindInterfaceImplementationMembers() public static method

public static FindInterfaceImplementationMembers ( this declarations, string interfaceMember ) : IEnumerable
declarations this
interfaceMember string
return IEnumerable

FindInterfaceMember() public static method

public static FindInterfaceMember ( this declarations, Rubberduck.Parsing.Symbols.Declaration implementation ) : Rubberduck.Parsing.Symbols.Declaration
declarations this
implementation Rubberduck.Parsing.Symbols.Declaration
return Rubberduck.Parsing.Symbols.Declaration

FindInterfaceMembers() public static method

Finds all interface members.
public static FindInterfaceMembers ( this declarations ) : IEnumerable
declarations this
return IEnumerable

FindInterfaces() public static method

public static FindInterfaces ( this declarations ) : IEnumerable
declarations this
return IEnumerable

FindSelectedDeclaration() public static method

Gets the Declaration of the specified type, at the specified selection. Returns the declaration if selection is on an identifier reference.
public static FindSelectedDeclaration ( this declarations, QualifiedSelection selection, DeclarationType type, Selection>.Func selector = null ) : Rubberduck.Parsing.Symbols.Declaration
declarations this
selection Rubberduck.VBEditor.QualifiedSelection
type DeclarationType
selector Selection>.Func
return Rubberduck.Parsing.Symbols.Declaration

FindSelectedDeclaration() public static method

Gets the Declaration of the specified types, at the specified selection. Returns the declaration if selection is on an identifier reference.
public static FindSelectedDeclaration ( this declarations, QualifiedSelection selection, IEnumerable types, Selection>.Func selector = null ) : Rubberduck.Parsing.Symbols.Declaration
declarations this
selection Rubberduck.VBEditor.QualifiedSelection
types IEnumerable
selector Selection>.Func
return Rubberduck.Parsing.Symbols.Declaration

FindTarget() public static method

public static FindTarget ( this declarations, QualifiedSelection selection ) : Rubberduck.Parsing.Symbols.Declaration
declarations this
selection Rubberduck.VBEditor.QualifiedSelection
return Rubberduck.Parsing.Symbols.Declaration

FindTarget() public static method

Returns the declaration contained in a qualified selection. To get the selection of a variable or field, use FindVariable(QualifiedSelection)
public static FindTarget ( this declarations, QualifiedSelection selection, DeclarationType validDeclarationTypes ) : Rubberduck.Parsing.Symbols.Declaration
declarations this
selection Rubberduck.VBEditor.QualifiedSelection
validDeclarationTypes DeclarationType
return Rubberduck.Parsing.Symbols.Declaration

FindVariable() public static method

Returns the variable which contains the passed-in QualifiedSelection. Returns null if the selection is not on a variable.
public static FindVariable ( this declarations, QualifiedSelection selection ) : Rubberduck.Parsing.Symbols.Declaration
declarations this
selection Rubberduck.VBEditor.QualifiedSelection
return Rubberduck.Parsing.Symbols.Declaration

GetVariableStmtContext() public static method

Returns a VariableStmtContext.
Throws when target's DeclarationType is not Variable.
public static GetVariableStmtContext ( this target ) : VBAParser.VariableStmtContext
target this
return VBAParser.VariableStmtContext

GetVariableStmtContextSelection() public static method

Returns the Selection of a VariableStmtContext.
Throws when target's DeclarationType is not Variable.
public static GetVariableStmtContextSelection ( this target ) : Rubberduck.VBEditor.Selection
target this
return Rubberduck.VBEditor.Selection

HasMultipleDeclarationsInStatement() public static method

Returns whether a variable declaration statement contains multiple declarations in a single statement.
Throws when target's DeclarationType is not Variable.
public static HasMultipleDeclarationsInStatement ( this target ) : bool
target this
return bool

InScope() public static method

Gets the declaration for all identifiers declared in or below the specified scope.
public static InScope ( this declarations, [ parent ) : IEnumerable
declarations this
parent [
return IEnumerable

InScope() public static method

Gets the declaration for all identifiers declared in or below the specified scope.
public static InScope ( this declarations, string scope ) : IEnumerable
declarations this
scope string
return IEnumerable

IndexOfVariableDeclarationInStatement() public static method

Returns the number of variable declarations in a single statement. Adjusted to be 1-indexed rather than 0-indexed.
Throws when target's DeclarationType is not Variable.
public static IndexOfVariableDeclarationInStatement ( this target ) : int
target this
return int

Named() public static method

public static Named ( this declarations, string name ) : IEnumerable
declarations this
name string
return IEnumerable

OfType() public static method

Gets all declarations of any one of the specified DeclarationType values.
public static OfType ( this declarations ) : IEnumerable
declarations this
return IEnumerable

OfType() public static method

Gets all declarations of the specified DeclarationType.
public static OfType ( this declarations, DeclarationType declarationType ) : IEnumerable
declarations this
declarationType DeclarationType
return IEnumerable

ToLocalizedString() public static method

public static ToLocalizedString ( this type ) : string
type this
return string

Property Details

ProcedureTypes public_oe static_oe property

public static DeclarationType[] ProcedureTypes
return DeclarationType[]