├── .gitattributes ├── .gitignore ├── .travis.yml ├── ICSharpCode.NRefactory.CSharp.AstVerifier ├── AssemblyInfo.cs ├── ICSharpCode.NRefactory.CSharp.AstVerifier.csproj └── Main.cs ├── ICSharpCode.NRefactory.CSharp.Refactoring ├── CodeActions │ ├── AbstractAndVirtualConversionAction.cs │ ├── AddAnotherAccessorAction.cs │ ├── AddArgumentNameAction.cs │ ├── AddBracesAction.cs │ ├── AddCatchTypeAction.cs │ ├── AddExceptionDescriptionAction.cs │ ├── AddOptionalParameterToInvocationAction.cs │ ├── AddUsingAction.cs │ ├── AutoLinqSumAction.cs │ ├── CS1105ExtensionMethodMustBeDeclaredStaticAction.cs │ ├── CS1520MethodMustHaveAReturnTypeAction.cs │ ├── ChangeAccessModifierAction.cs │ ├── CheckIfParameterIsNullAction.cs │ ├── ComputeConstantValueAction.cs │ ├── ConvertAnonymousDelegateToLambdaAction.cs │ ├── ConvertAsToCastAction.cs │ ├── ConvertAssignmentToIfAction.cs │ ├── ConvertBitwiseFlagComparisonToHasFlagsAction.cs │ ├── ConvertCastToAsAction.cs │ ├── ConvertDecToHexAction.cs │ ├── ConvertDoWhileToWhileLoopAction.cs │ ├── ConvertEqualityOperatorToEqualsAction.cs │ ├── ConvertEqualsToEqualityOperatorAction.cs │ ├── ConvertExplicitToImplicitImplementationAction.cs │ ├── ConvertForToWhileAction.cs │ ├── ConvertForeachToForAction.cs │ ├── ConvertHasFlagsToBitwiseFlagComparisonAction.cs │ ├── ConvertHexToDecAction.cs │ ├── ConvertIfStatementToConditionalTernaryExpressionAction.cs │ ├── ConvertIfStatementToNullCoalescingExpressionAction.cs │ ├── ConvertIfStatementToReturnStatementAction.cs │ ├── ConvertIfStatementToSwitchStatementAction.cs │ ├── ConvertImplicitToExplicitImplementationAction.cs │ ├── ConvertLambdaBodyExpressionToStatementAction.cs │ ├── ConvertLambdaBodyStatementToExpressionAction.cs │ ├── ConvertLambdaToAnonymousDelegateAction.cs │ ├── ConvertMethodGroupToAnonymousMethodAction.cs │ ├── ConvertMethodGroupToLambdaAction.cs │ ├── ConvertMultiplyToShiftAction.cs │ ├── ConvertNullCoalescingToConditionalExpressionAction.cs │ ├── ConvertReturnStatementToIfAction.cs │ ├── ConvertShiftToMultiplyAction.cs │ ├── ConvertSwitchToIfAction.cs │ ├── ConvertToInitializer │ │ ├── AccessPath.cs │ │ ├── ConvertInitializerToExplicitInitializationsAction.cs │ │ ├── ConvertToInitializerAction.cs │ │ └── StatementsToInitializerConverter.cs │ ├── ConvertWhileToDoWhileLoopAction.cs │ ├── CopyCommentsFromBase.cs │ ├── CopyCommentsFromInterface.cs │ ├── CreateBackingStoreAction.cs │ ├── CreateChangedEventAction.cs │ ├── CreateClassDeclarationAction.cs │ ├── CreateConstructorDeclarationAction.cs │ ├── CreateCustomEventImplementationAction.cs │ ├── CreateDelegateAction.cs │ ├── CreateEnumValue.cs │ ├── CreateEventInvocatorAction.cs │ ├── CreateFieldAction.cs │ ├── CreateIndexerAction.cs │ ├── CreateLocalVariableAction.cs │ ├── CreateMethodDeclarationAction.cs │ ├── CreateOverloadWithoutParameterAction.cs │ ├── CreatePropertyAction.cs │ ├── DeclareLocalVariableAction.cs │ ├── ExtensionMethodInvocationToStaticMethodInvocationAction.cs │ ├── ExtractAnonymousMethodAction.cs │ ├── ExtractFieldAction.cs │ ├── ExtractMethod │ │ ├── ExtractMethodAction.cs │ │ ├── StaticVisitor.cs │ │ ├── VariableLookupVisitor.cs │ │ └── VariableUsageAnalyzation.cs │ ├── ExtractWhileConditionToInternalIfStatementAction.cs │ ├── FlipEqualsTargetAndArgumentAction.cs │ ├── FlipOperatorArgumentsAction.cs │ ├── GenerateGetterAction.cs │ ├── GeneratePropertyAction.cs │ ├── GenerateSwitchLabelsAction.cs │ ├── ImplementAbstractMembersAction.cs │ ├── ImplementInterfaceAction.cs │ ├── ImplementInterfaceExplicitAction.cs │ ├── ImplementNotImplementedProperty.cs │ ├── InlineLocalVariableAction.cs │ ├── InsertAnonymousMethodSignatureAction.cs │ ├── IntroduceConstantAction.cs │ ├── IntroduceFormatItemAction.cs │ ├── InvertConditionalOperatorAction.cs │ ├── InvertIfAction.cs │ ├── InvertIfAndSimplify.cs │ ├── InvertLogicalExpressionAction.cs │ ├── IterateViaForeachAction.cs │ ├── JoinDeclarationAndAssignmentAction.cs │ ├── JoinStringAction.cs │ ├── LinqFluentToQueryAction.cs │ ├── LinqQueryToFluentAction.cs │ ├── MergeNestedIfAction.cs │ ├── MoveToOuterScopeAction.cs │ ├── NegateIsExpressionAction.cs │ ├── NegateRelationalExpressionAction.cs │ ├── PutInsideUsingAction.cs │ ├── RemoveBackingStoreAction.cs │ ├── RemoveBracesAction.cs │ ├── RemoveRedundantCatchTypeAction.cs │ ├── RemoveRegionAction.cs │ ├── ReplaceAssignmentWithPostfixExpressionAction.cs │ ├── ReplaceEmptyStringAction.cs │ ├── ReplaceOperatorAssignmentWithAssignmentAction.cs │ ├── ReplacePostfixExpressionWithAssignmentAction.cs │ ├── ReplaceWithOperatorAssignmentAction.cs │ ├── ReverseDirectionForForLoopAction.cs │ ├── SimplifyIfFlowAction.cs │ ├── SimplifyIfInLoopsFlowAction.cs │ ├── SortUsingsAction.cs │ ├── SpecializedCodeAction.cs │ ├── SplitDeclarationAndAssignmentAction.cs │ ├── SplitDeclarationListAction.cs │ ├── SplitIfAction.cs │ ├── SplitStringAction.cs │ ├── UseAsAndNullCheckAction.cs │ ├── UseExplicitTypeAction.cs │ ├── UseStringFormatAction.cs │ └── UseVarKeywordAction.cs ├── CodeIssues │ ├── Custom │ │ ├── AdditionalOfTypeIssues.cs │ │ ├── BaseMethodParameterNameMismatchIssue.cs │ │ ├── CallToObjectEqualsViaBaseIssue.cs │ │ ├── CastExpressionOfIncompatibleTypeIssue.cs │ │ ├── CheckNamespaceIssue.cs │ │ ├── CompilerErrors │ │ │ ├── CS0029InvalidConversionIssue.cs │ │ │ ├── CS0126ReturnMustBeFollowedByAnyExpression.cs │ │ │ ├── CS0127ReturnMustNotBeFollowedByAnyExpression.cs │ │ │ ├── CS0152DuplicateCaseLabelValueIssue.cs │ │ │ ├── CS0169FieldIsNeverUsedIssue.cs │ │ │ ├── CS0618UsageOfObsoleteMemberIssue.cs │ │ │ ├── CS0659OverrideEqualWithoutGetHashCode.cs │ │ │ ├── CS0759RedundantPartialMethodIssue.cs │ │ │ ├── CS1729TypeHasNoConstructorWithNArgumentsIssue.cs │ │ │ ├── ExpressionIsNeverOfProvidedTypeIssue.cs │ │ │ ├── MissingInterfaceMemberImplementationIssue.cs │ │ │ └── StaticConstructorParameterIssue.cs │ │ ├── ConstantConditionIssue.cs │ │ ├── ConvertIfToAndExpressionIssue.cs │ │ ├── LockThisIssue.cs │ │ ├── MixedUseOfFieldsAndGettersIssue.cs │ │ ├── NegativeRelationalExpressionIssue.cs │ │ ├── NotImplementedExceptionIssue.cs │ │ ├── ParameterOnlyAssignedIssue.cs │ │ ├── RedundantAssignmentIssue.cs │ │ ├── RedundantInternalIssue.cs │ │ ├── RedundantPrivateIssue.cs │ │ ├── StaticEventSubscriptionIssue.cs │ │ ├── UnreachableCodeIssue.cs │ │ ├── VariableOnlyAssignedIssue.cs │ │ └── XmlDocIssue.cs │ ├── GatherVisitorBase.cs │ ├── IssueCategories.cs │ ├── NotWorking │ │ ├── AccessToClosureIssues │ │ │ ├── AccessToClosureIssue.cs │ │ │ ├── AccessToDisposedClosureIssue.cs │ │ │ ├── AccessToModifiedClosureIssue.cs │ │ │ └── LocalVariableNamePicker.cs │ │ ├── DuplicateBodyMethodIssue.cs │ │ ├── DuplicateExpressionsInConditionsIssue.cs │ │ ├── DuplicateIfInIfChainIssue.cs │ │ ├── ParameterCanBeIEnumerableIssue.cs │ │ └── VariableDeclaredInWideScopeIssue.cs │ ├── RefactoringExtensions.cs │ ├── Synced │ │ ├── CodeQuality │ │ │ ├── BaseMethodCallWithDefaultParameterIssue.cs │ │ │ ├── BitwiseOperatorOnEnumWithoutFlagsIssue.cs │ │ │ ├── CanBeReplacedWithTryCastAndCheckForNullIssue.cs │ │ │ ├── CompareNonConstrainedGenericWithNullIssue.cs │ │ │ ├── CompareOfFloatsByEqualityOperatorIssue.cs │ │ │ ├── ConditionalTernaryEqualBranchIssue.cs │ │ │ ├── DelegateSubtractionIssue.cs │ │ │ ├── DoNotCallOverridableMethodsInConstructorIssue.cs │ │ │ ├── EmptyGeneralCatchClauseIssue.cs │ │ │ ├── EqualExpressionComparisonIssue.cs │ │ │ ├── EventUnsubscriptionViaAnonymousDelegateIssue.cs │ │ │ ├── ForControlVariableIsNeverModifiedIssue.cs │ │ │ ├── FormatStringProblemIssue.cs │ │ │ ├── FunctionNeverReturnsIssue.cs │ │ │ ├── LocalVariableHidesMemberIssue.cs │ │ │ ├── LongLiteralEndingLowerLIssue.cs │ │ │ ├── MemberHidesStaticFromOuterClassIssue.cs │ │ │ ├── MethodOverloadWithOptionalParameterIssue.cs │ │ │ ├── NonReadonlyReferencedInGetHashCodeIssue.cs │ │ │ ├── NotResolvedInTextIssue.cs │ │ │ ├── ObjectCreationAsStatementIssue.cs │ │ │ ├── OperatorIsCanBeUsedIssue.cs │ │ │ ├── OptionalParameterHierarchyMismatchIssue.cs │ │ │ ├── OptionalParameterRefOutIssue.cs │ │ │ ├── ParameterHidesMemberIssue.cs │ │ │ ├── PartialMethodParameterNameMismatchIssue.cs │ │ │ ├── PolymorphicFieldLikeEventInvocationIssue.cs │ │ │ ├── PossibleAssignmentToReadonlyFieldIssue.cs │ │ │ ├── PossibleMultipleEnumerationIssue.cs │ │ │ ├── StaticFieldInGenericTypeIssue.cs │ │ │ ├── ThreadStaticAtInstanceFieldIssue.cs │ │ │ └── ValueParameterNotUsedIssue.cs │ │ ├── CompilerErrors │ │ │ └── ProhibitedModifiersIssue.cs │ │ ├── CompilerWarnings │ │ │ ├── CS0183ExpressionIsAlwaysOfProvidedTypeIssue.cs │ │ │ ├── CS1573ParameterHasNoMatchingParamTagIssue.cs │ │ │ ├── CS1717AssignmentMadeToSameVariableIssue.cs │ │ │ └── UnassignedReadonlyFieldIssue.cs │ │ ├── ConstraintViolations │ │ │ └── InconsistentNamingIssue │ │ │ │ ├── AffectedEntity.cs │ │ │ │ ├── DefaultRules.cs │ │ │ │ ├── InconsistentNamingIssue.cs │ │ │ │ ├── NamingConventionService.cs │ │ │ │ ├── NamingRule.cs │ │ │ │ └── NamingStyle.cs │ │ ├── NUnit │ │ │ └── NonPublicMethodWithTestAttributeIssue.cs │ │ ├── Opportunities │ │ │ ├── ConvertClosureToMethodGroupIssue.cs │ │ │ ├── ConvertConditionalTernaryToNullCoalescingIssue.cs │ │ │ ├── ConvertIfStatementToConditionalTernaryExpressionIssue.cs │ │ │ ├── ConvertIfStatementToNullCoalescingExpressionIssue.cs │ │ │ ├── ConvertIfStatementToSwitchStatementIssue.cs │ │ │ ├── ConvertNullableToShortFormIssue.cs │ │ │ ├── ConvertToAutoPropertyIssue.cs │ │ │ ├── ConvertToLambdaExpressionIssue.cs │ │ │ ├── ConvertToStaticTypeIssue.cs │ │ │ ├── ForCanBeConvertedToForeachIssue.cs │ │ │ ├── InvokeAsExtensionMethodIssue.cs │ │ │ ├── RewriteIfReturnToReturnIssue.cs │ │ │ └── SuggestUseVarKeywordEvidentIssue.cs │ │ ├── PracticesAndImprovements │ │ │ ├── AccessToStaticMemberViaDerivedTypeIssue.cs │ │ │ ├── BaseMemberHasParamsIssue.cs │ │ │ ├── ConvertIfDoToWhileIssue.cs │ │ │ ├── ConvertIfToOrExpressionIssue.cs │ │ │ ├── ConvertToConstantIssue.cs │ │ │ ├── EmptyEmbeddedStatementIssue.cs │ │ │ ├── FieldCanBeMadeReadOnlyIssue.cs │ │ │ ├── MemberCanBeMadeStaticIssue.cs │ │ │ ├── ParameterCanBeDeclaredWithBaseTypeIssue.cs │ │ │ ├── PossibleMistakenCallToGetTypeIssue.cs │ │ │ ├── PublicConstructorInAbstractClass.cs │ │ │ ├── ReferenceEqualsWithValueTypeIssue.cs │ │ │ ├── ReplaceWithFirstOrDefaultIssue.cs │ │ │ ├── ReplaceWithLastOrDefaultIssue.cs │ │ │ ├── ReplaceWithOfTypeAny.cs │ │ │ ├── ReplaceWithOfTypeCountIssue.cs │ │ │ ├── ReplaceWithOfTypeFirstIssue.cs │ │ │ ├── ReplaceWithOfTypeFirstOrDefaultIssue.cs │ │ │ ├── ReplaceWithOfTypeIssue.cs │ │ │ ├── ReplaceWithOfTypeLastIssue.cs │ │ │ ├── ReplaceWithOfTypeLastOrDefaultIssue.cs │ │ │ ├── ReplaceWithOfTypeLongCountIssue.cs │ │ │ ├── ReplaceWithOfTypeSingleIssue.cs │ │ │ ├── ReplaceWithOfTypeSingleOrDefaultIssue.cs │ │ │ ├── ReplaceWithOfTypeWhereIssue.cs │ │ │ ├── ReplaceWithSimpleAssignmentIssue.cs │ │ │ ├── ReplaceWithSingleCallToAnyIssue.cs │ │ │ ├── ReplaceWithSingleCallToAverageIssue.cs │ │ │ ├── ReplaceWithSingleCallToCountIssue.cs │ │ │ ├── ReplaceWithSingleCallToFirstIssue.cs │ │ │ ├── ReplaceWithSingleCallToFirstOrDefaultIssue.cs │ │ │ ├── ReplaceWithSingleCallToLastIssue.cs │ │ │ ├── ReplaceWithSingleCallToLastOrDefaultIssue.cs │ │ │ ├── ReplaceWithSingleCallToLongCountIssue.cs │ │ │ ├── ReplaceWithSingleCallToMaxIssue.cs │ │ │ ├── ReplaceWithSingleCallToMinIssue.cs │ │ │ ├── ReplaceWithSingleCallToSingleIssue.cs │ │ │ ├── ReplaceWithSingleCallToSingleOrDefaultIssue.cs │ │ │ ├── ReplaceWithSingleCallToSumIssue.cs │ │ │ ├── ReplaceWithStringIsNullOrEmptyIssue.cs │ │ │ ├── SimplifyConditionalTernaryExpressionIssue.cs │ │ │ ├── SimplifyLinqExpressionIssue.cs │ │ │ ├── StringCompareIsCultureSpecificIssue.cs │ │ │ ├── StringCompareToIsCultureSpecificIssue.cs │ │ │ ├── StringEndsWithIsCultureSpecificIssue.cs │ │ │ ├── StringIndexOfIsCultureSpecificIssue.cs │ │ │ ├── StringLastIndexOfIsCultureSpecificIssue.cs │ │ │ ├── StringStartsWithIsCultureSpecificIssue.cs │ │ │ ├── UseArrayCreationExpressionIssue.cs │ │ │ ├── UseIsOperatorIssue.cs │ │ │ ├── UseMethodAnyIssue.cs │ │ │ └── UseMethodIsInstanceOfTypeIssue.cs │ │ ├── RedundanciesInCode │ │ │ ├── ArrayCreationCanBeReplacedWithArrayInitializerIssue.cs │ │ │ ├── ConditionIsAlwaysTrueOrFalseIssue.cs │ │ │ ├── ConstantNullCoalescingConditionIssue.cs │ │ │ ├── DoubleNegationOperatorIssue.cs │ │ │ ├── EmptyStatementIssue.cs │ │ │ ├── ForStatementConditionIsTrueIssue.cs │ │ │ ├── RedundantAnonymousTypePropertyNameIssue.cs │ │ │ ├── RedundantArgumentDefaultValueIssue.cs │ │ │ ├── RedundantArgumentNameIssue.cs │ │ │ ├── RedundantAttributeParenthesesIssue.cs │ │ │ ├── RedundantBaseQualifierIssue.cs │ │ │ ├── RedundantBoolCompareIssue.cs │ │ │ ├── RedundantCaseLabelIssue.cs │ │ │ ├── RedundantCastIssue.cs │ │ │ ├── RedundantCatchClauseIssue.cs │ │ │ ├── RedundantCheckBeforeAssignmentIssue.cs │ │ │ ├── RedundantCommaInArrayInitializerIssue.cs │ │ │ ├── RedundantComparisonWithNullIssue.cs │ │ │ ├── RedundantDelegateCreationIssue.cs │ │ │ ├── RedundantEmptyDefaultSwitchBranchIssue.cs │ │ │ ├── RedundantEmptyFinallyBlockIssue.cs │ │ │ ├── RedundantEmptyObjectCreationArgumentListssue.cs │ │ │ ├── RedundantEnumerableCastCallIssue.cs │ │ │ ├── RedundantExplicitArrayCreationIssue.cs │ │ │ ├── RedundantExplicitArraySizeIssue.cs │ │ │ ├── RedundantExplicitNullableCreationIssue.cs │ │ │ ├── RedundantExtendsListEntryIssue.cs │ │ │ ├── RedundantIfElseBlockIssue.cs │ │ │ ├── RedundantLambdaParameterTypeIssue.cs │ │ │ ├── RedundantLambdaSignatureParenthesesIssue.cs │ │ │ ├── RedundantLogicalConditionalExpressionOperandIssue.cs │ │ │ ├── RedundantNameQualifierIssue.cs │ │ │ ├── RedundantObjectOrCollectionInitializerIssue.cs │ │ │ ├── RedundantStringToCharArrayCallIssue.cs │ │ │ ├── RedundantTernaryExpressionIssue.cs │ │ │ ├── RedundantThisQualifierIssue.cs │ │ │ ├── RedundantToStringCallForValueTypesIssue.cs │ │ │ ├── RedundantToStringCallIssue.cs │ │ │ ├── RedundantUnsafeContextIssue.cs │ │ │ ├── RedundantUsingDirectiveIssue.cs │ │ │ ├── RemoveRedundantOrStatementIssue.cs │ │ │ └── UnusedAnonymousMethodSignatureIssue.cs │ │ └── RedundanciesInDeclaration │ │ │ ├── EmptyConstructorIssue.cs │ │ │ ├── EmptyDestructorIssue.cs │ │ │ ├── EmptyNamespaceIssue.cs │ │ │ ├── EnumUnderlyingTypeIsIntIssue.cs │ │ │ ├── LocalVariableNotUsedIssue.cs │ │ │ ├── PartialTypeWithSinglePartIssue.cs │ │ │ ├── RedundantBaseConstructorCallIssue.cs │ │ │ ├── RedundantDefaultFieldInitializerIssue.cs │ │ │ ├── RedundantOverridenMemberIssue.cs │ │ │ ├── RedundantParamsIssue.cs │ │ │ ├── SealedMemberInSealedClassIssue.cs │ │ │ ├── UnusedLabelIssue.cs │ │ │ ├── UnusedParameterIssue.cs │ │ │ └── UnusedTypeParameterIssue.cs │ ├── TODO │ │ ├── ConvertTailRecursiveCallToLoopIssue.cs │ │ ├── LoopCanBeConvertedToQueryIssue.cs │ │ ├── PartOfBodyCanBeConvertedToQueryIssue.cs │ │ └── RedundantTypeArgumentsOfMethodIssue.cs │ └── Uncategorized │ │ ├── AutoAsyncIssue.cs │ │ ├── DisposeMethodInNonIDisposableTypeIssue.cs │ │ ├── DontUseLinqWhenItsVerboseAndInefficientIssue.cs │ │ ├── DuplicatedLinqToListOrArrayIssue.cs │ │ ├── ExceptionRethrowIssue.cs │ │ ├── ExplicitConversionInForEachIssue.cs │ │ ├── IncorrectCallToObjectGetHashCodeIssue.cs │ │ ├── RedundantBlockInDifferentBranchesIssue.cs │ │ ├── RedundantNotNullAttributeInNonNullableTypeIssue.cs │ │ ├── ResultOfAsyncCallShouldNotBeIgnoredIssue.cs │ │ ├── SameGuardConditionExpressionInIfelseBranchesIssue.cs │ │ ├── UnmatchedSizeSpecificationInArrayCreationIssue.cs │ │ └── UseOfMemberOfNullReference.cs ├── ICSharpCode.NRefactory.CSharp.Refactoring.csproj └── Properties │ └── AssemblyInfo.cs ├── ICSharpCode.NRefactory.CSharp ├── Analysis │ ├── AnnotationNames.cs │ ├── ControlFlow.cs │ ├── DeclarationSpace │ │ ├── LocalDeclarationSpace.cs │ │ └── LocalDeclarationSpaceVisitor.cs │ ├── DefiniteAssignmentAnalysis.cs │ ├── NullValueAnalysis.cs │ ├── NullValueStatus.cs │ ├── ReachabilityAnalysis.cs │ └── SemanticHighlightingVisitor.cs ├── Ast │ ├── AstNode.cs │ ├── AstNodeCollection.cs │ ├── AstType.cs │ ├── CSharpModifierToken.cs │ ├── CSharpTokenNode.cs │ ├── CSharpUtil.cs │ ├── ComposedType.cs │ ├── DepthFirstAstVisitor.cs │ ├── DocumentationReference.cs │ ├── ErrorNode.cs │ ├── Expressions │ │ ├── AnonymousMethodExpression.cs │ │ ├── AnonymousTypeCreateExpression.cs │ │ ├── ArrayCreateExpression.cs │ │ ├── ArrayInitializerExpression.cs │ │ ├── AsExpression.cs │ │ ├── AssignmentExpression.cs │ │ ├── BaseReferenceExpression.cs │ │ ├── BinaryOperatorExpression.cs │ │ ├── CastExpression.cs │ │ ├── CheckedExpression.cs │ │ ├── ConditionalExpression.cs │ │ ├── DefaultValueExpression.cs │ │ ├── DirectionExpression.cs │ │ ├── ErrorExpression.cs │ │ ├── Expression.cs │ │ ├── IdentifierExpression.cs │ │ ├── IndexerExpression.cs │ │ ├── InvocationExpression.cs │ │ ├── IsExpression.cs │ │ ├── LambdaExpression.cs │ │ ├── MemberReferenceExpression.cs │ │ ├── NamedArgumentExpression.cs │ │ ├── NamedExpression.cs │ │ ├── NullReferenceExpression.cs │ │ ├── ObjectCreateExpression.cs │ │ ├── ParenthesizedExpression.cs │ │ ├── PointerReferenceExpression.cs │ │ ├── PrimitiveExpression.cs │ │ ├── QueryExpression.cs │ │ ├── SizeOfExpression.cs │ │ ├── StackAllocExpression.cs │ │ ├── ThisReferenceExpression.cs │ │ ├── TypeOfExpression.cs │ │ ├── TypeReferenceExpression.cs │ │ ├── UnaryOperatorExpression.cs │ │ ├── UncheckedExpression.cs │ │ └── UndocumentedExpression.cs │ ├── GeneralScope │ │ ├── Attribute.cs │ │ ├── AttributeSection.cs │ │ ├── Comment.cs │ │ ├── Constraint.cs │ │ ├── DelegateDeclaration.cs │ │ ├── ExternAliasDeclaration.cs │ │ ├── NamespaceDeclaration.cs │ │ ├── NewLineNode.cs │ │ ├── PreProcessorDirective.cs │ │ ├── TextNode.cs │ │ ├── TypeDeclaration.cs │ │ ├── TypeParameterDeclaration.cs │ │ ├── UsingAliasDeclaration.cs │ │ ├── UsingDeclaration.cs │ │ └── WhitespaceNode.cs │ ├── IAstVisitor.cs │ ├── Identifier.cs │ ├── IdentifierExpressionBackreference.cs │ ├── MemberType.cs │ ├── Modifiers.cs │ ├── NodeType.cs │ ├── ObservableAstVisitor.cs │ ├── PrimitiveType.cs │ ├── Roles.cs │ ├── SimpleType.cs │ ├── Statements │ │ ├── BlockStatement.cs │ │ ├── BreakStatement.cs │ │ ├── CheckedStatement.cs │ │ ├── ContinueStatement.cs │ │ ├── DoWhileStatement.cs │ │ ├── EmptyStatement.cs │ │ ├── ExpressionStatement.cs │ │ ├── FixedStatement.cs │ │ ├── ForStatement.cs │ │ ├── ForeachStatement.cs │ │ ├── GotoStatement.cs │ │ ├── IfElseStatement.cs │ │ ├── LabelStatement.cs │ │ ├── LockStatement.cs │ │ ├── ReturnStatement.cs │ │ ├── Statement.cs │ │ ├── SwitchStatement.cs │ │ ├── ThrowStatement.cs │ │ ├── TryCatchStatement.cs │ │ ├── UncheckedStatement.cs │ │ ├── UnsafeStatement.cs │ │ ├── UsingStatement.cs │ │ ├── VariableDeclarationStatement.cs │ │ ├── WhileStatement.cs │ │ ├── YieldBreakStatement.cs │ │ └── YieldReturnStatement.cs │ ├── SyntaxExtensions.cs │ ├── SyntaxTree.cs │ ├── TokenRole.cs │ └── TypeMembers │ │ ├── Accessor.cs │ │ ├── ConstructorDeclaration.cs │ │ ├── DestructorDeclaration.cs │ │ ├── EntityDeclaration.cs │ │ ├── EnumMemberDeclaration.cs │ │ ├── EventDeclaration.cs │ │ ├── FieldDeclaration.cs │ │ ├── FixedFieldDeclaration.cs │ │ ├── FixedVariableInitializer.cs │ │ ├── IndexerDeclaration.cs │ │ ├── MethodDeclaration.cs │ │ ├── OperatorDeclaration.cs │ │ ├── ParameterDeclaration.cs │ │ ├── PropertyDeclaration.cs │ │ └── VariableInitializer.cs ├── CSharpProjectContent.cs ├── CombineQueryExpressions.cs ├── Completion │ ├── CSharpCompletionEngine.cs │ ├── CSharpCompletionEngineBase.cs │ ├── CSharpParameterCompletionEngine.cs │ ├── CompletionDataWrapper.cs │ ├── ICompletionContextProvider.cs │ ├── ICompletionDataFactory.cs │ └── IParameterCompletionDataFactory.cs ├── Formatter │ ├── CSharpFormatter.cs │ ├── CSharpFormattingOptions.cs │ ├── ConstructFixer.cs │ ├── FormattingChanges.cs │ ├── FormattingOptionsFactory.cs │ ├── FormattingVisitor.cs │ ├── FormattingVisitor_Expressions.cs │ ├── FormattingVisitor_Global.cs │ ├── FormattingVisitor_Query.cs │ ├── FormattingVisitor_Statements.cs │ ├── FormattingVisitor_TypeMembers.cs │ ├── GeneratedCodeSettings.cs │ ├── Indent.cs │ └── TextEditorOptions.cs ├── ICSharpCode.NRefactory.CSharp.csproj ├── IndentEngine │ ├── CSharpIndentEngine.cs │ ├── CacheIndentEngine.cs │ ├── IDocumentIndentEngine.cs │ ├── IStateMachineIndentEngine.cs │ ├── IndentState.cs │ ├── NullIStateMachineIndentEngine.cs │ └── TextPasteIndentEngine.cs ├── IntroduceQueryExpressions.cs ├── NameLookupMode.cs ├── OutputVisitor │ ├── CSharpAmbience.cs │ ├── CSharpOutputVisitor.cs │ ├── CodeDomConvertVisitor.cs │ ├── ITokenWriter.cs │ ├── InsertMissingTokensDecorator.cs │ ├── InsertParenthesesVisitor.cs │ ├── InsertRequiredSpacesDecorator.cs │ ├── InsertSpecialsDecorator.cs │ └── TextWriterOutputFormatter.cs ├── Parser │ ├── CSharpParser.cs │ ├── CompilerSettings.cs │ ├── SeekableStreamReader.cs │ └── mcs │ │ ├── CryptoConvert.cs │ │ ├── MonoSymbolFile.cs │ │ ├── MonoSymbolTable.cs │ │ ├── MonoSymbolWriter.cs │ │ ├── SourceMethodBuilder.cs │ │ ├── anonymous.cs │ │ ├── argument.cs │ │ ├── assembly.cs │ │ ├── assign.cs │ │ ├── async.cs │ │ ├── attribute.cs │ │ ├── cfold.cs │ │ ├── class.cs │ │ ├── codegen.cs │ │ ├── complete.cs │ │ ├── const.cs │ │ ├── constant.cs │ │ ├── context.cs │ │ ├── convert.cs │ │ ├── cs-parser.cs │ │ ├── cs-parser.jay │ │ ├── cs-tokenizer.cs │ │ ├── decl.cs │ │ ├── delegate.cs │ │ ├── doc.cs │ │ ├── driver.cs │ │ ├── dynamic.cs │ │ ├── ecore.cs │ │ ├── enum.cs │ │ ├── eval.cs │ │ ├── expression.cs │ │ ├── field.cs │ │ ├── flowanalysis.cs │ │ ├── generic.cs │ │ ├── import.cs │ │ ├── iterators.cs │ │ ├── lambda.cs │ │ ├── linq.cs │ │ ├── literal.cs │ │ ├── location.cs │ │ ├── membercache.cs │ │ ├── method.cs │ │ ├── modifiers.cs │ │ ├── module.cs │ │ ├── namespace.cs │ │ ├── nullable.cs │ │ ├── outline.cs │ │ ├── parameter.cs │ │ ├── pending.cs │ │ ├── property.cs │ │ ├── reflection.cs │ │ ├── report.cs │ │ ├── settings.cs │ │ ├── statement.cs │ │ ├── support.cs │ │ ├── symbolwriter.cs │ │ ├── typemanager.cs │ │ ├── typespec.cs │ │ └── visit.cs ├── PatternMatching │ └── AnyType.cs ├── Properties │ └── AssemblyInfo.cs ├── QueryExpressionExpander.cs ├── Refactoring │ ├── BaseRefactoringContext.cs │ ├── CodeAction.cs │ ├── CodeActionProvider.cs │ ├── CodeActions │ │ └── RemoveFieldRefactoryActionRefactoringAction.cs │ ├── CodeGenerationService.cs │ ├── CodeIssue.cs │ ├── CodeIssueProvider.cs │ ├── CommonSubIssues.cs │ ├── ContextActionAttribute.cs │ ├── DocumentScript.cs │ ├── FormatStringHelper.cs │ ├── IssueAttribute.cs │ ├── LambdaHelper.cs │ ├── LocalReferenceFinder.cs │ ├── NamingHelper.cs │ ├── PatternHelper.cs │ ├── RefactoringAstHelper.cs │ ├── RefactoringContext.cs │ ├── Script.cs │ ├── TypeGuessing.cs │ ├── TypeSystemAstBuilder.cs │ ├── UsingHelper.cs │ ├── VariableReferenceGraph.cs │ └── WordParser.cs ├── Resolver │ ├── AliasNamespaceResolveResult.cs │ ├── AliasTypeResolveResult.cs │ ├── AwaitResolveResult.cs │ ├── CSharpAstResolver.cs │ ├── CSharpConversions.cs │ ├── CSharpInvocationResolveResult.cs │ ├── CSharpOperators.cs │ ├── CSharpResolver.cs │ ├── CastResolveResult.cs │ ├── CompositeResolveVisitorNavigator.cs │ ├── DetectSkippableNodesNavigator.cs │ ├── DynamicInvocationResolveResult.cs │ ├── DynamicMemberResolveResult.cs │ ├── FindReferenceSearchScope.cs │ ├── FindReferencedEntities.cs │ ├── FindReferences.cs │ ├── IResolveVisitorNavigator.cs │ ├── LambdaResolveResult.cs │ ├── Log.cs │ ├── MemberLookup.cs │ ├── MethodGroupResolveResult.cs │ ├── NodeListResolveVisitorNavigator.cs │ ├── OverloadResolution.cs │ ├── OverloadResolutionErrors.cs │ ├── ReducedExtensionMethod.cs │ ├── RenameCallbackArguments.cs │ ├── ResolveAtLocation.cs │ ├── ResolveVisitor.cs │ └── TypeInference.cs ├── TypeSystem │ ├── AliasNamespaceReference.cs │ ├── AttributeTypeReference.cs │ ├── CSharpAssembly.cs │ ├── CSharpAttribute.cs │ ├── CSharpDocumentationComment.cs │ ├── CSharpTypeResolveContext.cs │ ├── CSharpUnresolvedFile.cs │ ├── CSharpUnresolvedTypeDefinition.cs │ ├── ConstantValues.cs │ ├── MemberTypeOrNamespaceReference.cs │ ├── MethodTypeParameterWithInheritedConstraints.cs │ ├── ResolvedUsingScope.cs │ ├── SimpleTypeOrNamespaceReference.cs │ ├── TypeOrNamespaceReference.cs │ ├── TypeSystemConvertVisitor.cs │ └── UsingScope.cs └── Util │ └── CloneableStack.cs ├── ICSharpCode.NRefactory.Cecil ├── CecilLoader.cs ├── ICSharpCode.NRefactory.Cecil.csproj ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── ICSharpCode.NRefactory.ConsistencyCheck ├── CSharpFile.cs ├── CSharpProject.cs ├── FindReferencesConsistencyCheck.cs ├── ICSharpCode.NRefactory.ConsistencyCheck.csproj ├── PatternMatchingTest.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── RandomizedOrderResolverTest.cs ├── Readme.txt ├── ResolverTest.cs ├── RoundtripTest.cs ├── Solution.cs ├── TypeSystemTests.cs ├── VisitorBenchmark.cs ├── Xml │ ├── IncrementalXmlParserTests.cs │ └── XmlReaderTest.cs └── app.config ├── ICSharpCode.NRefactory.Demo ├── CSDemo.Designer.cs ├── CSDemo.cs ├── CSDemo.resx ├── ICSharpCode.NRefactory.Demo.csproj ├── MainForm.Designer.cs ├── MainForm.cs ├── MainForm.resx ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── SemanticTreeDialog.Designer.cs ├── SemanticTreeDialog.cs ├── SemanticTreeDialog.resx ├── VBAstView.Designer.cs ├── VBAstView.cs ├── VBAstView.resx ├── VBDemo.Designer.cs ├── VBDemo.cs ├── VBDemo.resx ├── VBEditDialog.Designer.cs ├── VBEditDialog.cs └── VBEditDialog.resx ├── ICSharpCode.NRefactory.GtkDemo ├── AssemblyInfo.cs ├── CSharpDemo.cs ├── ICSharpCode.NRefactory.GtkDemo.csproj ├── Main.cs ├── MainWindow.cs ├── gtk-gui │ ├── ICSharpCode.NRefactory.GtkDemo.MainWindow.cs │ ├── generated.cs │ └── gui.stetic └── pixbuf │ ├── comment.png │ ├── element-class-16.png │ ├── element-field-16.png │ ├── element-literal-16.png │ ├── element-method-16.png │ └── element-namespace-16.png ├── ICSharpCode.NRefactory.IKVM ├── ICSharpCode.NRefactory.IKVM.csproj ├── IkvmLoader.cs ├── IntConstantValue.cs ├── NonFrozenInterningProvider.cs ├── Properties │ └── AssemblyInfo.cs ├── ShortConstantValue.cs ├── StringConstantValue.cs └── StructConstantValue.cs ├── ICSharpCode.NRefactory.Tests ├── Analysis │ ├── AbiComparerTests.cs │ └── SymbolCollectorTests.cs ├── CSharp │ ├── Analysis │ │ ├── DeclarationSpace │ │ │ ├── LocalDeclarationSpaceTests.cs │ │ │ └── LocalDeclarationSpaceVisitorTests.cs │ │ ├── DefiniteAssignmentTests.cs │ │ ├── NullValueAnalysisTests.cs │ │ └── SemanticHighlightingTests.cs │ ├── AstStructureTests.cs │ ├── AstTests.cs │ ├── CSharpAmbienceTests.cs │ ├── CSharpOutputVisitorTests.cs │ ├── CodeActions │ │ ├── AbstractAndVirtualConversionActionTests.cs │ │ ├── AddAnotherAccessorTests.cs │ │ ├── AddArgumentNameTests.cs │ │ ├── AddBracesActionTests.cs │ │ ├── AddCatchTypeTests.cs │ │ ├── AddExceptionDescriptionActionTests.cs │ │ ├── AddOptionalParameterToInvocationTests.cs │ │ ├── AddUsing │ │ │ ├── AddUsingActionAlphabeticalTests.cs │ │ │ ├── AddUsingActionInsideNamespaceTests.cs │ │ │ ├── AddUsingActionTests.cs │ │ │ └── AddUsingRunActionTests.cs │ │ ├── AutoLinqSumTests.cs │ │ ├── CS1105ExtensionMethodMustBeDeclaredStaticActionTests.cs │ │ ├── CS1520MethodMustHaveAReturnTypeTests.cs │ │ ├── ChangeAccessModifierTests.cs │ │ ├── CheckIfParameterIsNullTests.cs │ │ ├── ComputeConstantValueTests.cs │ │ ├── ContextActionTestBase.cs │ │ ├── ConvertAnonymousDelegateToLambdaTests.cs │ │ ├── ConvertAsToCastTests.cs │ │ ├── ConvertAssignmentToIfActionTests.cs │ │ ├── ConvertBitwiseFlagComparisonToHasFlagsActionTests.cs │ │ ├── ConvertCastToAsTests.cs │ │ ├── ConvertDecToHexTests.cs │ │ ├── ConvertDoWhileToWhileLoopTests.cs │ │ ├── ConvertEqualityOperatorToEqualsActionTests.cs │ │ ├── ConvertEqualsToEqualityOperatorActionTests.cs │ │ ├── ConvertExplicitToImplicitImplementationTests.cs │ │ ├── ConvertForToWhileActionTests.cs │ │ ├── ConvertForeachToForTests.cs │ │ ├── ConvertHasFlagsToBitwiseFlagComparisonActionTests.cs │ │ ├── ConvertHexToDecTests.cs │ │ ├── ConvertIfStatementToConditionalTernaryExpressionActionTests.cs │ │ ├── ConvertIfStatementToNullCoalescingExpressionActionTests.cs │ │ ├── ConvertIfStatementToReturnStatementActionTests.cs │ │ ├── ConvertIfStatementToSwitchStatementActionTests.cs │ │ ├── ConvertImplicitToExplicittImplementationTests.cs │ │ ├── ConvertLambdaBodyExpressionToStatementTests.cs │ │ ├── ConvertLambdaBodyStatementToExpressionTests.cs │ │ ├── ConvertLamdaToAnonymousDelegateTests.cs │ │ ├── ConvertMethodGroupToAnonymousMethodActionTests.cs │ │ ├── ConvertMethodGroupToLambdaActionTests.cs │ │ ├── ConvertMultiplyToShiftActionTests.cs │ │ ├── ConvertNullCoalescingToConditionalExpressionActionTests.cs │ │ ├── ConvertReturnStatementToIfActionTests.cs │ │ ├── ConvertShiftToMultiplyActionTests.cs │ │ ├── ConvertSwitchToIfTests.cs │ │ ├── ConvertToInitializer │ │ │ ├── ConvertInitializerToExplicitIntializationsTests.cs │ │ │ └── ConvertToInitializerTests.cs │ │ ├── ConvertWhileToDoWhileLoopTests.cs │ │ ├── CopyCommentsFromBaseTests.cs │ │ ├── CopyCommentsFromIntefaceTests.cs │ │ ├── CreateBackingStoreTests.cs │ │ ├── CreateChangedEventTests.cs │ │ ├── CreateClassDeclarationTests.cs │ │ ├── CreateConstructorDeclarationTests.cs │ │ ├── CreateCustomEventImplementationTests.cs │ │ ├── CreateDelegateTests.cs │ │ ├── CreateEnumValueTests.cs │ │ ├── CreateEventInvocatorTests.cs │ │ ├── CreateFieldTests.cs │ │ ├── CreateIndexerTests.cs │ │ ├── CreateLocalVariableTests.cs │ │ ├── CreateMethodDeclarationTests.cs │ │ ├── CreateOverloadWithoutParameterTests.cs │ │ ├── CreatePropertyTests.cs │ │ ├── DeclareLocalVariableTests.cs │ │ ├── ExtensionMethodInvocationToStaticMethodInvocationTests.cs │ │ ├── ExtractAnonymousMethodTests.cs │ │ ├── ExtractFieldTests.cs │ │ ├── ExtractMethodTests.cs │ │ ├── ExtractWhileConditionToInternalIfStatementActionTests.cs │ │ ├── FlipEqualsTargetAndArgumentActionTests.cs │ │ ├── FlipOperatorArgumentsTests.cs │ │ ├── GenerateGetterTests.cs │ │ ├── GeneratePropertyTests.cs │ │ ├── GenerateSwitchLabelsTests.cs │ │ ├── ImplementAbstractMembersTest.cs │ │ ├── ImplementInterfaceExplicitTests.cs │ │ ├── ImplementInterfaceTests.cs │ │ ├── ImplementNotImplementedPropertyTests.cs │ │ ├── InlineLocalVariableTests.cs │ │ ├── InsertAnonymousMethodSignatureTests.cs │ │ ├── IntroduceConstantTests.cs │ │ ├── IntroduceFormatItemTests.cs │ │ ├── InvertConditionalOperatorActionTests.cs │ │ ├── InvertIfAndSimplifyTests.cs │ │ ├── InvertIfTests.cs │ │ ├── InvertLogicalExpressionTests.cs │ │ ├── IterateViaForeachTests.cs │ │ ├── JoinDeclarationAndAssignmentTests.cs │ │ ├── JoinStringTests.cs │ │ ├── LinqFluentToQueryTests.cs │ │ ├── LinqQueryToFluentTests.cs │ │ ├── MergeNestedIfTests.cs │ │ ├── MetaTests.cs │ │ ├── MoveToOuterScopeTests.cs │ │ ├── NegateIsExpressionActionTests.cs │ │ ├── NegateRelationalExpressionTests.cs │ │ ├── PutInsideUsingTests.cs │ │ ├── RemoveBackingStoreTests.cs │ │ ├── RemoveBracesTests.cs │ │ ├── RemoveFieldRefactoryActionTests.cs │ │ ├── RemoveRedundantCatchTypeTests.cs │ │ ├── RemoveRegionTests.cs │ │ ├── ReplaceAssignmentWithPostfixExpressionActionTests.cs │ │ ├── ReplaceEmptyStringTests.cs │ │ ├── ReplaceOperatorAssignmentWithAssignmentActionTests.cs │ │ ├── ReplacePostfixExpressionWithAssignmentActionTests.cs │ │ ├── ReplaceWithOperatorAssignmentActionTests.cs │ │ ├── ReverseDirectionForForLoopTests.cs │ │ ├── SimplifyIfFlowInLoopsTests.cs │ │ ├── SimplifyIfFlowTests.cs │ │ ├── SortUsingsTests.cs │ │ ├── SplitDeclarationAndAssignmentTests.cs │ │ ├── SplitDeclarationListTests.cs │ │ ├── SplitIfActionTests.cs │ │ ├── SplitStringTests.cs │ │ ├── TestRefactoringContext.cs │ │ ├── UseAsAndNullCheckActionTests.cs │ │ ├── UseExplicitTypeTests.cs │ │ ├── UseStringFormatTests.cs │ │ └── UseVarKeywordTests.cs │ ├── CodeCompletion │ │ ├── BrowsableAttributeTests.cs │ │ ├── CodeCompletionAccessibleTests.cs │ │ ├── CodeCompletionBugTests.cs │ │ ├── CodeCompletionCSharp3Tests.cs │ │ ├── CodeCompletionCSharpTests.cs │ │ ├── CodeCompletionOperatorTests.cs │ │ ├── CompletionDataList.cs │ │ ├── DelegateContextTests.cs │ │ ├── DocumentationContextTests.cs │ │ ├── EnumContextTests.cs │ │ ├── FormatItemTests.cs │ │ ├── GetCurrentParameterIndexTests.cs │ │ ├── ImportCompletionTests.cs │ │ ├── KeywordTests.cs │ │ ├── NameContextTests.cs │ │ ├── ObjectInitializerTests.cs │ │ ├── ParameterCompletionTests.cs │ │ ├── PreProcessorTests.cs │ │ ├── TestBase.cs │ │ └── VariableDeclarationStatementTests.cs │ ├── CodeDomConvertVisitorTests.cs │ ├── CodeIssues │ │ ├── AccessToDisposedClosureTests.cs │ │ ├── AccessToModifiedClosureTests.cs │ │ ├── AccessToStaticMemberViaDerivedTypeIssueTests.cs │ │ ├── AdditionalOfTypeIssuesTests.cs │ │ ├── ArrayCreationCanBeReplacedWithArrayInitializerIssueTests.cs │ │ ├── AutoAsyncTests.cs │ │ ├── BaseMemberHasParamsIssueTests.cs │ │ ├── BaseMethodCallWithDefaultParameterIssueTests.cs │ │ ├── BaseMethodParameterNameMismatchIssueTests.cs │ │ ├── BitwiseOperatorOnEnumWithoutFlagsIssueTests.cs │ │ ├── CS0029InvalidConversionIssueTests.cs │ │ ├── CS0126ReturnMustBeFollowedByAnyExpressionTestes.cs │ │ ├── CS0127ReturnMustNotBeFollowedByAnyExpressionTests.cs │ │ ├── CS0152DuplicateCaseLabelValueIssueTests.cs │ │ ├── CS0169FieldIsNeverUsedIssueTests.cs │ │ ├── CS0183ExpressionIsAlwaysOfProvidedTypeIssueTests.cs │ │ ├── CS0618UsageOfObsoleteMemberIssueTests.cs │ │ ├── CS0659OverrideEqualsWithoutGetHashCodeTests.cs │ │ ├── CS0759RedundantPartialMethodIssueTests.cs │ │ ├── CS1573ParameterHasNoMatchingParamTagIssueTests.cs │ │ ├── CS1717AssignmentMadeToSameVariableIssueTests.cs │ │ ├── CS1729TypeHasNoConstructorWithNArgumentsIssueTests.cs │ │ ├── CallToObjectEqualsViaBaseTests.cs │ │ ├── CanBeReplacedWithTryCastAndCheckForNullIssueTests.cs │ │ ├── CastExpressionOfIncompatibleTypeIssueTests.cs │ │ ├── CheckNamespaceIssueTests.cs │ │ ├── CompareNonConstrainedGenericWithNullIssueTests.cs │ │ ├── CompareOfFloatsByEqualityOperatorIssueTests.cs │ │ ├── ConditionIsAlwaysTrueOrFalseIssueTests.cs │ │ ├── ConditionalTernaryEqualBranchTests.cs │ │ ├── ConstantConditionIssueTests.cs │ │ ├── ConstantNullCoalescingConditionIssueTests.cs │ │ ├── ConvertClosureToMethodGroupIssueTests.cs │ │ ├── ConvertConditionalTernaryToNullCoalescingIssueTests.cs │ │ ├── ConvertIfDoToWhileIssueTests.cs │ │ ├── ConvertIfStatementToConditionalTernaryExpressionIssueTests.cs │ │ ├── ConvertIfStatementToNullCoalescingExpressionIssueTests.cs │ │ ├── ConvertIfStatementToSwitchStatementIssueTests.cs │ │ ├── ConvertIfToAndExpressionIssueTests.cs │ │ ├── ConvertIfToOrExpressionIssueTests.cs │ │ ├── ConvertNullableToShortFormIssueTests.cs │ │ ├── ConvertTailRecursiveCallToLoopIssueTests.cs │ │ ├── ConvertToAutoPropertyIssueTests.cs │ │ ├── ConvertToConstantIssueTests.cs │ │ ├── ConvertToLambdaExpressionIssueTests.cs │ │ ├── ConvertToStaticTypeTests.cs │ │ ├── DelegateSubtractionIssueTests.cs │ │ ├── DisposeMethodInNonIDisposableTypeTests.cs │ │ ├── DoNotCallOverridableMethodsInConstructorIssueTests.cs │ │ ├── DontUseLinqWhenItsVerboseAndInefficientTests.cs │ │ ├── DoubleNegationOperatorIssueTests.cs │ │ ├── DuplicateBodyMethodIssueTests.cs │ │ ├── DuplicateExpressionsInConditionsIssueTests.cs │ │ ├── DuplicateIfInIfChainIssueTests.cs │ │ ├── DuplicatedLinqToListOrArrayTests.cs │ │ ├── EmptyConstructorIssueTests.cs │ │ ├── EmptyDestructorTests.cs │ │ ├── EmptyEmbeddedStatementIssueTests.cs │ │ ├── EmptyGeneralCatchClauseTests.cs │ │ ├── EmptyNamespaceTests.cs │ │ ├── EmptyStatementIssueTests.cs │ │ ├── EnumUnderlyingTypeIsIntTests.cs │ │ ├── EqualExpressionComparisonIssueTests.cs │ │ ├── EventUnsubscriptionViaAnonymousDelegateIssueTests.cs │ │ ├── ExceptionRethrowTests.cs │ │ ├── ExplicitConversionInForEachIssueTests.cs │ │ ├── ExpressionIsNeverOfProvidedTypeIssueTests.cs │ │ ├── FieldCanBeMadeReadOnlyIssueTests.cs │ │ ├── ForCanBeConvertedToForeachIssueTests.cs │ │ ├── ForControlVariableIsNeverModifiedIssueTests.cs │ │ ├── ForStatementConditionIsTrueTests.cs │ │ ├── FormatStringProblemIssueTests.cs │ │ ├── FunctionNeverReturnsIssueTests.cs │ │ ├── InconsistentNamingTests.cs │ │ ├── IncorrectCallToGetHashCodeTests.cs │ │ ├── InspectionActionTestBase.cs │ │ ├── InvokeAsExtensionMethodIssueTests.cs │ │ ├── LocalVariableHidesMemberIssueTests.cs │ │ ├── LocalVariableNotUsedIssueTests.cs │ │ ├── LockThisTests.cs │ │ ├── LongLiteralEndingLowerLIssueTests.cs │ │ ├── LoopCanBeConvertedToQueryIssueTests.cs │ │ ├── MemberCanBeMadeStaticIssueTests.cs │ │ ├── MemberHidesStaticFromOuterClassIssueTests.cs │ │ ├── MethodOverloadWithOptionalParameterIssueTests.cs │ │ ├── MissingInterfaceMemberImplementationIssueTests.cs │ │ ├── NegativeRelationalExpressionIssueTests.cs │ │ ├── NonPublicMethodWithTestAttributeIssueTests.cs │ │ ├── NonReadonlyReferencedInGetHashCodeTests.cs │ │ ├── NonReadonlyReferencedInGetHashCodeTetsts.cs │ │ ├── NotImplementedExceptionInspectorTests.cs │ │ ├── NotResolvedInTextIssueTests.cs │ │ ├── ObjectCreationAsStatementIssueTests.cs │ │ ├── OperatorIsCanBeUsedIssueTests.cs │ │ ├── OptionalParameterHierarchyMismatchIssueTests.cs │ │ ├── OptionalParameterRefOutIssueTests.cs │ │ ├── ParameterCanBeDemotedIssue │ │ │ ├── IsTypeCriterionTests.cs │ │ │ ├── ParameterCanBeDeclaredWithBaseTypeIssueTests.cs │ │ │ ├── ParameterCanBeIEnumerableTests.cs │ │ │ └── SupportsIndexingCriterionTests.cs │ │ ├── ParameterHidesMemberIssueTests.cs │ │ ├── ParameterOnlyAssignedIssueTests.cs │ │ ├── PartOfBodyCanBeConvertedToQueryIssueTests.cs │ │ ├── PartialMethodParameterNameMismatchIssueTests.cs │ │ ├── PartialTypeWithSinglePartIssueTests.cs │ │ ├── PolymorphicFieldLikeEventInvocationIssueTests.cs │ │ ├── PossibleAssignmentToReadonlyFieldIssueTests.cs │ │ ├── PossibleMistakenCallToGetTypeIssueTests.cs │ │ ├── PossibleMultipleEnumerationIssueTests.cs │ │ ├── ProhibitedModifiersIssueTests.cs │ │ ├── PublicConstructorInAbstractClassIssueTest.cs │ │ ├── RedundantAnonymousTypePropertyNameIssueTests.cs │ │ ├── RedundantArgumentDefaultValueIssueTests.cs │ │ ├── RedundantArgumentNameTests.cs │ │ ├── RedundantAssignmentIssueTests.cs │ │ ├── RedundantAttributeParenthesesIssueTests.cs │ │ ├── RedundantBaseConstructorIssueTests.cs │ │ ├── RedundantBaseQualifierTests.cs │ │ ├── RedundantBlockInDifferentBranchesTests.cs │ │ ├── RedundantBoolCompareIssueTests.cs │ │ ├── RedundantCaseLabelIssueTests.cs │ │ ├── RedundantCastIssueTests.cs │ │ ├── RedundantCatchClauseIssueTests.cs │ │ ├── RedundantCheckBeforeAssignmentTests.cs │ │ ├── RedundantCommaInArrayInitializerIssueTests.cs │ │ ├── RedundantComparisonWithNullIssueTests.cs │ │ ├── RedundantDefaultFieldInitializerIssueTests.cs │ │ ├── RedundantDelegateCreationIssueTests.cs │ │ ├── RedundantEmptyDefaultSwitchBranchIssueTests.cs │ │ ├── RedundantEmptyFinallyBlockIssueTests.cs │ │ ├── RedundantEnumerableCastCallIssueTests.cs │ │ ├── RedundantExplicitArrayCreationIssueTests.cs │ │ ├── RedundantExplicitArraySizeIssueTests.cs │ │ ├── RedundantExplicitNullableCreationIssueTests.cs │ │ ├── RedundantExtendsListEntryIssueTests.cs │ │ ├── RedundantIfElseBlockIssueTests.cs │ │ ├── RedundantInternalInspectorTests.cs │ │ ├── RedundantLambdaParameterTypeTests.cs │ │ ├── RedundantLambdaSignatureParenthesesIssueTests.cs │ │ ├── RedundantLogicalConditionalExpressionOperandIssueTests.cs │ │ ├── RedundantNameQualifierIssueTests.cs │ │ ├── RedundantNotNullAttributeInNonNullableTypeTests.cs │ │ ├── RedundantObjectCreationArgumentListIssueTests.cs │ │ ├── RedundantObjectOrCollectionInitializerIssueTests.cs │ │ ├── RedundantOverridenMemberTests.cs │ │ ├── RedundantParamsIssueTests.cs │ │ ├── RedundantPrivateInspectorTests.cs │ │ ├── RedundantStringToCharArrayCallIssueTests.cs │ │ ├── RedundantTernaryExpressionIssueTests.cs │ │ ├── RedundantThisQualifierIssueTests.cs │ │ ├── RedundantToStringCallForValueTypesIssue.cs │ │ ├── RedundantToStringCallIssueTests.cs │ │ ├── RedundantTypeArgumentsOfMethodIssueTests.cs │ │ ├── RedundantUnsafeContextIssueTests.cs │ │ ├── RedundantUsingDirectiveIssueTests.cs │ │ ├── RedundantWhereWithPredicateIssueTests.cs │ │ ├── ReferenceEqualsWithValueTypeIssueTests.cs │ │ ├── RemoveRedundantOrStatementIssueTests.cs │ │ ├── ReplaceWithFirstOrDefaultIssueTests.cs │ │ ├── ReplaceWithLastOrDefaultIssueTests.cs │ │ ├── ReplaceWithOfTypeAnyIssueTests.cs │ │ ├── ReplaceWithOfTypeCountIssueTests.cs │ │ ├── ReplaceWithOfTypeFirstIssueTests.cs │ │ ├── ReplaceWithOfTypeFirstOrDefaultIssueTests.cs │ │ ├── ReplaceWithOfTypeIssueTests.cs │ │ ├── ReplaceWithOfTypeLastIssueTests.cs │ │ ├── ReplaceWithOfTypeLastOrDefaultIssueTests.cs │ │ ├── ReplaceWithOfTypeLongCountIssueTests.cs │ │ ├── ReplaceWithOfTypeSingleIssueTests.cs │ │ ├── ReplaceWithOfTypeSingleOrDefaultIssueTests.cs │ │ ├── ReplaceWithOfTypeWhereIssueTests.cs │ │ ├── ReplaceWithSimpleAssignmentIssueTests.cs │ │ ├── ReplaceWithSingleCallToAverageIssueTests.cs │ │ ├── ReplaceWithSingleCallToCountIssueTests.cs │ │ ├── ReplaceWithSingleCallToFirstIssueTests.cs │ │ ├── ReplaceWithSingleCallToFirstOrDefaultIssueTests.cs │ │ ├── ReplaceWithSingleCallToLastIssueTests.cs │ │ ├── ReplaceWithSingleCallToLastOrDefaultIssueTests.cs │ │ ├── ReplaceWithSingleCallToLongCountIssueTests.cs │ │ ├── ReplaceWithSingleCallToMaxIssueTests.cs │ │ ├── ReplaceWithSingleCallToMinIssueTests.cs │ │ ├── ReplaceWithSingleCallToSingleIssueTests.cs │ │ ├── ReplaceWithSingleCallToSingleOrDefaultIssueTests.cs │ │ ├── ReplaceWithSingleCallToSumIssueTests.cs │ │ ├── ReplaceWithStringIsNullOrEmptyIssueTests.cs │ │ ├── RewriteIfReturnToReturnIssueTests.cs │ │ ├── SameGuardConditionExpressionInIfElseBranchesTests.cs │ │ ├── SealedMemberInSealedClassIssueTests.cs │ │ ├── SimplifyConditionalTernaryExpressionIssueTests.cs │ │ ├── SimplifyLinqExpressionIssueTests.cs │ │ ├── StaticConstructorParameterIssueTests.cs │ │ ├── StaticEventSubscriptionIssueTests.cs │ │ ├── StaticFieldInGenericTypeTests.cs │ │ ├── StringCompareIsCultureSpecificIssueTests.cs │ │ ├── StringCompareToIsCultureSpecificIssueTests.cs │ │ ├── StringEndsWithIsCultureSpecificIssueTest.cs │ │ ├── StringIndexOfIsCultureSpecificIssueTest.cs │ │ ├── StringLastIndexOfIsCultureSpecificIssueTest.cs │ │ ├── StringStartsWithIsCultureSpecificIssueTest.cs │ │ ├── SuggestUseVarKeywordEvidentTests.cs │ │ ├── ThreadStaticAtInstanceFieldTests.cs │ │ ├── UnassignedReadonlyFieldIssueTests.cs │ │ ├── UnmatchedSizeSpeicificationInArrayCreationTests.cs │ │ ├── UnreachableCodeIssueTests.cs │ │ ├── UnusedAnonymousMethodSignatureIssueTests.cs │ │ ├── UnusedLabelIssueTests.cs │ │ ├── UnusedParameterIssueTests.cs │ │ ├── UnusedTypeParameterIssueTests.cs │ │ ├── UseArrayCreationExpressionIssueTests.cs │ │ ├── UseIsOperatorIssueTests.cs │ │ ├── UseMethodAnyIssueTests.cs │ │ ├── UseMethodIsInstanceOfTypeIssueTests.cs │ │ ├── UseOfMemberOfNullReferenceTests.cs │ │ ├── ValueParameterNotUsedIssueTests.cs │ │ ├── VariableDeclaredInWideScopeTests.cs │ │ └── XmlDocIssueIssueTests.cs │ ├── DepthFirstVisitorTests.cs │ ├── InsertMissingTokensDecoratorTests.cs │ ├── InsertParenthesesVisitorTests.cs │ ├── Inspector │ │ └── InconsistentNamingIssueTests.cs │ ├── Parser │ │ ├── Bugs │ │ │ └── ParserBugTests.cs │ │ ├── ConsistencyChecker.cs │ │ ├── Expression │ │ │ ├── AnonymousMethodExpressionTests.cs │ │ │ ├── AnonymousTypeCreateExpressionTests.cs │ │ │ ├── ArrayCreateExpressionTests.cs │ │ │ ├── AssignmentExpressionTests.cs │ │ │ ├── BaseReferenceExpressionTests.cs │ │ │ ├── BinaryOperatorExpressionTests.cs │ │ │ ├── CastExpressionTests.cs │ │ │ ├── CheckedExpressionTests.cs │ │ │ ├── ConditionalExpressionTests.cs │ │ │ ├── DefaultValueExpressionTests.cs │ │ │ ├── IdentifierExpressionTests.cs │ │ │ ├── IndexerExpressionTests.cs │ │ │ ├── InvocationExpressionTests.cs │ │ │ ├── IsExpressionTests.cs │ │ │ ├── LambdaExpressionTests.cs │ │ │ ├── MemberReferenceExpressionTests.cs │ │ │ ├── ObjectCreateExpressionTests.cs │ │ │ ├── ParenthesizedExpressionTests.cs │ │ │ ├── PointerReferenceExpressionTests.cs │ │ │ ├── PrimitiveExpressionTests.cs │ │ │ ├── QueryExpressionTests.cs │ │ │ ├── SizeOfExpressionTests.cs │ │ │ ├── StackAllocExpressionTests.cs │ │ │ ├── ThisReferenceExpressionTests.cs │ │ │ ├── TypeOfExpressionTests.cs │ │ │ ├── TypeReferenceExpressionTests.cs │ │ │ ├── UnaryOperatorExpressionTests.cs │ │ │ └── UndocumentedExpressionTests.cs │ │ ├── GeneralScope │ │ │ ├── AttributeSectionTests.cs │ │ │ ├── CommentTests.cs │ │ │ ├── DelegateDeclarationTests.cs │ │ │ ├── NamespaceDeclarationTests.cs │ │ │ ├── PreprocessorDirectiveTests.cs │ │ │ ├── TypeDeclarationTests.cs │ │ │ └── UsingDeclarationTests.cs │ │ ├── ParseSelfTests.cs │ │ ├── ParseUtil.cs │ │ ├── Statements │ │ │ ├── BlockStatementTests.cs │ │ │ ├── CheckedStatementTests.cs │ │ │ ├── EmptyStatementTests.cs │ │ │ ├── ExpressionStatementTests.cs │ │ │ ├── FixedStatementTests.cs │ │ │ ├── ForStatementTests.cs │ │ │ ├── GotoStatementTests.cs │ │ │ ├── IfElseStatementTests.cs │ │ │ ├── InvalidStatementsTests.cs │ │ │ ├── LabelStatementTests.cs │ │ │ ├── LockStatementTests.cs │ │ │ ├── ReturnStatementTests.cs │ │ │ ├── SwitchStatementTests.cs │ │ │ ├── ThrowStatementTests.cs │ │ │ ├── TryCatchStatementTests.cs │ │ │ ├── UnsafeStatementTests.cs │ │ │ ├── UsingStatementTests.cs │ │ │ ├── VariableDeclarationStatementTests.cs │ │ │ ├── WhileStatementTests.cs │ │ │ └── YieldStatementTests.cs │ │ ├── TypeMembers │ │ │ ├── ConstructorDeclarationTests.cs │ │ │ ├── DestructorDeclarationTests.cs │ │ │ ├── EventDeclarationTests.cs │ │ │ ├── FieldDeclarationTests.cs │ │ │ ├── IndexerDeclarationTests.cs │ │ │ ├── MethodDeclarationTests.cs │ │ │ ├── OperatorDeclarationTests.cs │ │ │ └── PropertyDeclarationTests.cs │ │ └── TypeSystemConvertVisitorTests.cs │ ├── QueryExpressionExpanderTests.cs │ ├── Refactoring │ │ ├── LambdaHelperTests.cs │ │ ├── NamingHelperTests.cs │ │ ├── RefactoringStructureTests.cs │ │ ├── ScriptTests.cs │ │ └── TypeSystemAstBuilderTests.cs │ └── Resolver │ │ ├── AnonymousTypeTests.cs │ │ ├── ArrayCreateTests.cs │ │ ├── AttributeTests.cs │ │ ├── BinaryOperatorTests.cs │ │ ├── CastTests.cs │ │ ├── ComTests.cs │ │ ├── ConditionalOperatorTests.cs │ │ ├── ConversionsTest.cs │ │ ├── DynamicTests.cs │ │ ├── ExplicitConversionsTest.cs │ │ ├── ExtensionMethodTests.cs │ │ ├── FindReferencesTest.cs │ │ ├── InvocationTests.cs │ │ ├── LambdaTests.cs │ │ ├── LinqTests.cs │ │ ├── LocalTypeInferenceTests.cs │ │ ├── MemberLookupTests.cs │ │ ├── MethodTests.cs │ │ ├── NameLookupTests.cs │ │ ├── ObjectCreationTests.cs │ │ ├── OverloadResolutionTests.cs │ │ ├── ResolveAtLocationTests.cs │ │ ├── ResolverTestBase.cs │ │ ├── SizeOfTests.cs │ │ ├── TypeInferenceTests.cs │ │ ├── UnaryOperatorTests.cs │ │ └── UnsafeCodeTests.cs ├── Documentation │ ├── CSharpCrefLookupTests.cs │ ├── CSharpCrefParserTests.cs │ ├── CSharpDocumentationTests.cs │ └── IDStringTests.cs ├── Editor │ └── ReadOnlyDocumentTests.cs ├── FormattingTests │ ├── ConstructFixerTests.cs │ ├── TestBlankLineFormatting.cs │ ├── TestBraceStlye.cs │ ├── TestExpressionFormatting.cs │ ├── TestFormattingBugs.cs │ ├── TestGlobalLevelFormatting.cs │ ├── TestKeepReformattingRules.cs │ ├── TestLinq.cs │ ├── TestSpacingVisitor.cs │ ├── TestStatementIndentation.cs │ ├── TestTypeLevelIndentation.cs │ ├── TestWrapping.cs │ └── TextEditorTestAdapter.cs ├── ICSharpCode.NRefactory.Tests.csproj ├── IndentationTests │ ├── AlignmentTests.cs │ ├── AllInOneTests.cs │ ├── BlockTest.cs │ ├── CommentTests.cs │ ├── GeneralTests.cs │ ├── Helper.cs │ ├── PreProcessorTests.cs │ ├── StringTests.cs │ ├── TestFiles │ │ ├── CSharpParser.cs │ │ ├── Comments.cs │ │ ├── IndentEngine.cs │ │ ├── IndentState.cs │ │ ├── InheritStatements.cs │ │ ├── PreProcessorDirectives.cs │ │ ├── Simple.cs │ │ ├── Strings.cs │ │ ├── SwitchCase.cs │ │ └── TextArea.cs │ └── TextPasteIndentEngineTests.cs ├── Properties │ └── AssemblyInfo.cs ├── TypeSystem │ ├── BinaryLoaderTests.cs │ ├── BlobLoaderTests.cs │ ├── CecilLoaderTests.cs │ ├── CyclicProjectDependency.cs │ ├── GetAllBaseTypesTest.cs │ ├── GetMembersTests.cs │ ├── IkvmLoaderTests.cs │ ├── InheritanceHelperTests.cs │ ├── LazyLoadedCecilLoaderTests.cs │ ├── ReflectionHelperTests.cs │ ├── SerializedCecilLoaderTests.cs │ ├── SerializedIkvmLoaderTests.cs │ ├── StructureTests.cs │ ├── TestInterningProvider.cs │ ├── TypeParameterTests.cs │ ├── TypeSystemHelper.cs │ ├── TypeSystemTests.TestCase.cs │ └── TypeSystemTests.cs ├── Utils │ ├── CSharpPrimitiveCastTests.cs │ ├── CompositeFormatStringParser │ │ └── CompositeFormatStringParserTests.cs │ └── TreeTraversalTests.cs └── packages.config ├── ICSharpCode.NRefactory.Xml ├── AXmlAttribute.cs ├── AXmlDocument.cs ├── AXmlElement.cs ├── AXmlObject.cs ├── AXmlParser.cs ├── AXmlReader.cs ├── AXmlTag.cs ├── AXmlText.cs ├── AXmlVisitor.cs ├── DocumentationElement.cs ├── ICSharpCode.NRefactory.Xml.csproj ├── IncrementalParserState.cs ├── InternalDocument.cs ├── Log.cs ├── ObjectIterator.cs ├── Properties │ └── AssemblyInfo.cs ├── ReuseEqualityComparer.cs ├── SyntaxError.cs ├── TagMatchingHeuristics.cs ├── TagReader.cs ├── TextType.cs ├── TokenReader.cs └── XmlSegment.cs ├── ICSharpCode.NRefactory.snk ├── ICSharpCode.NRefactory ├── Analysis │ ├── AbiComparer.cs │ ├── SymbolCollector.cs │ ├── TypeGraph.cs │ └── TypeGraphNode.cs ├── Completion │ ├── CompletionCategory.cs │ ├── CompletionExtensionMethods.cs │ ├── DisplayFlags.cs │ ├── FrameworkLookup.cs │ ├── ICompletionData.cs │ ├── IEntityCompletionData.cs │ ├── IParameterDataProvider.cs │ └── IVariableCompletionData.cs ├── Documentation │ ├── DocumentationComment.cs │ ├── GetPotentiallyNestedClassTypeReference.cs │ ├── IDocumentationProvider.cs │ ├── IdStringMemberReference.cs │ ├── IdStringProvider.cs │ └── XmlDocumentationProvider.cs ├── Editor │ ├── IDocument.cs │ ├── IDocumentLine.cs │ ├── ISegment.cs │ ├── ITextAnchor.cs │ ├── ITextPasteHandler.cs │ ├── ITextSource.cs │ ├── ReadOnlyDocument.cs │ ├── StringBuilderDocument.cs │ ├── StringTextSource.cs │ ├── TextChangeEventArgs.cs │ ├── TextSourceVersionProvider.cs │ └── UnicodeNewline.cs ├── IAnnotatable.cs ├── ICSharpCode.NRefactory.csproj ├── PatternMatching │ ├── AnyNode.cs │ ├── AnyNodeOrNull.cs │ ├── Backreference.cs │ ├── BacktrackingInfo.cs │ ├── Choice.cs │ ├── INode.cs │ ├── Match.cs │ ├── NamedNode.cs │ ├── OptionalNode.cs │ ├── Pattern.cs │ └── Repeat.cs ├── Properties │ ├── AssemblyInfo.cs │ └── GlobalAssemblyInfo.cs ├── Refactoring │ ├── IssueMarker.cs │ └── Severity.cs ├── Role.cs ├── Semantics │ ├── AmbiguousResolveResult.cs │ ├── ArrayAccessResolveResult.cs │ ├── ArrayCreateResolveResult.cs │ ├── ByReferenceResolveResult.cs │ ├── ConstantResolveResult.cs │ ├── Conversion.cs │ ├── ConversionResolveResult.cs │ ├── ErrorResolveResult.cs │ ├── ForEachResolveResult.cs │ ├── InitializedObjectResolveResult.cs │ ├── InvocationResolveResult.cs │ ├── LocalResolveResult.cs │ ├── MemberResolveResult.cs │ ├── NamedArgumentResolveResult.cs │ ├── NamespaceResolveResult.cs │ ├── OperatorResolveResult.cs │ ├── ResolveResult.cs │ ├── SizeOfResolveResult.cs │ ├── ThisResolveResult.cs │ ├── TypeIsResolveResult.cs │ ├── TypeOfResolveResult.cs │ ├── TypeResolveResult.cs │ └── UnknownMemberResolveResult.cs ├── TextLocation.cs ├── TypeSystem │ ├── Accessibility.cs │ ├── AnonymousType.cs │ ├── ArrayType.cs │ ├── AssemblyLoader.cs │ ├── AssemblyQualifiedTypeName.cs │ ├── ByReferenceType.cs │ ├── ComHelper.cs │ ├── DefaultSolutionSnapshot.cs │ ├── DomRegion.cs │ ├── EntityType.cs │ ├── Error.cs │ ├── FullTypeName.cs │ ├── IAmbience.cs │ ├── IAssembly.cs │ ├── IAttribute.cs │ ├── ICodeContext.cs │ ├── ICompilation.cs │ ├── IConstantValue.cs │ ├── IEntity.cs │ ├── IEvent.cs │ ├── IField.cs │ ├── IFreezable.cs │ ├── IInterningProvider.cs │ ├── IMember.cs │ ├── IMethod.cs │ ├── INamedElement.cs │ ├── INamespace.cs │ ├── IParameter.cs │ ├── IParameterizedMember.cs │ ├── IProjectContent.cs │ ├── IProperty.cs │ ├── ISolutionSnapshot.cs │ ├── ISupportsInterning.cs │ ├── ISymbol.cs │ ├── IType.cs │ ├── ITypeDefinition.cs │ ├── ITypeParameter.cs │ ├── ITypeReference.cs │ ├── IUnresolvedFile.cs │ ├── IVariable.cs │ ├── Implementation │ │ ├── AbstractFreezable.cs │ │ ├── AbstractResolvedEntity.cs │ │ ├── AbstractResolvedMember.cs │ │ ├── AbstractResolvedTypeParameter.cs │ │ ├── AbstractType.cs │ │ ├── AbstractUnresolvedEntity.cs │ │ ├── AbstractUnresolvedMember.cs │ │ ├── AccessorOwnerMemberReference.cs │ │ ├── BaseTypeCollector.cs │ │ ├── BlobReader.cs │ │ ├── DefaultAssemblyReference.cs │ │ ├── DefaultAttribute.cs │ │ ├── DefaultMemberReference.cs │ │ ├── DefaultParameter.cs │ │ ├── DefaultResolvedEvent.cs │ │ ├── DefaultResolvedField.cs │ │ ├── DefaultResolvedMethod.cs │ │ ├── DefaultResolvedProperty.cs │ │ ├── DefaultResolvedTypeDefinition.cs │ │ ├── DefaultResolvedTypeParameter.cs │ │ ├── DefaultUnresolvedAssembly.cs │ │ ├── DefaultUnresolvedAttribute.cs │ │ ├── DefaultUnresolvedEvent.cs │ │ ├── DefaultUnresolvedField.cs │ │ ├── DefaultUnresolvedMethod.cs │ │ ├── DefaultUnresolvedParameter.cs │ │ ├── DefaultUnresolvedProperty.cs │ │ ├── DefaultUnresolvedTypeDefinition.cs │ │ ├── DefaultUnresolvedTypeParameter.cs │ │ ├── DefaultVariable.cs │ │ ├── DummyTypeParameter.cs │ │ ├── ExplicitInterfaceImplementationMemberReference.cs │ │ ├── FullNameAndTypeParameterCount.cs │ │ ├── GetClassTypeReference.cs │ │ ├── GetMembersHelper.cs │ │ ├── KnownTypeCache.cs │ │ ├── MergedNamespace.cs │ │ ├── MinimalCorlib.cs │ │ ├── NestedTypeReference.cs │ │ ├── ResolvedAttributeBlob.cs │ │ ├── SimpleCompilation.cs │ │ ├── SimpleConstantValue.cs │ │ ├── SimpleInterningProvider.cs │ │ ├── SpecializedEvent.cs │ │ ├── SpecializedField.cs │ │ ├── SpecializedMember.cs │ │ ├── SpecializedMethod.cs │ │ ├── SpecializedProperty.cs │ │ ├── SpecializingMemberReference.cs │ │ ├── TypeParameterReference.cs │ │ ├── TypeWithElementType.cs │ │ ├── UnknownType.cs │ │ ├── UnresolvedAttributeBlob.cs │ │ ├── UnresolvedSecurityDeclarationBlob.cs │ │ └── VoidTypeDefinition.cs │ ├── InheritanceHelper.cs │ ├── IntersectionType.cs │ ├── KnownTypeReference.cs │ ├── NullableType.cs │ ├── ParameterListComparer.cs │ ├── ParameterizedType.cs │ ├── PointerType.cs │ ├── ProjectReference.cs │ ├── ReflectionHelper.cs │ ├── ReflectionNameParseException.cs │ ├── SimpleTypeResolveContext.cs │ ├── SpecialType.cs │ ├── TaskType.cs │ ├── TopLevelTypeName.cs │ ├── TypeKind.cs │ ├── TypeParameterSubstitution.cs │ ├── TypeSystemExtensions.cs │ └── TypeVisitor.cs └── Utils │ ├── 7BitEncodedInts.cs │ ├── BitVector16.cs │ ├── BusyManager.cs │ ├── CSharpPrimitiveCast.cs │ ├── CacheManager.cs │ ├── CallbackOnDispose.cs │ ├── ComparableList.cs │ ├── CompositeFormatStringParser │ ├── CompositeFormatStringParser.cs │ ├── FormatItem.cs │ ├── FormatStringSegmentBase.cs │ ├── IFormatStringError.cs │ ├── IFormatStringSegment.cs │ └── TextSegment.cs │ ├── EmptyList.cs │ ├── ExtensionMethods.cs │ ├── FastSerializer.cs │ ├── GraphVizGraph.cs │ ├── ImmutableStack.cs │ ├── KeyComparer.cs │ ├── LazyInit.cs │ ├── MultiDictionary.cs │ ├── Platform.cs │ ├── ProjectedList.cs │ ├── ReferenceComparer.cs │ └── TreeTraversal.cs ├── NRefactory.sln ├── Packages └── ICSharpCode.NRefactory.nuspec ├── README └── doc ├── Pattern Matching.html ├── TODO ├── XML Documentation.html ├── copyright.txt └── license.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | *.cs text diff=csharp 2 | *.sln text eol=crlf 3 | *.csproj text eol=crlf 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.suo 4 | /lib/*.dll 5 | /ICSharpCode.NRefactory.Tests/PartCover/* 6 | _ReSharper*/* 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: csharp 2 | solution: NRefactory.sln 3 | install: 4 | - git clone git://github.com/jbevain/cecil.git ../cecil 5 | - git clone git://github.com/mono/ikvm-fork.git ../ikvm 6 | - pushd ../ikvm && git checkout c9edfe788667d5777e97e3f2fd195080d06dd32c && popd 7 | - pushd ../cecil && git checkout 0.9.6 && popd 8 | - nuget install NUnit.Runners -Version 2.6.4 -OutputDirectory testrunner 9 | script: 10 | - xbuild /p:Configuration=Debug NRefactory.sln 11 | - mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe bin/Debug/ICSharpCode.NRefactory.Tests.dll 12 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.AstVerifier/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle("ICSharpCode.NRefactory.CSharp.AstVerifier")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("")] 12 | [assembly: AssemblyCopyright("mike")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeActions/SpecializedCodeAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 4 | { 5 | /// 6 | /// A specialized code action creates a code action assoziated with one special type of ast nodes. 7 | /// 8 | public abstract class SpecializedCodeAction : CodeActionProvider where T : AstNode 9 | { 10 | /// 11 | /// Gets the action for the specified ast node. 12 | /// 13 | /// 14 | /// The code action. May return null, if no action can be provided. 15 | /// 16 | /// 17 | /// The refactoring conext. 18 | /// 19 | /// 20 | /// The AstNode it's ensured that the node is always != null, if called. 21 | /// 22 | protected abstract CodeAction GetAction(RefactoringContext context, T node); 23 | 24 | #region ICodeActionProvider implementation 25 | public override System.Collections.Generic.IEnumerable GetActions(RefactoringContext context) 26 | { 27 | var node = context.GetNode(); 28 | if (node == null) 29 | yield break; 30 | var action = GetAction(context, node); 31 | if (action == null) 32 | yield break; 33 | yield return action; 34 | } 35 | #endregion 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/IssueCategories.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IssueCategories.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2012 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace ICSharpCode.NRefactory.CSharp 29 | { 30 | public class IssueCategories 31 | { 32 | public const string CodeQualityIssues = "Potential Code Quality Issues"; 33 | public const string ConstraintViolations = "Constraint Violations"; 34 | public const string PracticesAndImprovements = "Common Practices and Code Improvements"; 35 | public const string RedundanciesInCode = "Redundancies in Code"; 36 | public const string RedundanciesInDeclarations = "Redundancies in Symbol Declarations"; 37 | public const string Opportunities = "Language Usage Opportunities"; 38 | public const string Notifications = "Code Notifications"; 39 | public const string CompilerWarnings = "Compiler Warnings"; 40 | public const string CompilerErrors = "Compiler Errors"; 41 | public const string NUnit = "NUnit"; 42 | } 43 | } 44 | 45 | 46 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithOfTypeCountIssue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceWithOfTypeCountIssue.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.Refactoring; 27 | 28 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 29 | { 30 | [IssueDescription("Replace with OfType().Count()", 31 | Description = "Replace with call to OfType().Count()", 32 | Category = IssueCategories.PracticesAndImprovements, 33 | Severity = Severity.Suggestion, 34 | AnalysisDisableKeyword = "ReplaceWithOfType.Count")] 35 | public class ReplaceWithOfTypeCountIssue : GatherVisitorCodeIssueProvider 36 | { 37 | protected override IGatherVisitor CreateVisitor(BaseRefactoringContext context) 38 | { 39 | return new ReplaceWithOfTypeAnyIssue.GatherVisitor(context, "Count"); 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithOfTypeFirstIssue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceWithOfTypeFirstIssue.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.Refactoring; 27 | 28 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 29 | { 30 | [IssueDescription("Replace with OfType().First()", 31 | Description = "Replace with call to OfType().First()", 32 | Category = IssueCategories.PracticesAndImprovements, 33 | Severity = Severity.Suggestion, 34 | AnalysisDisableKeyword = "ReplaceWithOfType.First")] 35 | public class ReplaceWithOfTypeFirstIssue : GatherVisitorCodeIssueProvider 36 | { 37 | protected override IGatherVisitor CreateVisitor(BaseRefactoringContext context) 38 | { 39 | return new ReplaceWithOfTypeAnyIssue.GatherVisitor(context, "First"); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithOfTypeLastIssue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceWithOfTypeLastIssue.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.Refactoring; 27 | 28 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 29 | { 30 | [IssueDescription("Replace with OfType().Last()", 31 | Description = "Replace with call to OfType().Last()", 32 | Category = IssueCategories.PracticesAndImprovements, 33 | Severity = Severity.Suggestion, 34 | AnalysisDisableKeyword = "ReplaceWithOfType.Last")] 35 | public class ReplaceWithOfTypeLastIssue : GatherVisitorCodeIssueProvider 36 | { 37 | protected override IGatherVisitor CreateVisitor(BaseRefactoringContext context) 38 | { 39 | return new ReplaceWithOfTypeAnyIssue.GatherVisitor(context, "Last"); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithOfTypeLastOrDefaultIssue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceWithOfTypeLastOrDefaultIssue.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.Refactoring; 27 | 28 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 29 | { 30 | [IssueDescription("Replace with OfType().LastOrDefault()", 31 | Description = "Replace with call to OfType().LastOrDefault()", 32 | Category = IssueCategories.PracticesAndImprovements, 33 | Severity = Severity.Suggestion, 34 | AnalysisDisableKeyword = "ReplaceWithOfType.LastOrDefault")] 35 | public class ReplaceWithOfTypeLastOrDefaultIssue : GatherVisitorCodeIssueProvider 36 | { 37 | protected override IGatherVisitor CreateVisitor(BaseRefactoringContext context) 38 | { 39 | return new ReplaceWithOfTypeAnyIssue.GatherVisitor(context, "LastOrDefault"); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithOfTypeLongCountIssue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceWithOfTypeLongCountIssue.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.Refactoring; 27 | 28 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 29 | { 30 | [IssueDescription("Replace with OfType().LongCount()", 31 | Description = "Replace with call to OfType().LongCount()", 32 | Category = IssueCategories.PracticesAndImprovements, 33 | Severity = Severity.Suggestion, 34 | AnalysisDisableKeyword = "ReplaceWithOfType.LongCount")] 35 | public class ReplaceWithOfTypeLongCountIssue : GatherVisitorCodeIssueProvider 36 | { 37 | protected override IGatherVisitor CreateVisitor(BaseRefactoringContext context) 38 | { 39 | return new ReplaceWithOfTypeAnyIssue.GatherVisitor(context, "LongCount"); 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithOfTypeSingleIssue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceWithOfTypeSingleIssue.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.Refactoring; 27 | 28 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 29 | { 30 | [IssueDescription("Replace with OfType().Single()", 31 | Description = "Replace with call to OfType().Single()", 32 | Category = IssueCategories.PracticesAndImprovements, 33 | Severity = Severity.Suggestion, 34 | AnalysisDisableKeyword = "ReplaceWithOfType.Single")] 35 | public class ReplaceWithOfTypeSingleIssue : GatherVisitorCodeIssueProvider 36 | { 37 | protected override IGatherVisitor CreateVisitor(BaseRefactoringContext context) 38 | { 39 | return new ReplaceWithOfTypeAnyIssue.GatherVisitor(context, "Single"); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithOfTypeWhereIssue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceWithOfTypeWhereIssue.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.Refactoring; 27 | 28 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 29 | { 30 | [IssueDescription("Replace with OfType().Where()", 31 | Description = "Replace with call to OfType().Where()", 32 | Category = IssueCategories.PracticesAndImprovements, 33 | Severity = Severity.Suggestion, 34 | AnalysisDisableKeyword = "ReplaceWithOfType.Where")] 35 | public class ReplaceWithOfTypeWhereIssue : GatherVisitorCodeIssueProvider 36 | { 37 | protected override IGatherVisitor CreateVisitor(BaseRefactoringContext context) 38 | { 39 | return new ReplaceWithOfTypeAnyIssue.GatherVisitor(context, "Where"); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithSingleCallToAnyIssue.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icsharpcode/NRefactory/0607a4ad96ebdd16817e47dcae85b1cfcb5b5bf5/ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithSingleCallToAnyIssue.cs -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithSingleCallToCountIssue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceWithSingleCallToCountIssue.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.Refactoring; 27 | using System.Collections.Generic; 28 | 29 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 30 | { 31 | [IssueDescription("Replace with single call to Count(...)", 32 | Description = "Replace with single call to Count(...)", 33 | Category = IssueCategories.PracticesAndImprovements, 34 | Severity = Severity.Suggestion, 35 | AnalysisDisableKeyword = "ReplaceWithSingleCallToCount")] 36 | public class ReplaceWithSingleCallToCountIssue : GatherVisitorCodeIssueProvider 37 | { 38 | protected override IGatherVisitor CreateVisitor(BaseRefactoringContext context) 39 | { 40 | return new ReplaceWithSingleCallToAnyIssue.GatherVisitor(context, "Count"); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithSingleCallToFirstIssue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceWithSingleCallToFirst.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.Refactoring; 27 | using System.Collections.Generic; 28 | 29 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 30 | { 31 | [IssueDescription("Replace with single call to First(...)", 32 | Description = "Replace with single call to First(...)", 33 | Category = IssueCategories.PracticesAndImprovements, 34 | Severity = Severity.Suggestion, 35 | AnalysisDisableKeyword = "ReplaceWithSingleCallToFirst")] 36 | public class ReplaceWithSingleCallToFirstIssue : GatherVisitorCodeIssueProvider 37 | { 38 | protected override IGatherVisitor CreateVisitor(BaseRefactoringContext context) 39 | { 40 | return new ReplaceWithSingleCallToAnyIssue.GatherVisitor(context, "First"); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithSingleCallToLastIssue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceWithSingleCallToLast.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.Refactoring; 27 | using System.Collections.Generic; 28 | 29 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 30 | { 31 | [IssueDescription("Replace with single call to Last(...)", 32 | Description = "Replace with single call to Last(...)", 33 | Category = IssueCategories.PracticesAndImprovements, 34 | Severity = Severity.Suggestion, 35 | AnalysisDisableKeyword = "ReplaceWithSingleCallToLast")] 36 | public class ReplaceWithSingleCallToLastIssue : GatherVisitorCodeIssueProvider 37 | { 38 | protected override IGatherVisitor CreateVisitor(BaseRefactoringContext context) 39 | { 40 | return new ReplaceWithSingleCallToAnyIssue.GatherVisitor(context, "Last"); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithSingleCallToMaxIssue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceWithSingleCallToMaxIssue.cs 3 | // 4 | // Author: 5 | // Marius Ungureanu 6 | // 7 | // Copyright (c) 2014 Xamarin 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.Refactoring; 27 | 28 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 29 | { 30 | [IssueDescription("Replace with single call to Max(...)", 31 | Description = "Replace with single call to Max(...)", 32 | Category = IssueCategories.PracticesAndImprovements, 33 | Severity = Severity.Suggestion, 34 | AnalysisDisableKeyword = "ReplaceWithSingleCallToMax")] 35 | public class ReplaceWithSingleCallToMaxIssue : GatherVisitorCodeIssueProvider 36 | { 37 | protected override IGatherVisitor CreateVisitor(BaseRefactoringContext context) 38 | { 39 | return new ReplaceWithSingleCallToAverageIssue.GatherVisitor(context, "Max"); 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithSingleCallToMinIssue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceWithSingleCallToMinIssue.cs 3 | // 4 | // Author: 5 | // Marius Ungureanu 6 | // 7 | // Copyright (c) 2014 Xamarin 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.Refactoring; 27 | 28 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 29 | { 30 | [IssueDescription("Replace with single call to Min(...)", 31 | Description = "Replace with single call to Min(...)", 32 | Category = IssueCategories.PracticesAndImprovements, 33 | Severity = Severity.Suggestion, 34 | AnalysisDisableKeyword = "ReplaceWithSingleCallToMin")] 35 | public class ReplaceWithSingleCallToMinIssue : GatherVisitorCodeIssueProvider 36 | { 37 | protected override IGatherVisitor CreateVisitor(BaseRefactoringContext context) 38 | { 39 | return new ReplaceWithSingleCallToAverageIssue.GatherVisitor(context, "Min"); 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithSingleCallToSingleIssue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceWithSingleCallToSingle.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.Refactoring; 27 | using System.Collections.Generic; 28 | 29 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 30 | { 31 | [IssueDescription("Replace with single call to Single(...)", 32 | Description = "Replace with single call to Single(...)", 33 | Category = IssueCategories.PracticesAndImprovements, 34 | Severity = Severity.Suggestion, 35 | AnalysisDisableKeyword = "ReplaceWithSingleCallToSingle")] 36 | public class ReplaceWithSingleCallToSingleIssue : GatherVisitorCodeIssueProvider 37 | { 38 | protected override IGatherVisitor CreateVisitor(BaseRefactoringContext context) 39 | { 40 | return new ReplaceWithSingleCallToAnyIssue.GatherVisitor(context, "Single"); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/PracticesAndImprovements/ReplaceWithSingleCallToSumIssue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceWithSingleCallToSumIssue.cs 3 | // 4 | // Author: 5 | // Marius Ungureanu 6 | // 7 | // Copyright (c) 2014 Xamarin 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.Refactoring; 27 | 28 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 29 | { 30 | [IssueDescription("Replace with single call to Sum(...)", 31 | Description = "Replace with single call to Sum(...)", 32 | Category = IssueCategories.PracticesAndImprovements, 33 | Severity = Severity.Suggestion, 34 | AnalysisDisableKeyword = "ReplaceWithSingleCallToSum")] 35 | public class ReplaceWithSingleCallToSumIssue : GatherVisitorCodeIssueProvider 36 | { 37 | protected override IGatherVisitor CreateVisitor(BaseRefactoringContext context) 38 | { 39 | return new ReplaceWithSingleCallToAverageIssue.GatherVisitor(context, "Sum"); 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp.Refactoring/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyInfo.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System.Reflection; 27 | using System.Runtime.CompilerServices; 28 | 29 | [assembly: AssemblyTitle ("ICSharpCode.NRefactory.CSharp.Refactoring")] 30 | [assembly: AssemblyDescription("C# refactorings")] 31 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp/Ast/Modifiers.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Modifiers.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (C) 2008 Novell, Inc (http://www.novell.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining 10 | // a copy of this software and associated documentation files (the 11 | // "Software"), to deal in the Software without restriction, including 12 | // without limitation the rights to use, copy, modify, merge, publish, 13 | // distribute, sublicense, and/or sell copies of the Software, and to 14 | // permit persons to whom the Software is furnished to do so, subject to 15 | // the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | 29 | using System; 30 | 31 | namespace ICSharpCode.NRefactory.CSharp 32 | { 33 | [Flags] 34 | public enum Modifiers 35 | { 36 | None = 0, 37 | 38 | Private = 0x0001, 39 | Internal = 0x0002, 40 | Protected = 0x0004, 41 | Public = 0x0008, 42 | 43 | Abstract = 0x0010, 44 | Virtual = 0x0020, 45 | Sealed = 0x0040, 46 | Static = 0x0080, 47 | Override = 0x0100, 48 | Readonly = 0x0200, 49 | Const = 0x0400, 50 | New = 0x0800, 51 | Partial = 0x1000, 52 | 53 | Extern = 0x2000, 54 | Volatile = 0x4000, 55 | Unsafe = 0x8000, 56 | Async = 0x10000, 57 | 58 | VisibilityMask = Private | Internal | Protected | Public, 59 | 60 | /// 61 | /// Special value used to match any modifiers during pattern matching. 62 | /// 63 | Any = unchecked((int)0x80000000) 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp/Ast/NodeType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NodeType.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2009 Novell, Inc (http://www.novell.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace ICSharpCode.NRefactory.CSharp 30 | { 31 | public enum NodeType 32 | { 33 | Unknown, 34 | /// 35 | /// AstType 36 | /// 37 | TypeReference, 38 | /// 39 | /// Type or delegate declaration 40 | /// 41 | TypeDeclaration, 42 | Member, 43 | Statement, 44 | Expression, 45 | Token, 46 | QueryClause, 47 | /// 48 | /// Comment or whitespace or pre-processor directive 49 | /// 50 | Whitespace, 51 | /// 52 | /// Placeholder for a pattern 53 | /// 54 | Pattern 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp/Ast/SyntaxExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 Daniel Grunwald 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | using System; 22 | 23 | namespace ICSharpCode.NRefactory.CSharp 24 | { 25 | /// 26 | /// Extension methods for the syntax tree. 27 | /// 28 | public static class SyntaxExtensions 29 | { 30 | public static bool IsComparisonOperator(this OperatorType operatorType) 31 | { 32 | switch (operatorType) { 33 | case OperatorType.Equality: 34 | case OperatorType.Inequality: 35 | case OperatorType.GreaterThan: 36 | case OperatorType.LessThan: 37 | case OperatorType.GreaterThanOrEqual: 38 | case OperatorType.LessThanOrEqual: 39 | return true; 40 | default: 41 | return false; 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp/Ast/TokenRole.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ICSharpCode.NRefactory.CSharp 5 | { 6 | /// 7 | /// A specific role only used for C# tokens 8 | /// 9 | public sealed class TokenRole : Role 10 | { 11 | internal readonly static List Tokens = new List (); 12 | internal readonly static List TokenLengths = new List (); 13 | internal readonly uint TokenIndex; 14 | 15 | static TokenRole () 16 | { 17 | // null token 18 | Tokens.Add (""); 19 | TokenLengths.Add (0); 20 | } 21 | 22 | /// 23 | /// Gets the token as string. Note that the token Name and Token value may differ. 24 | /// 25 | public string Token { 26 | get; 27 | private set; 28 | } 29 | 30 | /// 31 | /// Gets the char length of the token. 32 | /// 33 | public int Length { 34 | get; 35 | private set; 36 | } 37 | 38 | 39 | public TokenRole(string token) : base (token, CSharpTokenNode.Null) 40 | { 41 | this.Token = token; 42 | this.Length = token.Length; 43 | 44 | bool found = false; 45 | for (int i = 0; i < Tokens.Count; i++) { 46 | var existingToken = Tokens [i]; 47 | if (existingToken == token) { 48 | TokenIndex = (uint)i; 49 | found = true; 50 | break; 51 | } 52 | } 53 | if (!found) { 54 | TokenIndex = (uint)Tokens.Count; 55 | Tokens.Add (token); 56 | TokenLengths.Add (this.Length); 57 | } 58 | } 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp/NameLookupMode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | 21 | namespace ICSharpCode.NRefactory.CSharp 22 | { 23 | public enum NameLookupMode 24 | { 25 | /// 26 | /// Normal name lookup in expressions 27 | /// 28 | Expression, 29 | /// 30 | /// Name lookup in expression, where the expression is the target of an invocation. 31 | /// Such a lookup will only return methods and delegate-typed fields. 32 | /// 33 | InvocationTarget, 34 | /// 35 | /// Normal name lookup in type references. 36 | /// 37 | Type, 38 | /// 39 | /// Name lookup in the type reference inside a using declaration. 40 | /// 41 | TypeInUsingDeclaration, 42 | /// 43 | /// Name lookup for base type references. 44 | /// 45 | BaseTypeReference 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp/Parser/mcs/visit.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icsharpcode/NRefactory/0607a4ad96ebdd16817e47dcae85b1cfcb5b5bf5/ICSharpCode.NRefactory.CSharp/Parser/mcs/visit.cs -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp/PatternMatching/AnyType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AnyType.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Collections.Generic; 28 | using ICSharpCode.NRefactory.CSharp.Resolver; 29 | using ICSharpCode.NRefactory.TypeSystem; 30 | using ICSharpCode.NRefactory.CSharp; 31 | 32 | namespace ICSharpCode.NRefactory.PatternMatching 33 | { 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | using System.Runtime.CompilerServices; 19 | 20 | #region Using directives 21 | 22 | using System; 23 | using System.Reflection; 24 | using System.Runtime.InteropServices; 25 | 26 | #endregion 27 | 28 | // General Information about an assembly is controlled through the following 29 | // set of attributes. Change these attribute values to modify the information 30 | // associated with an assembly. 31 | [assembly: AssemblyTitle("ICSharpCode.NRefactory.CSharp")] 32 | [assembly: AssemblyDescription("C# parser and semantic analysis")] 33 | [assembly: InternalsVisibleTo("ICSharpCode.NRefactory.CSharp.Refactoring, PublicKey=00240000048000009400000006020000002400005253413100040000010001004dcf3979c4e902efa4dd2163a039701ed5822e6f1134d77737296abbb97bf0803083cfb2117b4f5446a217782f5c7c634f9fe1fc60b4c11d62c5b3d33545036706296d31903ddcf750875db38a8ac379512f51620bb948c94d0831125fbc5fe63707cbb93f48c1459c4d1749eb7ac5e681a2f0d6d7c60fa527a3c0b8f92b02bf")] 34 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp/Refactoring/CodeActionProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ContextAction.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2011 Mike Krüger 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Threading; 28 | using System.Collections.Generic; 29 | 30 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 31 | { 32 | public abstract class CodeActionProvider 33 | { 34 | public abstract IEnumerable GetActions (RefactoringContext context); 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp/Refactoring/CommonSubIssues.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ConvertToStaticMethodIssue.cs 3 | // 4 | // Author: 5 | // Ciprian Khlud 6 | // 7 | // Copyright (c) 2013 Ciprian Khlud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | namespace ICSharpCode.NRefactory.CSharp.Refactoring 28 | { 29 | public class CommonSubIssues 30 | { 31 | public const string PrivateMember = "Private accessibility"; 32 | public const string NonPrivateMember = "Non-private accessibility"; 33 | 34 | } 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp/Refactoring/ContextActionAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ProviderDescriptionAttribute.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2012 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace ICSharpCode.NRefactory.CSharp 29 | { 30 | [AttributeUsage(AttributeTargets.Class)] 31 | public class ContextActionAttribute : System.Attribute 32 | { 33 | public string Title { get; private set;} 34 | public string Description { get; set; } 35 | public string Category { get; set; } 36 | 37 | public ContextActionAttribute (string title) 38 | { 39 | Title = title; 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp/Resolver/AliasNamespaceResolveResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AliasResolveResult.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using ICSharpCode.NRefactory.Semantics; 28 | using System.Collections.Generic; 29 | using ICSharpCode.NRefactory.CSharp.TypeSystem; 30 | 31 | namespace ICSharpCode.NRefactory.CSharp.Resolver 32 | { 33 | /// 34 | /// Represents a namespace resolve result that's resolved using an alias. 35 | /// 36 | public class AliasNamespaceResolveResult : NamespaceResolveResult 37 | { 38 | /// 39 | /// The alias used. 40 | /// 41 | public string Alias { 42 | get; 43 | private set; 44 | } 45 | 46 | public AliasNamespaceResolveResult(string alias, NamespaceResolveResult underlyingResult) : base (underlyingResult.Namespace) 47 | { 48 | this.Alias = alias; 49 | } 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp/Resolver/AliasTypeResolveResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AliasTypeResolveResult.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using ICSharpCode.NRefactory.Semantics; 29 | using System.Collections.Generic; 30 | using ICSharpCode.NRefactory.CSharp.TypeSystem; 31 | 32 | namespace ICSharpCode.NRefactory.CSharp.Resolver 33 | { 34 | /// 35 | /// Represents a type resolve result that's resolved using an alias. 36 | /// 37 | public class AliasTypeResolveResult : TypeResolveResult 38 | { 39 | /// 40 | /// The alias used. 41 | /// 42 | public string Alias { 43 | get; 44 | private set; 45 | } 46 | 47 | public AliasTypeResolveResult(string alias, TypeResolveResult underlyingResult) : base (underlyingResult.Type) 48 | { 49 | this.Alias = alias; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.CSharp/Resolver/RenameCallbackArguments.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2014 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | 21 | namespace ICSharpCode.NRefactory.CSharp.Resolver 22 | { 23 | /// 24 | /// Arguments for the callback of . 25 | /// 26 | public class RenameCallbackArguments 27 | { 28 | public AstNode NodeToReplace { get; private set; } 29 | public AstNode NewNode { get; private set; } 30 | 31 | public RenameCallbackArguments(AstNode nodeToReplace, AstNode newNode) 32 | { 33 | if (nodeToReplace == null) 34 | throw new ArgumentNullException("nodeToReplace"); 35 | if (newNode == null) 36 | throw new ArgumentNullException("newNode"); 37 | this.NodeToReplace = nodeToReplace; 38 | this.NewNode = newNode; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Cecil/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyInfo.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using System.Reflection; 29 | 30 | // Information about this assembly is defined by the following attributes. 31 | // Change them to the values specific to your project. 32 | 33 | [assembly: AssemblyTitle("ICSharpCode.NRefactory.Cecil")] 34 | [assembly: AssemblyDescription("Cecil Assembly Loader for NRefactory")] 35 | 36 | [assembly: CLSCompliant(true)] 37 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Cecil/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.ConsistencyCheck/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | #region Using directives 20 | 21 | using System; 22 | using System.Reflection; 23 | using System.Runtime.InteropServices; 24 | 25 | #endregion 26 | 27 | // General Information about an assembly is controlled through the following 28 | // set of attributes. Change these attribute values to modify the information 29 | // associated with an assembly. 30 | [assembly: AssemblyTitle("ICSharpCode.NRefactory.ConsistencyCheck")] 31 | [assembly: AssemblyDescription("Loads a solution and performs various self-tests using the parsed code.")] 32 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.ConsistencyCheck/Readme.txt: -------------------------------------------------------------------------------- 1 | This is an automatic consistency check for NRefactory. 2 | It loads a solution file and parses all the source code and referenced libraries, 3 | and then performs a set of consistency checks. 4 | These checks assume that the code is valid C# without any compilation errors, 5 | so make sure to only pass in compilable source code. 6 | 7 | Checks currently being performed: 8 | - IDStringConsistencyCheck: Checks that ID strings are unique and refer back to the correct entity 9 | - RoundtripTest: parses C# code and outputs it again using CSharpOutputVisitor, checking that only whitespace is changing 10 | - ResolverTest: fully resolves all ASTs and validates that no errors are detected (no false positives in semantic error checking) 11 | - RandomizedOrderResolverTest: checks that the order of Resolve()/GetResolverState() calls has no effect on the result 12 | - FindReferencesConsistencyCheck: checks that FindReferences is the inverse of FindReferencedEntities 13 | 14 | XML Tests: 15 | - IncrementalXmlParserTests: tests that incremental parsing produces results identical to a full reparse 16 | - XmlReaderTests: compares AXmlParser.Parse().CreateReader() with new XmlTextReader() 17 | 18 | 19 | 20 | Ideas for further tests: 21 | - Test token positions (see AstVerifier) 22 | - Compare resolve results with csc compiler output (using Cecil) 23 | - Randomly mutate a C# file (e.g. remove tokens) and verify that the parser does not crash 24 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.ConsistencyCheck/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Demo/MainForm.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Windows.Forms; 21 | 22 | namespace ICSharpCode.NRefactory.Demo 23 | { 24 | /// 25 | /// Description of MainForm. 26 | /// 27 | public partial class MainForm : Form 28 | { 29 | public MainForm() 30 | { 31 | // 32 | // The InitializeComponent() call is required for Windows Forms designer support. 33 | // 34 | InitializeComponent(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Demo/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Windows.Forms; 21 | 22 | namespace ICSharpCode.NRefactory.Demo 23 | { 24 | /// 25 | /// Class with program entry point. 26 | /// 27 | internal sealed class Program 28 | { 29 | /// 30 | /// Program entry point. 31 | /// 32 | [STAThread] 33 | private static void Main(string[] args) 34 | { 35 | Application.EnableVisualStyles(); 36 | Application.SetCompatibleTextRenderingDefault(false); 37 | Application.Run(new MainForm()); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Demo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("ICSharpCode.NRefactory.Demo")] 13 | [assembly: AssemblyDescription("WinForms-based demo application for NRefactory")] 14 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Demo/VBEditDialog.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Drawing; 21 | using System.Windows.Forms; 22 | 23 | namespace ICSharpCode.NRefactory.Demo 24 | { 25 | public partial class VBEditDialog 26 | { 27 | public VBEditDialog(object element) 28 | { 29 | InitializeComponent(); 30 | propertyGrid.SelectedObject = element; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.GtkDemo/CSharpDemo.cs: -------------------------------------------------------------------------------- 1 | // CSharpDemo.cs 2 | using System; 3 | using System.Linq; 4 | 5 | namespace Demo 6 | { 7 | #region Demo 8 | public class CSharpDemo 9 | { 10 | static void TestMe (int i) 11 | { 12 | Console.WriteLine (i); 13 | NotDefined (); 14 | } 15 | 16 | public static void Main (string[] args) 17 | { 18 | TestMe (args.Count ()); 19 | } 20 | } 21 | #endregion 22 | } 23 | 24 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.GtkDemo/Main.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Main.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2011 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Gtk; 28 | 29 | namespace ICSharpCode.NRefactory.GtkDemo 30 | { 31 | class MainClass 32 | { 33 | public static void Main (string[] args) 34 | { 35 | Application.Init (); 36 | MainWindow win = new MainWindow (); 37 | win.Show (); 38 | Application.Run (); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.GtkDemo/gtk-gui/generated.cs: -------------------------------------------------------------------------------- 1 | 2 | // This file has been generated by the GUI designer. Do not modify. 3 | namespace Stetic 4 | { 5 | internal class Gui 6 | { 7 | private static bool initialized; 8 | 9 | internal static void Initialize (Gtk.Widget iconRenderer) 10 | { 11 | if ((Stetic.Gui.initialized == false)) { 12 | Stetic.Gui.initialized = true; 13 | } 14 | } 15 | } 16 | 17 | internal class ActionGroups 18 | { 19 | public static Gtk.ActionGroup GetActionGroup (System.Type type) 20 | { 21 | return Stetic.ActionGroups.GetActionGroup (type.FullName); 22 | } 23 | 24 | public static Gtk.ActionGroup GetActionGroup (string name) 25 | { 26 | return null; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.GtkDemo/pixbuf/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icsharpcode/NRefactory/0607a4ad96ebdd16817e47dcae85b1cfcb5b5bf5/ICSharpCode.NRefactory.GtkDemo/pixbuf/comment.png -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.GtkDemo/pixbuf/element-class-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icsharpcode/NRefactory/0607a4ad96ebdd16817e47dcae85b1cfcb5b5bf5/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-class-16.png -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.GtkDemo/pixbuf/element-field-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icsharpcode/NRefactory/0607a4ad96ebdd16817e47dcae85b1cfcb5b5bf5/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-field-16.png -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.GtkDemo/pixbuf/element-literal-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icsharpcode/NRefactory/0607a4ad96ebdd16817e47dcae85b1cfcb5b5bf5/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-literal-16.png -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.GtkDemo/pixbuf/element-method-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icsharpcode/NRefactory/0607a4ad96ebdd16817e47dcae85b1cfcb5b5bf5/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-method-16.png -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.GtkDemo/pixbuf/element-namespace-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icsharpcode/NRefactory/0607a4ad96ebdd16817e47dcae85b1cfcb5b5bf5/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-namespace-16.png -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.IKVM/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AssemblyInfo.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | 28 | using System; 29 | using System.Reflection; 30 | 31 | // Information about this assembly is defined by the following attributes. 32 | // Change them to the values specific to your project. 33 | 34 | [assembly: AssemblyTitle("ICSharpCode.NRefactory.IKVM")] 35 | [assembly: AssemblyDescription("IKVM.Reflection-based Assembly Loader for NRefactory")] 36 | 37 | [assembly: CLSCompliant(true)] 38 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ConvertNullCoalescingToConditionalExpressionActionTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ConvertNullCoalescingToConditionalExpressionActionTests.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.CSharp.Refactoring; 27 | using NUnit.Framework; 28 | 29 | namespace ICSharpCode.NRefactory.CSharp.CodeActions 30 | { 31 | [TestFixture] 32 | public class ConvertNullCoalescingToConditionalExpressionActionTests: ContextActionTestBase 33 | { 34 | [Test] 35 | public void TestSimpleCase () 36 | { 37 | Test(@" 38 | class Test 39 | { 40 | object Foo (object o, object p) 41 | { 42 | return o $?? p; 43 | } 44 | } 45 | ", @" 46 | class Test 47 | { 48 | object Foo (object o, object p) 49 | { 50 | return o != null ? o : p; 51 | } 52 | } 53 | "); 54 | } 55 | } 56 | } 57 | 58 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ReplaceOperatorAssignmentWithAssignmentActionTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceOperatorAssignmentWithAssignmentActionTests.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using NUnit.Framework; 28 | using ICSharpCode.NRefactory.CSharp.Refactoring; 29 | 30 | namespace ICSharpCode.NRefactory.CSharp.CodeActions 31 | { 32 | [TestFixture] 33 | public class ReplaceOperatorAssignmentWithAssignmentActionTests : ContextActionTestBase 34 | { 35 | [Test] 36 | public void TestAdd () 37 | { 38 | Test (@" 39 | class Test 40 | { 41 | void Foo (int i) 42 | { 43 | i $+= 1 + 2; 44 | } 45 | }", @" 46 | class Test 47 | { 48 | void Foo (int i) 49 | { 50 | i = i + 1 + 2; 51 | } 52 | }"); 53 | } 54 | 55 | 56 | } 57 | } 58 | 59 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/CodeActions/ReplaceWithOperatorAssignmentActionTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ReplaceWithOperatorAssignmentActionTests.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using NUnit.Framework; 28 | using ICSharpCode.NRefactory.CSharp.Refactoring; 29 | 30 | namespace ICSharpCode.NRefactory.CSharp.CodeActions 31 | { 32 | [TestFixture] 33 | public class ReplaceWithOperatorAssignmentActionTests : ContextActionTestBase 34 | { 35 | [Test] 36 | public void TestAdd () 37 | { 38 | Test (@" 39 | class Test 40 | { 41 | void Foo (int i) 42 | { 43 | i $= i + 1 + 2; 44 | } 45 | }", @" 46 | class Test 47 | { 48 | void Foo (int i) 49 | { 50 | i += 1 + 2; 51 | } 52 | }"); 53 | } 54 | 55 | 56 | } 57 | } 58 | 59 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/CodeActions/SimplifyIfFlowInLoopsTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SimplifyIfFlowInLoopsTests.cs 3 | // 4 | // Author: 5 | // Ciprian Khlud 6 | // 7 | // Copyright (c) 2013 Ciprian Khlud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.CSharp.Refactoring; 27 | using NUnit.Framework; 28 | 29 | namespace ICSharpCode.NRefactory.CSharp.CodeActions 30 | { 31 | [TestFixture] 32 | public class SimplifyIfFlowInLoopsTests : ContextActionTestBase 33 | { 34 | [Test] 35 | public void Test() 36 | { 37 | Test( 38 | @"class TestClass 39 | { 40 | void Test () 41 | { 42 | while(true) 43 | { 44 | $if (true) { 45 | Case1 (); 46 | } 47 | } 48 | } 49 | }", 50 | @"class TestClass 51 | { 52 | void Test () 53 | { 54 | while(true) { 55 | if (false) 56 | continue; 57 | Case1 (); 58 | } 59 | } 60 | }"); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/CodeActions/SimplifyIfFlowTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SimplifyIfFlowTests.cs 3 | // 4 | // Author: 5 | // Ciprian Khlud 6 | // 7 | // Copyright (c) 2013 Ciprian Khlud 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using ICSharpCode.NRefactory.CSharp.Refactoring; 27 | using NUnit.Framework; 28 | 29 | namespace ICSharpCode.NRefactory.CSharp.CodeActions 30 | { 31 | [TestFixture] 32 | public class SimplifyIfFlowTests : ContextActionTestBase 33 | { 34 | [Test] 35 | public void Test() 36 | { 37 | Test( 38 | @"class TestClass 39 | { 40 | void Test () 41 | { 42 | $if (true) { 43 | Case1 (); 44 | } 45 | } 46 | }", 47 | @"class TestClass 48 | { 49 | void Test () 50 | { 51 | if (false) 52 | return; 53 | Case1 (); 54 | } 55 | }" 56 | ); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/DoubleNegationOperatorIssueTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DoubleNegationOperatorIssueTests.cs 3 | // 4 | // Author: 5 | // Mansheng Yang 6 | // 7 | // Copyright (c) 2012 Mansheng Yang 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using ICSharpCode.NRefactory.CSharp.Refactoring; 28 | using NUnit.Framework; 29 | 30 | namespace ICSharpCode.NRefactory.CSharp.CodeIssues 31 | { 32 | [TestFixture] 33 | public class DoubleNegationOperatorIssueTests : InspectionActionTestBase 34 | { 35 | [Test] 36 | public void Test () 37 | { 38 | var input = @" 39 | class TestClass 40 | { 41 | bool GetBool () { } 42 | 43 | void TestMethod () 44 | { 45 | var x = !!GetBool (); 46 | x = !(!(GetBool ())); 47 | } 48 | }"; 49 | var output = @" 50 | class TestClass 51 | { 52 | bool GetBool () { } 53 | 54 | void TestMethod () 55 | { 56 | var x = GetBool (); 57 | x = GetBool (); 58 | } 59 | }"; 60 | Test (input, 2, output); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/NotImplementedExceptionInspectorTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // NotImplementedExceptionInspectorTests.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2012 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using NUnit.Framework; 29 | using ICSharpCode.NRefactory.CSharp.Refactoring; 30 | using ICSharpCode.NRefactory.CSharp.CodeActions; 31 | 32 | namespace ICSharpCode.NRefactory.CSharp.CodeIssues 33 | { 34 | [TestFixture] 35 | public class NotImplementedExceptionInspectorTests : InspectionActionTestBase 36 | { 37 | [Test] 38 | public void TestInspectorCase1 () 39 | { 40 | var input = @"class Foo 41 | { 42 | void Bar (string str) 43 | { 44 | throw new System.NotImplementedException (); 45 | } 46 | }"; 47 | 48 | TestRefactoringContext context; 49 | var issues = GetIssues (new NotImplementedExceptionIssue (), input, out context); 50 | Assert.AreEqual (1, issues.Count); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantAttributeParenthesesIssueTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // RedundantAttributeParenthesesIssueTests.cs 3 | // 4 | // Author: 5 | // Mansheng Yang 6 | // 7 | // Copyright (c) 2012 Mansheng Yang 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using ICSharpCode.NRefactory.CSharp.Refactoring; 28 | using NUnit.Framework; 29 | 30 | namespace ICSharpCode.NRefactory.CSharp.CodeIssues 31 | { 32 | [TestFixture] 33 | public class RedundantAttributeParenthesesIssueTests : InspectionActionTestBase 34 | { 35 | [Test] 36 | public void Test () 37 | { 38 | var input = @" 39 | [Test ()] 40 | class TestClass { }"; 41 | var output = @" 42 | [Test] 43 | class TestClass { }"; 44 | Test (input, 1, output); 45 | } 46 | 47 | 48 | [Test] 49 | public void TestDisable () 50 | { 51 | var input = @" 52 | // Resharper disable once RedundantAttributeParentheses 53 | [Test ()] 54 | class TestClass { }"; 55 | Test (input, 0); 56 | } 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantWhereWithPredicateIssueTests.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icsharpcode/NRefactory/0607a4ad96ebdd16817e47dcae85b1cfcb5b5bf5/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantWhereWithPredicateIssueTests.cs -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/DepthFirstVisitorTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Linq; 22 | using NUnit.Framework; 23 | 24 | namespace ICSharpCode.NRefactory.CSharp 25 | { 26 | [TestFixture] 27 | public class DepthFirstVisitorTests 28 | { 29 | sealed class CollectNodesVisitor : DepthFirstAstVisitor 30 | { 31 | internal List nodes = new List(); 32 | 33 | protected override void VisitChildren(AstNode node) 34 | { 35 | nodes.Add(node); 36 | base.VisitChildren(node); 37 | } 38 | } 39 | 40 | [Test] 41 | public void TestCollectNodes() 42 | { 43 | var cu = new CSharpParser().Parse("using System;\nclass Test {\n int field; // comment\n}"); 44 | CollectNodesVisitor v = new CollectNodesVisitor(); 45 | cu.AcceptVisitor(v); 46 | Assert.AreEqual(cu.DescendantsAndSelf.ToList(), v.nodes); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Inspector/InconsistentNamingIssueTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InconsistentNamingIssueTests.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2012 Xamarin 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace ICSharpCode.NRefactory 29 | { 30 | public class InconsistentNamingIssueTests 31 | { 32 | public InconsistentNamingIssueTests () 33 | { 34 | } 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/AnonymousTypeCreateExpressionTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.Expression 23 | { 24 | [TestFixture] 25 | public class AnonymousTypeCreateExpressionTests 26 | { 27 | [Test] 28 | public void Simple() 29 | { 30 | ParseUtilCSharp.AssertExpression( 31 | "new { Name = \"Test\", Price, Something.Property }", 32 | new AnonymousTypeCreateExpression { 33 | Initializers = { 34 | new NamedExpression("Name", new PrimitiveExpression("Test")), 35 | new IdentifierExpression("Price"), 36 | new IdentifierExpression("Something").Member("Property") 37 | }}); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/BaseReferenceExpressionTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.Expression 23 | { 24 | [TestFixture] 25 | public class BaseReferenceExpressionTests 26 | { 27 | [Test] 28 | public void BaseReferenceExpressionTest1() 29 | { 30 | MemberReferenceExpression fre = ParseUtilCSharp.ParseExpression("base.myField"); 31 | Assert.IsTrue(fre.Target is BaseReferenceExpression); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/CheckedExpressionTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.Expression 23 | { 24 | [TestFixture] 25 | public class CheckedExpressionTests 26 | { 27 | [Test] 28 | public void CheckedExpressionTest() 29 | { 30 | CheckedExpression ce = ParseUtilCSharp.ParseExpression("checked(a)"); 31 | Assert.IsTrue(ce.Expression is IdentifierExpression); 32 | } 33 | 34 | [Test] 35 | public void UncheckedExpressionTest() 36 | { 37 | UncheckedExpression ce = ParseUtilCSharp.ParseExpression("unchecked(a)"); 38 | Assert.IsTrue(ce.Expression is IdentifierExpression); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/ParenthesizedExpressionTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.Expression 23 | { 24 | [TestFixture] 25 | public class ParenthesizedExpressionTests 26 | { 27 | [Test] 28 | public void PrimitiveParenthesizedExpression() 29 | { 30 | ParenthesizedExpression p = ParseUtilCSharp.ParseExpression("((1))"); 31 | Assert.IsTrue(p.Expression is ParenthesizedExpression); 32 | p = (ParenthesizedExpression)p.Expression; 33 | Assert.IsTrue(p.Expression is PrimitiveExpression); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/PointerReferenceExpressionTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.Expression 23 | { 24 | [TestFixture] 25 | public class PointerReferenceExpressionTests 26 | { 27 | [Test] 28 | public void PointerReferenceExpressionTest() 29 | { 30 | PointerReferenceExpression pre = ParseUtilCSharp.ParseExpression("myObj.field->b"); 31 | Assert.IsTrue(pre.Target is MemberReferenceExpression); 32 | Assert.AreEqual("b", pre.MemberName); 33 | } 34 | 35 | [Test] 36 | public void PointerReferenceGenericMethodTest() 37 | { 38 | ParseUtilCSharp.AssertExpression( 39 | "ptr->M();", 40 | new InvocationExpression { 41 | Target = new PointerReferenceExpression { 42 | Target = new IdentifierExpression("ptr"), 43 | MemberName = "M", 44 | TypeArguments = { new PrimitiveType("string") } 45 | }}); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/SizeOfExpressionTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.Expression 23 | { 24 | [TestFixture] 25 | public class SizeOfExpressionTests 26 | { 27 | [Test] 28 | public void SizeOfExpressionTest() 29 | { 30 | SizeOfExpression soe = ParseUtilCSharp.ParseExpression("sizeof(MyType)"); 31 | Assert.AreEqual("MyType", ((SimpleType)soe.Type).Identifier); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/StackAllocExpressionTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Linq; 21 | using NUnit.Framework; 22 | 23 | namespace ICSharpCode.NRefactory.CSharp.Parser.Expression 24 | { 25 | [TestFixture] 26 | public class StackAllocExpressionTests 27 | { 28 | [Test] 29 | public void StackAllocExpressionTest() 30 | { 31 | var vd = ParseUtilCSharp.ParseStatement("int* a = stackalloc int[100];"); 32 | StackAllocExpression sae = (StackAllocExpression)vd.Variables.Single().Initializer; 33 | Assert.AreEqual("int", ((PrimitiveType)sae.Type).Keyword); 34 | Assert.AreEqual(100, ((PrimitiveExpression)sae.CountExpression).Value); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/ThisReferenceExpressionTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.Expression 23 | { 24 | [TestFixture] 25 | public class ThisReferenceExpressionTests 26 | { 27 | [Test] 28 | public void TestMethod() 29 | { 30 | ParseUtilCSharp.ParseExpression("this"); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/EmptyStatementTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.Statements 23 | { 24 | [TestFixture] 25 | public class EmptyStatementTests 26 | { 27 | [Test] 28 | public void EmptyStatementTest() 29 | { 30 | ParseUtilCSharp.ParseStatement(";"); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/ExpressionStatementTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.Statements 23 | { 24 | [TestFixture] 25 | public class ExpressionStatementTests 26 | { 27 | [Test] 28 | public void StatementExpressionTest() 29 | { 30 | ExpressionStatement stmtExprStmt = ParseUtilCSharp.ParseStatement("a = my.Obj.PropCall;"); 31 | Assert.IsTrue(stmtExprStmt.Expression is AssignmentExpression); 32 | } 33 | 34 | [Test] 35 | public void StatementExpressionTest1() 36 | { 37 | ExpressionStatement stmtExprStmt = ParseUtilCSharp.ParseStatement("yield.yield();"); 38 | Assert.IsTrue(stmtExprStmt.Expression is InvocationExpression); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/InvalidStatementsTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // InvalidStatementTests.cs 3 | // 4 | // Author: 5 | // Simon Lindgren 6 | // 7 | // Copyright (c) 2012 Simon Lindgren 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using NUnit.Framework; 27 | using ICSharpCode.NRefactory.CSharp; 28 | using ICSharpCode.NRefactory.CSharp.Parser; 29 | 30 | namespace ICSharpCode.NRefactory.CSharp.Parser.Statements 31 | { 32 | [TestFixture] 33 | public class InvalidStatementsTests 34 | { 35 | 36 | [Test] 37 | public void AsExpressionStatementPositions() 38 | { 39 | ExpressionStatement expr = ParseUtilCSharp.ParseStatement("\t\t\"\" as IEnumerable;", false); 40 | Assert.AreEqual(new TextLocation(1, 3), expr.StartLocation); 41 | Assert.AreEqual(new TextLocation(1, 27), expr.EndLocation); 42 | } 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/LabelStatementTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Linq; 21 | using NUnit.Framework; 22 | 23 | namespace ICSharpCode.NRefactory.CSharp.Parser.Statements 24 | { 25 | [TestFixture] 26 | public class LabelStatementTests 27 | { 28 | [Test] 29 | public void LabelStatementTest() 30 | { 31 | BlockStatement block = ParseUtilCSharp.ParseStatement("{ myLabel: ; }"); 32 | LabelStatement labelStmt = (LabelStatement)block.Statements.First(); 33 | Assert.AreEqual("myLabel", labelStmt.Label); 34 | } 35 | 36 | [Test] 37 | public void Label2StatementTest() 38 | { 39 | BlockStatement block = ParseUtilCSharp.ParseStatement("{ yield: ; }"); 40 | LabelStatement labelStmt = (LabelStatement)block.Statements.First(); 41 | Assert.AreEqual("yield", labelStmt.Label); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/LockStatementTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.Statements 23 | { 24 | [TestFixture] 25 | public class LockStatementTests 26 | { 27 | [Test] 28 | public void LockStatementTest() 29 | { 30 | ParseUtilCSharp.ParseStatement("lock (myObj) {}"); 31 | // TODO : Extend test. 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/ReturnStatementTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.Statements 23 | { 24 | [TestFixture] 25 | public class ReturnStatementTests 26 | { 27 | [Test] 28 | public void EmptyReturnStatementTest() 29 | { 30 | ReturnStatement returnStatement = ParseUtilCSharp.ParseStatement("return;"); 31 | Assert.IsTrue(returnStatement.Expression.IsNull); 32 | } 33 | 34 | [Test] 35 | public void ReturnStatementTest() 36 | { 37 | ReturnStatement returnStatement = ParseUtilCSharp.ParseStatement("return 5;"); 38 | Assert.IsTrue(returnStatement.Expression is PrimitiveExpression); 39 | } 40 | 41 | [Test] 42 | public void ReturnStatementTest1() 43 | { 44 | ReturnStatement returnStatement = ParseUtilCSharp.ParseStatement("return yield;"); 45 | Assert.IsTrue(returnStatement.Expression is IdentifierExpression); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/SwitchStatementTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.Statements 23 | { 24 | [TestFixture] 25 | public class SwitchStatementTests 26 | { 27 | [Test] 28 | public void SwitchStatementTest() 29 | { 30 | SwitchStatement switchStmt = ParseUtilCSharp.ParseStatement("switch (a) { case 4: case 5: break; case 6: break; default: break; }"); 31 | Assert.AreEqual("a", ((IdentifierExpression)switchStmt.Expression).Identifier); 32 | // TODO: Extend test 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/ThrowStatementTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.Statements 23 | { 24 | [TestFixture] 25 | public class ThrowStatementTests 26 | { 27 | [Test] 28 | public void EmptyThrowStatementTest() 29 | { 30 | ThrowStatement throwStmt = ParseUtilCSharp.ParseStatement("throw;"); 31 | Assert.IsTrue(throwStmt.Expression.IsNull); 32 | } 33 | 34 | [Test] 35 | public void ThrowStatementTest() 36 | { 37 | ThrowStatement throwStmt = ParseUtilCSharp.ParseStatement("throw new Exception();"); 38 | Assert.IsTrue(throwStmt.Expression is ObjectCreateExpression); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/UnsafeStatementTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.Statements 23 | { 24 | [TestFixture] 25 | public class UnsafeStatementTests 26 | { 27 | [Test] 28 | public void UnsafeStatementTest() 29 | { 30 | UnsafeStatement unsafeStatement = ParseUtilCSharp.ParseStatement("unsafe { }"); 31 | Assert.IsFalse(unsafeStatement.Body.IsNull); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/WhileStatementTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.Statements 23 | { 24 | [TestFixture] 25 | public class WhileStatementTests 26 | { 27 | [Test] 28 | public void WhileStatementTest() 29 | { 30 | WhileStatement loopStmt = ParseUtilCSharp.ParseStatement("while (true) { }"); 31 | Assert.IsTrue(loopStmt.Condition is PrimitiveExpression); 32 | Assert.IsTrue(loopStmt.EmbeddedStatement is BlockStatement); 33 | } 34 | 35 | [Test] 36 | public void DoWhileStatementTest() 37 | { 38 | DoWhileStatement loopStmt = ParseUtilCSharp.ParseStatement("do { } while (true);"); 39 | Assert.IsTrue(loopStmt.Condition is PrimitiveExpression); 40 | Assert.IsTrue(loopStmt.EmbeddedStatement is BlockStatement); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/CSharp/Parser/TypeMembers/DestructorDeclarationTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using NUnit.Framework; 21 | 22 | namespace ICSharpCode.NRefactory.CSharp.Parser.TypeMembers 23 | { 24 | [TestFixture] 25 | public class DestructorDeclarationTests 26 | { 27 | [Test] 28 | public void DestructorDeclarationTest() 29 | { 30 | ParseUtilCSharp.ParseTypeMember("~MyClass() {}"); 31 | } 32 | 33 | [Test] 34 | public void ExternDestructorDeclarationTest() 35 | { 36 | DestructorDeclaration dd = ParseUtilCSharp.ParseTypeMember("extern ~MyClass();"); 37 | Assert.AreEqual(Modifiers.Extern, dd.Modifiers); 38 | } 39 | 40 | [Test] 41 | public void UnsafeDestructorDeclarationTest() 42 | { 43 | DestructorDeclaration dd = ParseUtilCSharp.ParseTypeMember("unsafe ~MyClass() {}"); 44 | Assert.AreEqual(Modifiers.Unsafe, dd.Modifiers); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/IndentationTests/TestFiles/Comments.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Comment.cs 3 | // 4 | // Author: 5 | // Matej Miklečić 6 | // 7 | // Copyright (c) 2013 Matej Miklečić (matej.miklecic@gmail.com) 8 | // 9 | 10 | namespace Comments 11 | { 12 | /// 13 | /// This is a test file for all types of comments. 14 | /// 15 | class Comments 16 | { 17 | /// 18 | /// Comment method. 19 | /// 20 | /// 21 | /// Id. 22 | /// 23 | void Comment(int id, // id 24 | string text) // text 25 | { 26 | int i; // i 27 | 28 | for (i = 0; i < 42 /* 42; */; i++) /* 29 | * Multi-line 30 | */ 31 | { 32 | // break 33 | break; 34 | } // for 35 | 36 | /////////* 37 | 38 | while (true) 39 | // comments don't affect continuation 40 | ; 41 | 42 | /********/ if (false) lock (this) 43 | // /* 44 | ; 45 | 46 | { /*/*/ } 47 | } 48 | /*/ still in comment } */ 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/IndentationTests/TestFiles/InheritStatements.cs: -------------------------------------------------------------------------------- 1 | namespace InheritStatements 2 | { 3 | class A : B where T : B 4 | { 5 | A() : base() 6 | { 7 | base(); 8 | } 9 | } 10 | 11 | class C 12 | : D where T 13 | : D 14 | { 15 | C() 16 | : this(this.ToString()) 17 | { 18 | throw this; 19 | } 20 | 21 | C(object c) 22 | : base() 23 | { 24 | base(); 25 | } 26 | } 27 | 28 | class E : 29 | F 30 | where T : F 31 | { 32 | E() : 33 | base() 34 | { 35 | base(); 36 | } 37 | } 38 | 39 | class X 40 | { 41 | X() 42 | { 43 | var t = this.ToString(); 44 | var b = t == "X" 45 | ? true 46 | : false; 47 | 48 | if (b) goto x; 49 | 50 | switch (t) 51 | { 52 | default: 53 | y: throw null; 54 | } 55 | 56 | x: ; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/IndentationTests/TestFiles/PreProcessorDirectives.cs: -------------------------------------------------------------------------------- 1 | #if !DEBUG 2 | #define DEBUG 3 | #endif 4 | 5 | #if TRACE 6 | #undef TRACE 7 | #endif 8 | 9 | namespace PreProcessorDirectives 10 | { 11 | class PreProcessorDirectives 12 | { 13 | void IfDebug() 14 | { 15 | #region If/Elif Directives 16 | 17 | #if DEBUG 18 | { 19 | // This block should be correctly indented 20 | } 21 | #elif true 22 | { 23 | // This comment is not indented since the #if was true 24 | } 25 | #endif 26 | 27 | #if TRACE 28 | { 29 | // Not indented 30 | } 31 | #elif debug 32 | { 33 | // Also not indented 34 | } 35 | #else 36 | { 37 | // This should be indented 38 | } 39 | #endif 40 | 41 | #endregion 42 | } 43 | 44 | #region One-line directives 45 | 46 | void OneLiners 47 | { 48 | // 49 | #pragma warning disable 649 50 | // 51 | #warning 649 52 | // 53 | #line 649 54 | // 55 | #error 649 56 | // 57 | } 58 | 59 | #endregion 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/IndentationTests/TestFiles/Simple.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SimpleNamespace 4 | { 5 | class SimpleClass 6 | { 7 | void SimpleMethod() 8 | { 9 | // simple comment 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/IndentationTests/TestFiles/Strings.cs: -------------------------------------------------------------------------------- 1 | namespace Strings 2 | { 3 | class Strings 4 | { 5 | void Strings(string s = "") 6 | { 7 | s = @""" 8 | can't escape a verbatim string \"; 9 | s = @"" "not in verbatim anymore 10 | ; 11 | s = ""; 12 | s = "\\"; 13 | s = "\\\\\\\""; 14 | s = " // syntax error, but on the next line we start with the previous state 15 | ; 16 | s = "'c\'"; 17 | string concat = "line 1" + 18 | "line 2" + 19 | "line 3"; 20 | 21 | var c = '\\'; 22 | c = '\''; 23 | c = ' // syntax error, but on the next line we start with the previous state 24 | ; 25 | c = ';'; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/IndentationTests/TestFiles/SwitchCase.cs: -------------------------------------------------------------------------------- 1 | /// 2 | /// Switch case with CSharpFormattingOptions.IndentBreakStatements = false; 3 | /// 4 | class SwitchCase 5 | { 6 | void Main(int param) 7 | { 8 | switch (param) 9 | { 10 | case 1: 11 | while (true) 12 | { 13 | break; 14 | continue; 15 | return; 16 | goto case 2; 17 | goto default; 18 | } 19 | break; 20 | case 2: 21 | // ... 22 | continue; 23 | case 3: 24 | // ... 25 | return; 26 | case 4: 27 | // ... 28 | goto default; 29 | default: 30 | // ... 31 | goto case 1; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("ICSharpCode.NRefactory.Tests")] 13 | [assembly: AssemblyDescription("NRefactory unit tests")] 14 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/TypeSystem/LazyLoadedCecilLoaderTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using ICSharpCode.NRefactory.TypeSystem.Implementation; 21 | using NUnit.Framework; 22 | 23 | namespace ICSharpCode.NRefactory.TypeSystem 24 | { 25 | [TestFixture] 26 | public class LazyLoadedCecilLoaderTests : TypeSystemTests 27 | { 28 | [TestFixtureSetUp] 29 | public void FixtureSetUp() 30 | { 31 | CecilLoader loader = new CecilLoader() { IncludeInternalMembers = true, LazyLoad = true }; 32 | IUnresolvedAssembly pc = loader.LoadAssemblyFile(typeof(TestCase.SimplePublicClass).Assembly.Location); 33 | base.compilation = new SimpleCompilation(pc, CecilLoaderTests.Mscorlib); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/TypeSystem/SerializedCecilLoaderTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.IO; 21 | using ICSharpCode.NRefactory.TypeSystem.Implementation; 22 | using ICSharpCode.NRefactory.Utils; 23 | using NUnit.Framework; 24 | 25 | namespace ICSharpCode.NRefactory.TypeSystem 26 | { 27 | [TestFixture] 28 | public class SerializedCecilLoaderTests : TypeSystemTests 29 | { 30 | [TestFixtureSetUp] 31 | public void FixtureSetUp() 32 | { 33 | CecilLoader loader = new CecilLoader() { IncludeInternalMembers = true }; 34 | IUnresolvedAssembly pc = loader.LoadAssemblyFile(typeof(TestCase.SimplePublicClass).Assembly.Location); 35 | FastSerializer serializer = new FastSerializer(); 36 | using (MemoryStream ms = new MemoryStream()) { 37 | serializer.Serialize(ms, pc); 38 | ms.Position = 0; 39 | var asm = (IUnresolvedAssembly)serializer.Deserialize(ms); 40 | base.compilation = new SimpleCompilation(asm, CecilLoaderTests.Mscorlib); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/TypeSystem/SerializedIkvmLoaderTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.IO; 21 | using ICSharpCode.NRefactory.TypeSystem.Implementation; 22 | using ICSharpCode.NRefactory.Utils; 23 | using NUnit.Framework; 24 | 25 | namespace ICSharpCode.NRefactory.TypeSystem 26 | { 27 | [TestFixture] 28 | public class SerializedIkvmLoaderTests : TypeSystemTests 29 | { 30 | [TestFixtureSetUp] 31 | public void FixtureSetUp() 32 | { 33 | IkvmLoader loader = new IkvmLoader() { IncludeInternalMembers = true }; 34 | IUnresolvedAssembly pc = loader.LoadAssemblyFile(typeof(TestCase.SimplePublicClass).Assembly.Location); 35 | FastSerializer serializer = new FastSerializer(); 36 | using (MemoryStream ms = new MemoryStream()) { 37 | serializer.Serialize(ms, pc); 38 | ms.Position = 0; 39 | var asm = (IUnresolvedAssembly)serializer.Deserialize(ms); 40 | base.compilation = new SimpleCompilation(asm, IkvmLoaderTests.Mscorlib); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Xml/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("ICSharpCode.NRefactory.Xml")] 13 | [assembly: AssemblyDescription("Error-tolerant XML parser")] 14 | 15 | [assembly: CLSCompliant(true)] 16 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Xml/TextType.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | 21 | namespace ICSharpCode.NRefactory.Xml 22 | { 23 | /// Identifies the context in which the text occured 24 | enum TextType 25 | { 26 | /// Ends with non-whitespace 27 | WhiteSpace, 28 | 29 | /// Ends with "<"; "]]>" is error 30 | CharacterData, 31 | 32 | /// Ends with "-->"; "--" is error 33 | Comment, 34 | 35 | /// Ends with "]]>" 36 | CData, 37 | 38 | /// Ends with "?>" 39 | ProcessingInstruction, 40 | 41 | /// Ends with "<" or ">" 42 | UnknownBang, 43 | 44 | /// Unknown 45 | Other 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.Xml/XmlSegment.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using ICSharpCode.NRefactory.Editor; 21 | 22 | namespace ICSharpCode.NRefactory.Xml 23 | { 24 | sealed class XmlSegment : ISegment 25 | { 26 | readonly int startOffset, endOffset; 27 | 28 | public XmlSegment(int startOffset, int endOffset) 29 | { 30 | if (endOffset < startOffset) 31 | throw new ArgumentOutOfRangeException(); 32 | this.startOffset = startOffset; 33 | this.endOffset = endOffset; 34 | } 35 | 36 | int ISegment.Offset { 37 | get { return startOffset; } 38 | } 39 | 40 | int ISegment.Length { 41 | get { return endOffset - startOffset; } 42 | } 43 | 44 | int ISegment.EndOffset { 45 | get { return endOffset; } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/icsharpcode/NRefactory/0607a4ad96ebdd16817e47dcae85b1cfcb5b5bf5/ICSharpCode.NRefactory.snk -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Analysis/TypeGraphNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using ICSharpCode.NRefactory.TypeSystem; 22 | 23 | namespace ICSharpCode.NRefactory.Analysis 24 | { 25 | public sealed class TypeGraphNode 26 | { 27 | readonly ITypeDefinition typeDef; 28 | readonly List baseTypes = new List(); 29 | readonly List derivedTypes = new List(); 30 | 31 | /// 32 | /// Creates a new unconnected type graph node. 33 | /// 34 | public TypeGraphNode(ITypeDefinition typeDef) 35 | { 36 | this.typeDef = typeDef; 37 | } 38 | 39 | public ITypeDefinition TypeDefinition { 40 | get { return typeDef; } 41 | } 42 | 43 | public IList DerivedTypes { 44 | get { return derivedTypes; } 45 | } 46 | 47 | public IList BaseTypes { 48 | get { return baseTypes; } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Completion/CompletionCategory.cs: -------------------------------------------------------------------------------- 1 | // 2 | // CompletionCategory.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2011 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace ICSharpCode.NRefactory.Completion 29 | { 30 | public abstract class CompletionCategory : IComparable 31 | { 32 | public string DisplayText { get; set; } 33 | 34 | public string Icon { get; set; } 35 | 36 | protected CompletionCategory () 37 | { 38 | } 39 | 40 | protected CompletionCategory (string displayText, string icon) 41 | { 42 | this.DisplayText = displayText; 43 | this.Icon = icon; 44 | } 45 | 46 | public abstract int CompareTo (CompletionCategory other); 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Completion/DisplayFlags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DisplayFlags.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2011 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace ICSharpCode.NRefactory.Completion 29 | { 30 | [Flags] 31 | public enum DisplayFlags 32 | { 33 | None = 0, 34 | Hidden = 1, 35 | Obsolete = 2, 36 | DescriptionHasMarkup = 4, 37 | NamedArgument = 8, 38 | IsImportCompletion = 16, 39 | MarkedBold = 32 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Completion/ICompletionData.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ICompletionData.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2011 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Collections.Generic; 28 | 29 | namespace ICSharpCode.NRefactory.Completion 30 | { 31 | public interface ICompletionData 32 | { 33 | CompletionCategory CompletionCategory { get; set; } 34 | 35 | string DisplayText { get; set; } 36 | 37 | string Description { get; set; } 38 | 39 | string CompletionText { get; set; } 40 | 41 | DisplayFlags DisplayFlags { get; set; } 42 | 43 | bool HasOverloads { 44 | get; 45 | } 46 | 47 | IEnumerable OverloadedData { 48 | get; 49 | } 50 | 51 | void AddOverload (ICompletionData data); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Completion/IEntityCompletionData.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IEntityCompletionData.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2011 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using ICSharpCode.NRefactory.TypeSystem; 28 | 29 | namespace ICSharpCode.NRefactory.Completion 30 | { 31 | public interface IEntityCompletionData : ICompletionData 32 | { 33 | IEntity Entity { 34 | get; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Completion/IVariableCompletionData.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IVariableCompletionData.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2011 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using ICSharpCode.NRefactory.TypeSystem; 28 | 29 | namespace ICSharpCode.NRefactory.Completion 30 | { 31 | public interface IVariableCompletionData : ICompletionData 32 | { 33 | IVariable Variable { 34 | get; 35 | } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/PatternMatching/AnyNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | 21 | namespace ICSharpCode.NRefactory.PatternMatching 22 | { 23 | /// 24 | /// Matches any node. 25 | /// 26 | /// Does not match null nodes. 27 | public class AnyNode : Pattern 28 | { 29 | readonly string groupName; 30 | 31 | public string GroupName { 32 | get { return groupName; } 33 | } 34 | 35 | public AnyNode(string groupName = null) 36 | { 37 | this.groupName = groupName; 38 | } 39 | 40 | public override bool DoMatch(INode other, Match match) 41 | { 42 | match.Add(this.groupName, other); 43 | return other != null && !other.IsNull; 44 | } 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/PatternMatching/AnyNodeOrNull.cs: -------------------------------------------------------------------------------- 1 | // 2 | // AnyNodeOrNull.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2013 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | 29 | namespace ICSharpCode.NRefactory.PatternMatching 30 | { 31 | /// 32 | /// Matches any node. 33 | /// 34 | /// Does not match null nodes. 35 | public class AnyNodeOrNull : Pattern 36 | { 37 | readonly string groupName; 38 | 39 | public string GroupName { 40 | get { return groupName; } 41 | } 42 | 43 | public AnyNodeOrNull(string groupName = null) 44 | { 45 | this.groupName = groupName; 46 | } 47 | 48 | public override bool DoMatch(INode other, Match match) 49 | { 50 | if (other == null) { 51 | match.AddNull(this.groupName); 52 | } else { 53 | match.Add(this.groupName, other); 54 | } 55 | return true; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/PatternMatching/Backreference.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Linq; 21 | 22 | namespace ICSharpCode.NRefactory.PatternMatching 23 | { 24 | /// 25 | /// Matches the last entry in the specified named group. 26 | /// 27 | public class Backreference : Pattern 28 | { 29 | readonly string referencedGroupName; 30 | 31 | public string ReferencedGroupName { 32 | get { return referencedGroupName; } 33 | } 34 | 35 | public Backreference(string referencedGroupName) 36 | { 37 | if (referencedGroupName == null) 38 | throw new ArgumentNullException("referencedGroupName"); 39 | this.referencedGroupName = referencedGroupName; 40 | } 41 | 42 | public override bool DoMatch(INode other, Match match) 43 | { 44 | var last = match.Get (referencedGroupName).Last (); 45 | if (last == null && other == null) 46 | return true; 47 | return last.IsMatch(other); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/PatternMatching/BacktrackingInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Linq; 22 | 23 | namespace ICSharpCode.NRefactory.PatternMatching 24 | { 25 | /// 26 | /// Container for the backtracking info. 27 | /// 28 | public class BacktrackingInfo 29 | { 30 | internal Stack backtrackingStack = new Stack(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/PatternMatching/NamedNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | 21 | namespace ICSharpCode.NRefactory.PatternMatching 22 | { 23 | /// 24 | /// Represents a named node within a pattern. 25 | /// 26 | public class NamedNode : Pattern 27 | { 28 | readonly string groupName; 29 | readonly INode childNode; 30 | 31 | public string GroupName { 32 | get { return groupName; } 33 | } 34 | 35 | public INode ChildNode { 36 | get { return childNode; } 37 | } 38 | 39 | public NamedNode(string groupName, INode childNode) 40 | { 41 | if (childNode == null) 42 | throw new ArgumentNullException("childNode"); 43 | this.groupName = groupName; 44 | this.childNode = childNode; 45 | } 46 | 47 | public override bool DoMatch(INode other, Match match) 48 | { 49 | match.Add(this.groupName, other); 50 | return childNode.DoMatch(other, match); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Refactoring/IssueMarker.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IssueMarker.cs 3 | // 4 | // Author: 5 | // Mike Krüger 6 | // 7 | // Copyright (c) 2012 Xamarin Inc. (http://xamarin.com) 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace ICSharpCode.NRefactory.Refactoring 29 | { 30 | /// 31 | /// The issue marker is used to set how an issue should be marked inside the text editor. 32 | /// 33 | public enum IssueMarker 34 | { 35 | /// 36 | /// The issue is not shown inside the text editor. (But in the task bar) 37 | /// 38 | None, 39 | 40 | /// 41 | /// The region is marked as underline in the severity color. 42 | /// 43 | WavedLine, 44 | 45 | /// 46 | /// The region is marked as dotted line in the severity color. 47 | /// 48 | DottedLine, 49 | 50 | /// 51 | /// The text is grayed out. 52 | /// 53 | GrayOut 54 | } 55 | 56 | } 57 | 58 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Semantics/AmbiguousResolveResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using ICSharpCode.NRefactory.TypeSystem; 21 | 22 | namespace ICSharpCode.NRefactory.Semantics 23 | { 24 | /// 25 | /// Represents an ambiguous type resolve result. 26 | /// 27 | public class AmbiguousTypeResolveResult : TypeResolveResult 28 | { 29 | public AmbiguousTypeResolveResult(IType type) : base(type) 30 | { 31 | } 32 | 33 | public override bool IsError { 34 | get { return true; } 35 | } 36 | } 37 | 38 | /// 39 | /// Represents an ambiguous field/property/event access. 40 | /// 41 | public class AmbiguousMemberResolveResult : MemberResolveResult 42 | { 43 | public AmbiguousMemberResolveResult(ResolveResult targetResult, IMember member) : base(targetResult, member) 44 | { 45 | } 46 | 47 | public override bool IsError { 48 | get { return true; } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Semantics/InitializedObjectResolveResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using ICSharpCode.NRefactory.TypeSystem; 21 | 22 | namespace ICSharpCode.NRefactory.Semantics 23 | { 24 | /// 25 | /// Refers to the object that is currently being initialized. 26 | /// Used within . 27 | /// 28 | public class InitializedObjectResolveResult : ResolveResult 29 | { 30 | public InitializedObjectResolveResult(IType type) : base(type) 31 | { 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Semantics/NamespaceResolveResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Globalization; 21 | using ICSharpCode.NRefactory.TypeSystem; 22 | 23 | namespace ICSharpCode.NRefactory.Semantics 24 | { 25 | /// 26 | /// Represents that an expression resolved to a namespace. 27 | /// 28 | public class NamespaceResolveResult : ResolveResult 29 | { 30 | readonly INamespace ns; 31 | 32 | public NamespaceResolveResult(INamespace ns) : base(SpecialType.UnknownType) 33 | { 34 | this.ns = ns; 35 | } 36 | 37 | public INamespace Namespace { 38 | get { return ns; } 39 | } 40 | 41 | public string NamespaceName { 42 | get { return ns.FullName; } 43 | } 44 | 45 | public override string ToString() 46 | { 47 | return string.Format(CultureInfo.InvariantCulture, "[{0} {1}]", GetType().Name, ns); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Semantics/ThisResolveResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using ICSharpCode.NRefactory.TypeSystem; 21 | 22 | namespace ICSharpCode.NRefactory.Semantics 23 | { 24 | /// 25 | /// Represents the 'this' reference. 26 | /// Also used for the 'base' reference. 27 | /// 28 | public class ThisResolveResult : ResolveResult 29 | { 30 | bool causesNonVirtualInvocation; 31 | 32 | public ThisResolveResult(IType type, bool causesNonVirtualInvocation = false) : base(type) 33 | { 34 | this.causesNonVirtualInvocation = causesNonVirtualInvocation; 35 | } 36 | 37 | /// 38 | /// Gets whether this resolve result causes member invocations to be non-virtual. 39 | /// 40 | public bool CausesNonVirtualInvocation { 41 | get { return causesNonVirtualInvocation; } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Semantics/TypeIsResolveResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using ICSharpCode.NRefactory.TypeSystem; 21 | 22 | namespace ICSharpCode.NRefactory.Semantics 23 | { 24 | /// 25 | /// Resolve result for a C# 'is' expression. 26 | /// "Input is TargetType". 27 | /// 28 | public class TypeIsResolveResult : ResolveResult 29 | { 30 | public readonly ResolveResult Input; 31 | /// 32 | /// Type that is being compared with. 33 | /// 34 | public readonly IType TargetType; 35 | 36 | public TypeIsResolveResult(ResolveResult input, IType targetType, IType booleanType) 37 | : base(booleanType) 38 | { 39 | if (input == null) 40 | throw new ArgumentNullException("input"); 41 | if (targetType == null) 42 | throw new ArgumentNullException("targetType"); 43 | this.Input = input; 44 | this.TargetType = targetType; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Semantics/TypeOfResolveResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using ICSharpCode.NRefactory.TypeSystem; 21 | 22 | namespace ICSharpCode.NRefactory.Semantics 23 | { 24 | /// 25 | /// Represents the 'typeof'. 26 | /// 27 | public class TypeOfResolveResult : ResolveResult 28 | { 29 | readonly IType referencedType; 30 | 31 | public TypeOfResolveResult(IType systemType, IType referencedType) 32 | : base(systemType) 33 | { 34 | if (referencedType == null) 35 | throw new ArgumentNullException("referencedType"); 36 | this.referencedType = referencedType; 37 | } 38 | 39 | /// 40 | /// The type referenced by the 'typeof'. 41 | /// 42 | public IType ReferencedType { 43 | get { return referencedType; } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Semantics/TypeResolveResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using ICSharpCode.NRefactory.TypeSystem; 21 | 22 | namespace ICSharpCode.NRefactory.Semantics 23 | { 24 | /// 25 | /// The resolved expression refers to a type name. 26 | /// 27 | public class TypeResolveResult : ResolveResult 28 | { 29 | public TypeResolveResult(IType type) 30 | : base(type) 31 | { 32 | } 33 | 34 | public override bool IsError { 35 | get { return this.Type.Kind == TypeKind.Unknown; } 36 | } 37 | 38 | public override DomRegion GetDefinitionRegion() 39 | { 40 | ITypeDefinition def = this.Type.GetDefinition(); 41 | if (def != null) 42 | return def.Region; 43 | else 44 | return DomRegion.Empty; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/TypeSystem/ICodeContext.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | 22 | namespace ICSharpCode.NRefactory.TypeSystem 23 | { 24 | public interface ICodeContext : ITypeResolveContext 25 | { 26 | /// 27 | /// Gets all currently visible local variables and lambda parameters. 28 | /// Does not include method parameters. 29 | /// 30 | IEnumerable LocalVariables { get; } 31 | 32 | /// 33 | /// Gets whether the context is within a lambda expression or anonymous method. 34 | /// 35 | bool IsWithinLambdaExpression { get; } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/TypeSystem/IConstantValue.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Diagnostics.Contracts; 21 | using ICSharpCode.NRefactory.Semantics; 22 | 23 | namespace ICSharpCode.NRefactory.TypeSystem 24 | { 25 | /// 26 | /// Represents an unresolved constant value. 27 | /// 28 | public interface IConstantValue 29 | { 30 | /// 31 | /// Resolves the value of this constant. 32 | /// 33 | /// Context where the constant value will be used. 34 | /// Resolve result representing the constant value. 35 | /// This method never returns null; in case of errors, an ErrorResolveResult will be returned. 36 | ResolveResult Resolve(ITypeResolveContext context); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/TypeSystem/IFreezable.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | 21 | namespace ICSharpCode.NRefactory.TypeSystem 22 | { 23 | public interface IFreezable 24 | { 25 | /// 26 | /// Gets if this instance is frozen. Frozen instances are immutable and thus thread-safe. 27 | /// 28 | bool IsFrozen { get; } 29 | 30 | /// 31 | /// Freezes this instance. 32 | /// 33 | void Freeze(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/TypeSystem/IParameterizedMember.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Diagnostics.Contracts; 22 | 23 | namespace ICSharpCode.NRefactory.TypeSystem 24 | { 25 | /// 26 | /// Represents a method or property. 27 | /// 28 | public interface IUnresolvedParameterizedMember : IUnresolvedMember 29 | { 30 | IList Parameters { get; } 31 | } 32 | 33 | /// 34 | /// Represents a method or property. 35 | /// 36 | public interface IParameterizedMember : IMember 37 | { 38 | IList Parameters { get; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/TypeSystem/ISolutionSnapshot.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | 21 | namespace ICSharpCode.NRefactory.TypeSystem 22 | { 23 | /// 24 | /// Represents a snapshot of the whole solution (multiple compilations). 25 | /// 26 | public interface ISolutionSnapshot 27 | { 28 | /// 29 | /// Gets the project content with the specified file name. 30 | /// Returns null if no such project exists in the solution. 31 | /// 32 | /// 33 | /// This method is used by the class. 34 | /// 35 | IProjectContent GetProjectContent(string projectFileName); 36 | 37 | /// 38 | /// Gets the compilation for the specified project. 39 | /// The project must be a part of the solution (passed to the solution snapshot's constructor). 40 | /// 41 | ICompilation GetCompilation(IProjectContent project); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/TypeSystem/ISupportsInterning.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | 21 | namespace ICSharpCode.NRefactory.TypeSystem 22 | { 23 | /// 24 | /// Interface for TypeSystem objects that support interning. 25 | /// See for more information. 26 | /// 27 | public interface ISupportsInterning 28 | { 29 | /// 30 | /// Gets a hash code for interning. 31 | /// 32 | int GetHashCodeForInterning(); 33 | 34 | /// 35 | /// Equality test for interning. 36 | /// 37 | bool EqualsForInterning(ISupportsInterning other); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/TypeSystem/IVariable.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | 21 | namespace ICSharpCode.NRefactory.TypeSystem 22 | { 23 | /// 24 | /// Represents a variable (name/type pair). 25 | /// 26 | public interface IVariable : ISymbol 27 | { 28 | /// 29 | /// Gets the name of the variable. 30 | /// 31 | new string Name { get; } 32 | 33 | /// 34 | /// Gets the declaration region of the variable. 35 | /// 36 | DomRegion Region { get; } 37 | 38 | /// 39 | /// Gets the type of the variable. 40 | /// 41 | IType Type { get; } 42 | 43 | /// 44 | /// Gets whether this variable is a constant (C#-like const). 45 | /// 46 | bool IsConst { get; } 47 | 48 | /// 49 | /// If this field is a constant, retrieves the value. 50 | /// For parameters, this is the default value. 51 | /// 52 | object ConstantValue { get; } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/TypeSystem/Implementation/FullNameAndTypeParameterCount.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | 22 | namespace ICSharpCode.NRefactory.TypeSystem.Implementation 23 | { 24 | [Obsolete("This struct was renamed to 'TopLevelTypeName'.", true)] 25 | public struct FullNameAndTypeParameterCount 26 | { 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Utils/CallbackOnDispose.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Diagnostics; 21 | using System.Threading; 22 | 23 | namespace ICSharpCode.NRefactory.Utils 24 | { 25 | /// 26 | /// Invokes an action when it is disposed. 27 | /// 28 | /// 29 | /// This class ensures the callback is invoked at most once, 30 | /// even when Dispose is called on multiple threads. 31 | /// 32 | public sealed class CallbackOnDispose : IDisposable 33 | { 34 | Action action; 35 | 36 | public CallbackOnDispose(Action action) 37 | { 38 | if (action == null) 39 | throw new ArgumentNullException("action"); 40 | this.action = action; 41 | } 42 | 43 | public void Dispose() 44 | { 45 | Action a = Interlocked.Exchange(ref action, null); 46 | if (a != null) { 47 | a(); 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Utils/CompositeFormatStringParser/IFormatStringSegment.cs: -------------------------------------------------------------------------------- 1 | // 2 | // IFormatStringSegment.cs 3 | // 4 | // Author: 5 | // Simon Lindgren 6 | // 7 | // Copyright (c) 2012 Simon Lindgren 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System.Collections.Generic; 27 | 28 | namespace ICSharpCode.NRefactory.Utils 29 | { 30 | /// 31 | /// Composite format string parser. 32 | /// 33 | /// 34 | /// Implements a complete parser for valid strings as well as 35 | /// error reporting and best-effort parsing for invalid strings. 36 | /// 37 | public interface IFormatStringSegment 38 | { 39 | int StartLocation { get; set; } 40 | 41 | int EndLocation { get; set; } 42 | 43 | bool HasErrors { get; } 44 | 45 | IEnumerable Errors { get; } 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Utils/ExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | 22 | namespace ICSharpCode.NRefactory.Utils 23 | { 24 | /// 25 | /// Contains extension methods for use within NRefactory. 26 | /// 27 | static class ExtensionMethods 28 | { 29 | public static void AddRange(this ICollection target, IEnumerable input) 30 | { 31 | foreach (T item in input) 32 | target.Add(item); 33 | } 34 | 35 | public static Predicate And(this Predicate filter1, Predicate filter2) 36 | { 37 | if (filter1 == null) 38 | return filter2; 39 | if (filter2 == null) 40 | return filter1; 41 | return m => filter1(m) && filter2(m); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Utils/LazyInit.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Threading; 21 | 22 | namespace ICSharpCode.NRefactory.Utils 23 | { 24 | public static class LazyInit 25 | { 26 | public static T VolatileRead(ref T location) where T : class 27 | { 28 | #if NET_4_5 29 | return Volatile.Read(ref location); 30 | #else 31 | T result = location; 32 | Thread.MemoryBarrier(); 33 | return result; 34 | #endif 35 | } 36 | 37 | /// 38 | /// Atomically performs the following operation: 39 | /// - If target is null: stores newValue in target and returns newValue. 40 | /// - If target is not null: returns target. 41 | /// 42 | public static T GetOrSet(ref T target, T newValue) where T : class 43 | { 44 | T oldValue = Interlocked.CompareExchange(ref target, newValue, null); 45 | return oldValue ?? newValue; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Utils/Platform.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | 21 | namespace ICSharpCode.NRefactory.Utils 22 | { 23 | /// 24 | /// Platform-specific code. 25 | /// 26 | public static class Platform 27 | { 28 | public static StringComparer FileNameComparer { 29 | get { 30 | switch (Environment.OSVersion.Platform) { 31 | case PlatformID.Unix: 32 | case PlatformID.MacOSX: 33 | return StringComparer.Ordinal; 34 | default: 35 | return StringComparer.OrdinalIgnoreCase; 36 | } 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ICSharpCode.NRefactory/Utils/ReferenceComparer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | // software and associated documentation files (the "Software"), to deal in the Software 5 | // without restriction, including without limitation the rights to use, copy, modify, merge, 6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | // to whom the Software is furnished to do so, subject to the following conditions: 8 | // 9 | // The above copyright notice and this permission notice shall be included in all copies or 10 | // substantial portions of the Software. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | // DEALINGS IN THE SOFTWARE. 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using System.Runtime.CompilerServices; 22 | 23 | namespace ICSharpCode.NRefactory.Utils 24 | { 25 | public sealed class ReferenceComparer : IEqualityComparer 26 | { 27 | public readonly static ReferenceComparer Instance = new ReferenceComparer(); 28 | 29 | public new bool Equals(object x, object y) 30 | { 31 | return x == y; 32 | } 33 | 34 | public int GetHashCode(object obj) 35 | { 36 | return RuntimeHelpers.GetHashCode(obj); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /doc/TODO: -------------------------------------------------------------------------------- 1 |  2 | Parser: 3 | - put newlines into the AST 4 | - eliminate the global lock 5 | 6 | Type System: 7 | - Reduce memory usage 8 | - Interface Implementation Map 9 | 10 | Resolver: 11 | - Port all #D resolver unit tests to NR 12 | - Port all MD resolver unit tests to NR 13 | 14 | -------------------------------------------------------------------------------- /doc/copyright.txt: -------------------------------------------------------------------------------- 1 | Copyright 2002-2012 by 2 | 3 | AlphaSierraPapa, Christoph Wille 4 | Vordernberger Strasse 27/8 5 | A-8700 Leoben 6 | Austria 7 | 8 | email: office@alphasierrapapa.com 9 | court of jurisdiction: Landesgericht Leoben 10 | 11 | -------------------------------------------------------------------------------- /doc/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2014 AlphaSierraPapa, Xamarin 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, merge, 6 | publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 7 | to whom the Software is furnished to do so, subject to the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or 10 | substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 13 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 14 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 15 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | DEALINGS IN THE SOFTWARE. 18 | --------------------------------------------------------------------------------