本文整理汇总了C#中Rubberduck.Parsing.Symbols.Declaration类的典型用法代码示例。如果您正苦于以下问题:C# Declaration类的具体用法?C# Declaration怎么用?C# Declaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Declaration类属于Rubberduck.Parsing.Symbols命名空间,在下文中一共展示了Declaration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNavigateCodeEventArgs
public static NavigateCodeEventArgs GetNavigateCodeEventArgs(this SyntaxErrorException exception, Declaration declaration)
{
if (declaration == null) return null;
var selection = new Selection(exception.LineNumber, exception.Position, exception.LineNumber, exception.Position);
return new NavigateCodeEventArgs(declaration.QualifiedName.QualifiedModuleName, selection);
}
示例2: AddReference
/// <summary>Common method for adding a reference to given declaration item</summary>
private static void AddReference(Declaration itemToAdd, IdentifierReference reference)
{
var declaration = _declarations.Items.ToList().FirstOrDefault(x => x.Equals(itemToAdd));
if (declaration == null) return;
declaration.AddReference(reference);
}
示例3: AddDeclarationItem
/// <summary>Common method for adding declaration with some default values</summary>
private void AddDeclarationItem(IMock<ParserRuleContext> context,
Selection selection,
QualifiedMemberName? qualifiedName = null,
DeclarationType declarationType = DeclarationType.Project,
string identifierName = "identifierName")
{
Declaration declarationItem = null;
var qualName = qualifiedName ?? new QualifiedMemberName(_module, "fakeModule");
declarationItem = new Declaration(
qualifiedName: qualName,
parentScope: "module.proc",
asTypeName: "asTypeName",
isSelfAssigned: false,
isWithEvents: false,
accessibility: Accessibility.Public,
declarationType: declarationType,
context: context.Object,
selection: selection
);
_declarations.Add(declarationItem);
if (_listDeclarations == null) _listDeclarations = new List<Declaration>();
_listDeclarations.Add(declarationItem);
}
示例4: DetermineMemberName
private static string DetermineMemberName(Declaration declaration)
{
var type = declaration.DeclarationType;
switch (type)
{
case DeclarationType.PropertyGet:
return declaration.IdentifierName + " (Get)";
case DeclarationType.PropertyLet:
return declaration.IdentifierName + " (Let)";
case DeclarationType.PropertySet:
return declaration.IdentifierName + " (Set)";
case DeclarationType.Variable:
if (declaration.IsArray())
{
return declaration.IdentifierName + "()";
}
return declaration.IdentifierName;
case DeclarationType.Constant:
var valuedDeclaration = (ValuedDeclaration)declaration;
return valuedDeclaration.IdentifierName + " = " + valuedDeclaration.Value;
default:
return declaration.IdentifierName;
}
}
示例5: ValuedDeclaration
public ValuedDeclaration(QualifiedMemberName qualifiedName, Declaration parentDeclaration, string parentScope,
string asTypeName, Accessibility accessibility, DeclarationType declarationType, string value,
ParserRuleContext context, Selection selection, bool isBuiltIn = false)
:base(qualifiedName, parentDeclaration, parentScope, asTypeName, true, false, accessibility, declarationType, context, selection, isBuiltIn)
{
_value = value;
}
示例6: RenameProjectQuickFix
public RenameProjectQuickFix(ParserRuleContext context, QualifiedSelection selection, Declaration target, RubberduckParserState state, ICodePaneWrapperFactory wrapperFactory)
: base(context, selection, string.Format(RubberduckUI.Rename_DeclarationType, RubberduckUI.ResourceManager.GetString("DeclarationType_" + DeclarationType.Project, RubberduckUI.Culture)))
{
_target = target;
_state = state;
_wrapperFactory = wrapperFactory;
}
示例7: SetSelectionText
public void SetSelectionText(Declaration declaration)
{
if (declaration == null && _vbe.ActiveCodePane != null)
{
var selection = _vbe.ActiveCodePane.GetSelection();
SetSelectionText(selection);
_selectionButton.TooltipText = _selectionButton.Caption;
}
else if (declaration != null && !declaration.IsBuiltIn && declaration.DeclarationType != DeclarationType.Class && declaration.DeclarationType != DeclarationType.Module)
{
_selectionButton.Caption = string.Format("{0} ({1}): {2} ({3})",
declaration.QualifiedName.QualifiedModuleName,
declaration.QualifiedSelection.Selection,
declaration.IdentifierName,
RubberduckUI.ResourceManager.GetString("DeclarationType_" + declaration.DeclarationType));
_selectionButton.TooltipText = string.IsNullOrEmpty(declaration.DescriptionString)
? _selectionButton.Caption
: declaration.DescriptionString;
}
else if (declaration != null)
{
var selection = _vbe.ActiveCodePane.GetSelection();
_selectionButton.Caption = string.Format("{0}: {1} ({2}) {3}",
declaration.QualifiedName.QualifiedModuleName,
declaration.IdentifierName,
RubberduckUI.ResourceManager.GetString("DeclarationType_" + declaration.DeclarationType),
selection.Selection);
_selectionButton.TooltipText = string.IsNullOrEmpty(declaration.DescriptionString)
? _selectionButton.Caption
: declaration.DescriptionString;
}
}
示例8: Parameter
public Parameter(Declaration declaration, int index, bool isRemoved = false)
{
Declaration = declaration;
Name = declaration.Context.GetText().RemoveExtraSpacesLeavingIndentation();
Index = index;
IsRemoved = isRemoved;
}
示例9:
public BitmapImage this[Declaration declaration]
{
get
{
var key = Tuple.Create(declaration.DeclarationType, declaration.Accessibility);
return Images[key];
}
}
示例10: ParameterCanBeByValInspectionResult
public ParameterCanBeByValInspectionResult(IInspection inspection, Declaration target, ParserRuleContext context, QualifiedMemberName qualifiedName)
: base(inspection, qualifiedName.QualifiedModuleName, context, target)
{
_quickFixes = new[]
{
new PassParameterByValueQuickFix(Context, QualifiedSelection),
};
}
示例11: BindTarget
private void BindTarget(Declaration target)
{
var listBox = Control.ResultBox;
listBox.DataSource = target.References.Select(reference => new IdentifierReferenceListItem(reference)).ToList();
listBox.DisplayMember = "DisplayString";
listBox.ValueMember = "Selection";
Control.Navigate += ControlNavigate;
}
示例12: MoveFieldCloserToUsageQuickFix
public MoveFieldCloserToUsageQuickFix(ParserRuleContext context, QualifiedSelection selection, Declaration target, RubberduckParserState parseResult, ICodePaneWrapperFactory wrapperFactory, IMessageBox messageBox)
: base(context, selection, string.Format(InspectionsUI.MoveFieldCloserToUsageInspectionResultFormat, target.IdentifierName))
{
_target = target;
_parseResult = parseResult;
_wrapperFactory = wrapperFactory;
_messageBox = messageBox;
}
示例13: AssignedByValParameterInspectionResult
public AssignedByValParameterInspectionResult(IInspection inspection, Declaration target)
: base(inspection, target)
{
_quickFixes = new[]
{
new PassParameterByReferenceQuickFix(target.Context, QualifiedSelection),
};
}
示例14: MoveFieldCloserToUsageInspectionResult
public MoveFieldCloserToUsageInspectionResult(IInspection inspection, Declaration target, RubberduckParserState parseResult, ICodePaneWrapperFactory wrapperFactory, IMessageBox messageBox)
: base(inspection, target)
{
_quickFixes = new[]
{
new MoveFieldCloserToUsageQuickFix(target.Context, target.QualifiedSelection, target, parseResult, wrapperFactory, messageBox),
};
}
示例15: MultilineParameterInspectionResult
public MultilineParameterInspectionResult(IInspection inspection, Declaration target)
: base(inspection, target)
{
_quickFixes = new[]
{
new MakeSingleLineParameterQuickFix(Context, QualifiedSelection),
};
}