当前位置: 首页>>代码示例>>C#>>正文


C# Symbols.Declaration类代码示例

本文整理汇总了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);
        }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:7,代码来源:SyntaxErrorExtensions.cs

示例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);
        }
开发者ID:ThunderFrame,项目名称:Rubberduck,代码行数:8,代码来源:RenamePresenterTests.cs

示例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);
        }
开发者ID:ThunderFrame,项目名称:Rubberduck,代码行数:26,代码来源:RenamePresenterTests.cs

示例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;
            }
        }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:25,代码来源:CodeExplorerMemberViewModel.cs

示例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;
 }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:7,代码来源:ValuedDeclaration.cs

示例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;
 }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:7,代码来源:DefaultProjectNameInspectionResult.cs

示例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;
     }
 }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:32,代码来源:RubberduckCommandBar.cs

示例8: Parameter

 public Parameter(Declaration declaration, int index, bool isRemoved = false)
 {
     Declaration = declaration;
     Name = declaration.Context.GetText().RemoveExtraSpacesLeavingIndentation();
     Index = index;
     IsRemoved = isRemoved;
 }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:7,代码来源:Parameter.cs

示例9:

 public BitmapImage this[Declaration declaration]
 {
     get
     {
         var key = Tuple.Create(declaration.DeclarationType, declaration.Accessibility);
         return Images[key];
     }
 }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:8,代码来源:DeclarationIconCache.cs

示例10: ParameterCanBeByValInspectionResult

 public ParameterCanBeByValInspectionResult(IInspection inspection, Declaration target, ParserRuleContext context, QualifiedMemberName qualifiedName)
     : base(inspection, qualifiedName.QualifiedModuleName, context, target)
 {
     _quickFixes = new[]
     {
         new PassParameterByValueQuickFix(Context, QualifiedSelection), 
     };
 }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:8,代码来源:ParameterCanBeByValInspectionResult.cs

示例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;
 }
开发者ID:ThunderFrame,项目名称:Rubberduck,代码行数:8,代码来源:IdentifierReferencesListDockablePresenter.cs

示例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;
 }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:8,代码来源:MoveFieldCloserToUsageInspectionResult.cs

示例13: AssignedByValParameterInspectionResult

 public AssignedByValParameterInspectionResult(IInspection inspection, Declaration target)
     : base(inspection, target)
 {
     _quickFixes = new[]
     {
         new PassParameterByReferenceQuickFix(target.Context, QualifiedSelection),
     };
 }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:8,代码来源:AssignedByValParameterInspectionResult.cs

示例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),
     };
 }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:8,代码来源:MoveFieldCloserToUsageInspectionResult.cs

示例15: MultilineParameterInspectionResult

 public MultilineParameterInspectionResult(IInspection inspection, Declaration target)
     : base(inspection, target)
 {
     _quickFixes = new[]
     {
         new MakeSingleLineParameterQuickFix(Context, QualifiedSelection), 
     };
 }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:8,代码来源:MultilineParameterInspectionResult.cs


注:本文中的Rubberduck.Parsing.Symbols.Declaration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。