├── NRefactory
├── .gitattributes
├── .gitignore
├── ICSharpCode.NRefactory.snk
├── ICSharpCode.NRefactory.CSharp
│ ├── Parser
│ │ └── mcs
│ │ │ └── visit.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Ast
│ │ └── TokenRole.cs
│ └── Refactoring
│ │ ├── CodeActions
│ │ └── SpecializedCodeAction.cs
│ │ ├── ICodeActionProvider.cs
│ │ ├── CodeIssues
│ │ └── ParameterCanBeDemotedIssue
│ │ │ └── IsArrayTypeCriterion.cs
│ │ └── ContextActionAttribute.cs
├── ICSharpCode.NRefactory.GtkDemo
│ ├── pixbuf
│ │ ├── comment.png
│ │ ├── element-class-16.png
│ │ ├── element-field-16.png
│ │ ├── element-literal-16.png
│ │ ├── element-method-16.png
│ │ └── element-namespace-16.png
│ ├── CSharpDemo.cs
│ ├── gtk-gui
│ │ └── generated.cs
│ └── Main.cs
├── ICSharpCode.NRefactory.ConsistencyCheck
│ ├── app.config
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Readme.txt
├── doc
│ ├── copyright.txt
│ ├── TODO
│ └── license.txt
├── ICSharpCode.NRefactory.VB
│ ├── Ast
│ │ ├── INullable.cs
│ │ ├── Statements
│ │ │ ├── GoToStatement.cs
│ │ │ ├── WhileStatement.cs
│ │ │ ├── DoLoopStatement.cs
│ │ │ ├── WithStatement.cs
│ │ │ ├── SyncLockStatement.cs
│ │ │ ├── UsingStatement.cs
│ │ │ ├── LabelDeclarationStatement.cs
│ │ │ ├── ExpressionStatement.cs
│ │ │ ├── ThrowStatement.cs
│ │ │ ├── LocalDeclarationStatement.cs
│ │ │ ├── ReturnStatement.cs
│ │ │ ├── ForEachStatement.cs
│ │ │ ├── YieldStatement.cs
│ │ │ ├── IfElseStatement.cs
│ │ │ ├── ContinueStatement.cs
│ │ │ ├── AddRemoveHandlerStatement.cs
│ │ │ ├── ExitStatement.cs
│ │ │ └── ForStatement.cs
│ │ ├── Expressions
│ │ │ ├── GetTypeExpression.cs
│ │ │ ├── ParenthesizedExpression.cs
│ │ │ ├── SimpleNameExpression.cs
│ │ │ ├── GetXmlNamespaceExpression.cs
│ │ │ ├── IdentifierExpression.cs
│ │ │ ├── TypeOfIsExpression.cs
│ │ │ ├── TypeReferenceExpression.cs
│ │ │ ├── AnonymousObjectCreationExpression.cs
│ │ │ ├── NamedArgumentExpression.cs
│ │ │ ├── MemberAccessExpression.cs
│ │ │ ├── FieldInitializerExpression.cs
│ │ │ ├── AssignmentExpression.cs
│ │ │ ├── InvocationExpression.cs
│ │ │ ├── VariableInitializer.cs
│ │ │ ├── CollectionRangeVariableDeclaration.cs
│ │ │ └── ConditionalExpression.cs
│ │ ├── General
│ │ │ ├── EventMemberSpecifier.cs
│ │ │ ├── AttributeBlock.cs
│ │ │ ├── ParameterDeclaration.cs
│ │ │ ├── InterfaceMemberSpecifier.cs
│ │ │ └── TypeParameterDeclaration.cs
│ │ ├── GlobalScope
│ │ │ ├── ImportsStatement.cs
│ │ │ ├── EnumMemberDeclaration.cs
│ │ │ └── EnumDeclaration.cs
│ │ ├── TypeMembers
│ │ │ ├── ConstructorDeclaration.cs
│ │ │ └── Accessor.cs
│ │ └── TypeName
│ │ │ └── PrimitiveType.cs
│ ├── Lexer
│ │ ├── Special
│ │ │ ├── CommentType.cs
│ │ │ ├── BlankLine.cs
│ │ │ ├── TagComment.cs
│ │ │ ├── ISpecial.cs
│ │ │ └── Comment.cs
│ │ ├── Extensions.cs
│ │ ├── SavepointEventArgs.cs
│ │ ├── XmlModeInfo.cs
│ │ ├── ExpressionFinderState.cs
│ │ ├── VBLexerMemento.cs
│ │ ├── LATextReader.cs
│ │ └── Block.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── OutputVisitor
│ │ ├── VBFormattingOptions.cs
│ │ └── IOutputFormatter.cs
│ ├── PrettyPrinter
│ │ ├── VBNet
│ │ │ └── VBNetPrettyPrintOptions.cs
│ │ ├── AbstractPrettyPrintOptions.cs
│ │ └── IOutputAstVisitor.cs
│ ├── VBParser.cs
│ └── Parser
│ │ └── Errors.cs
├── ICSharpCode.NRefactory.Tests
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── CSharp
│ │ ├── Inspector
│ │ └── InconsistentNamingIssueTests.cs
│ │ └── Parser
│ │ ├── Expression
│ │ ├── ThisReferenceExpressionTests.cs
│ │ ├── SizeOfExpressionTests.cs
│ │ ├── BaseReferenceExpressionTests.cs
│ │ └── ParenthesizedExpressionTests.cs
│ │ └── Statements
│ │ ├── EmptyStatementTests.cs
│ │ ├── LockStatementTests.cs
│ │ ├── UnsafeStatementTests.cs
│ │ └── SwitchStatementTests.cs
├── ICSharpCode.NRefactory.Demo
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── VBEditDialog.cs
│ └── Program.cs
├── ICSharpCode.NRefactory.Xml
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── SyntaxError.cs
├── ICSharpCode.NRefactory
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── GlobalAssemblyInfo.cs
│ ├── TypeSystem
│ │ ├── EntityType.cs
│ │ ├── IFreezable.cs
│ │ └── IParameterizedMember.cs
│ ├── Completion
│ │ ├── DisplayFlags.cs
│ │ ├── IEntityCompletionData.cs
│ │ └── IVariableCompletionData.cs
│ ├── PatternMatching
│ │ └── BacktrackingInfo.cs
│ ├── Semantics
│ │ └── InitializedObjectResolveResult.cs
│ └── Utils
│ │ ├── Platform.cs
│ │ └── ReferenceComparer.cs
├── ICSharpCode.NRefactory.VB.Tests
│ ├── Parser
│ │ ├── Statements
│ │ │ ├── ThrowStatementTests.cs
│ │ │ ├── BlockStatementTests.cs
│ │ │ ├── LockStatementTests.cs
│ │ │ ├── TryCatchStatementTests.cs
│ │ │ ├── ContinueStatementTests.cs
│ │ │ ├── DoLoopStatementTests.cs
│ │ │ ├── ExpressionStatementTests.cs
│ │ │ ├── StopStatementTests.cs
│ │ │ ├── ResumeStatement.cs
│ │ │ ├── ErrorStatementTests.cs
│ │ │ ├── EraseStatementTests.cs
│ │ │ ├── WithStatementTests.cs
│ │ │ ├── OnErrorStatementTest.cs
│ │ │ ├── AddHandlerStatementTests.cs
│ │ │ ├── GotoStatementTests.cs
│ │ │ ├── RaiseEventStatementTest.cs
│ │ │ ├── RemoveHandlerStatement.cs
│ │ │ ├── ForeachStatementTests.cs
│ │ │ ├── EndStatementTests.cs
│ │ │ ├── LabelStatementTests.cs
│ │ │ ├── ForNextStatementTests.cs
│ │ │ ├── ReturnStatementTests.cs
│ │ │ ├── SwitchStatementTests.cs
│ │ │ └── UsingStatementTests.cs
│ │ ├── SnippetParserTests.cs
│ │ ├── Expressions
│ │ │ ├── PrimitiveExpressionTests.cs
│ │ │ ├── ThisReferenceExpressionTests.cs
│ │ │ ├── BaseReferenceExpressionTests.cs
│ │ │ ├── ClassReferenceExpressionTests.cs
│ │ │ ├── ParenthesizedExpressionTest.cs
│ │ │ ├── ConditionalExpressionTests.cs
│ │ │ ├── GlobalReferenceExpressionTests.cs
│ │ │ ├── TypeOfIsExpressionTests.cs
│ │ │ ├── ArrayCreateExpressionTests.cs
│ │ │ └── IdentifierExpressionTests.cs
│ │ ├── TypeLevel
│ │ │ ├── EventDeclarationTests.cs
│ │ │ ├── OperatorDeclarationTests.cs
│ │ │ ├── DeclareDeclarationTests.cs
│ │ │ ├── ConstructorDeclarationTests.cs
│ │ │ └── CustomEventTests.cs
│ │ └── GlobalScope
│ │ │ └── NamespaceDeclarationTests.cs
│ ├── Lexer
│ │ ├── TokenTests.cs
│ │ └── LATextReaderTests.cs
│ ├── Output
│ │ └── CodeDOM
│ │ │ ├── CodeDOMParenthesizedExpressionTest.cs
│ │ │ ├── CodeDOMPrimitiveExpressionTest.cs
│ │ │ └── CodeDOMTypeReferenceTest.cs
│ └── AssemblyInfo.cs
└── ICSharpCode.NRefactory.CSharp.AstVerifier
│ └── AssemblyInfo.cs
├── .gitmodules
├── .gitattributes
├── ICSharpCode.Decompiler
├── Tests
│ ├── packages.config
│ ├── IL
│ │ ├── StackTests.exe
│ │ ├── SequenceOfNestedIfs.dll
│ │ └── SequenceOfNestedIfs.Output.cs
│ ├── nunit.framework.dll
│ ├── Types
│ │ ├── S_TypeDeclarations.cs
│ │ ├── EnumTests.cs
│ │ └── TypeTests.cs
│ ├── CustomAttributes
│ │ ├── S_AssemblyCustomAttribute.cs
│ │ └── CustomAttributeTests.cs
│ ├── CustomAttributes.code.cs
│ ├── Helpers
│ │ └── RemoveCompilerAttribute.cs
│ ├── Lock.cs
│ ├── DoubleConstants.cs
│ └── BooleanConsumedAsInteger.il
├── Ast
│ └── Transforms
│ │ └── FlattenSwitchBlocks.cs
└── Properties
│ └── AssemblyInfo.template.cs
├── BuildTools
├── MSBuildCommunityTasks
│ ├── ICSharpCode.SharpZipLib.dll
│ └── MSBuild.Community.Tasks.dll
├── buildAndCreatePackage.bat
└── UpdateAssemblyInfo
│ └── UpdateAssemblyInfo.sln
├── .gitignore
└── README.md
/NRefactory/.gitattributes:
--------------------------------------------------------------------------------
1 | *.sln -crlf
2 | *.csproj -crlf
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "dnlib"]
2 | path = dnlib
3 | url = https://github.com/yck1509/dnlib.git
4 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.cs text diff=csharp
3 | *.sln text eol=crlf
4 | *.csproj text eol=crlf
5 |
--------------------------------------------------------------------------------
/NRefactory/.gitignore:
--------------------------------------------------------------------------------
1 | bin
2 | obj
3 | /lib/*.dll
4 | /ICSharpCode.NRefactory.Tests/PartCover/*
5 | _ReSharper*/*
6 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yck1509/ICSharpCode.Decompiler-retired/master/NRefactory/ICSharpCode.NRefactory.snk
--------------------------------------------------------------------------------
/ICSharpCode.Decompiler/Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ICSharpCode.Decompiler/Tests/IL/StackTests.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yck1509/ICSharpCode.Decompiler-retired/master/ICSharpCode.Decompiler/Tests/IL/StackTests.exe
--------------------------------------------------------------------------------
/ICSharpCode.Decompiler/Tests/nunit.framework.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yck1509/ICSharpCode.Decompiler-retired/master/ICSharpCode.Decompiler/Tests/nunit.framework.dll
--------------------------------------------------------------------------------
/ICSharpCode.Decompiler/Tests/IL/SequenceOfNestedIfs.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yck1509/ICSharpCode.Decompiler-retired/master/ICSharpCode.Decompiler/Tests/IL/SequenceOfNestedIfs.dll
--------------------------------------------------------------------------------
/BuildTools/MSBuildCommunityTasks/ICSharpCode.SharpZipLib.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yck1509/ICSharpCode.Decompiler-retired/master/BuildTools/MSBuildCommunityTasks/ICSharpCode.SharpZipLib.dll
--------------------------------------------------------------------------------
/BuildTools/MSBuildCommunityTasks/MSBuild.Community.Tasks.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yck1509/ICSharpCode.Decompiler-retired/master/BuildTools/MSBuildCommunityTasks/MSBuild.Community.Tasks.dll
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/visit.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yck1509/ICSharpCode.Decompiler-retired/master/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/visit.cs
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.GtkDemo/pixbuf/comment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yck1509/ICSharpCode.Decompiler-retired/master/NRefactory/ICSharpCode.NRefactory.GtkDemo/pixbuf/comment.png
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-class-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yck1509/ICSharpCode.Decompiler-retired/master/NRefactory/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-class-16.png
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-field-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yck1509/ICSharpCode.Decompiler-retired/master/NRefactory/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-field-16.png
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-literal-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yck1509/ICSharpCode.Decompiler-retired/master/NRefactory/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-literal-16.png
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-method-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yck1509/ICSharpCode.Decompiler-retired/master/NRefactory/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-method-16.png
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-namespace-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yck1509/ICSharpCode.Decompiler-retired/master/NRefactory/ICSharpCode.NRefactory.GtkDemo/pixbuf/element-namespace-16.png
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/NRefactory/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 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | bin/
2 | obj/
3 |
4 | /ICSharpCode.Decompiler/Properties/AssemblyInfo.cs
5 | /ILSpy/Properties/AssemblyInfo.cs
6 | /ILSpy/app.config
7 | *.suo
8 | *.user
9 | /Resharper-ILSpy-Style.xml
10 | _ReSharper*/
11 | *.ReSharper
12 | *.patch
13 | /packages
14 | *.ide/
15 |
--------------------------------------------------------------------------------
/ICSharpCode.Decompiler/Tests/Types/S_TypeDeclarations.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ClassMultiInterface
4 | {
5 | public interface IA
6 | {
7 | }
8 | public interface IA2 : IA
9 | {
10 | }
11 | public interface IB
12 | {
13 | }
14 | public class C : IA2, IB
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ICSharpCode.Decompiler/Tests/CustomAttributes/S_AssemblyCustomAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 |
6 | [assembly: CLSCompliant(false)]
7 |
--------------------------------------------------------------------------------
/BuildTools/buildAndCreatePackage.bat:
--------------------------------------------------------------------------------
1 | @echo This script simulates what the build server is doing
2 | @rem /p:AdditionalBuildProperties="/v:d /p:MSBuildTargetsVerbose=true"
3 | %windir%\microsoft.net\framework\v4.0.30319\msbuild Automated.proj /p:ArtefactsOutputDir="%CD%\build" /p:TestReportsDir="%CD%\build"
4 | @IF %ERRORLEVEL% NEQ 0 GOTO err
5 | @exit /B 0
6 | :err
7 | @PAUSE
8 | @exit /B 1
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/INullable.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | namespace ICSharpCode.NRefactory.VB.Ast
5 | {
6 | public interface INullable
7 | {
8 | bool IsNull {
9 | get;
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/ICSharpCode.Decompiler/Tests/Types/EnumTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using NUnit.Framework;
6 |
7 | namespace ICSharpCode.Decompiler.Tests.Types
8 | {
9 | [TestFixture]
10 | public class EnumTests : DecompilerTestBase
11 | {
12 | [Test]
13 | public void EnumSamples()
14 | {
15 | ValidateFileRoundtrip(@"Types\S_EnumSamples.cs");
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/NRefactory/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 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Lexer/Special/CommentType.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 |
6 | namespace ICSharpCode.NRefactory.VB
7 | {
8 | // public enum CommentType
9 | // {
10 | // Block,
11 | // SingleLine,
12 | // Documentation
13 | // }
14 | }
15 |
--------------------------------------------------------------------------------
/ICSharpCode.Decompiler/Tests/Types/TypeTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using NUnit.Framework;
6 |
7 | namespace ICSharpCode.Decompiler.Tests.Types
8 | {
9 | [TestFixture]
10 | public class TypeTests : DecompilerTestBase
11 | {
12 | [Test]
13 | public void TypeMemberDeclarations()
14 | {
15 | ValidateFileRoundtrip(@"Types\S_TypeMemberDeclarations.cs");
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/NRefactory/doc/TODO:
--------------------------------------------------------------------------------
1 |
2 | Parser:
3 | - put newlines into the AST
4 | - add API to report errors
5 | - allow multithreaded parsing
6 |
7 | Type System:
8 | - Reduce memory usage
9 | - Interface Implementation Map
10 |
11 | Resolver:
12 | - Port all #D resolver unit tests to NR
13 | - Port all MD resolver unit tests to NR
14 |
15 | Features:
16 | - Code Completion
17 | - Extract Method refactoring
18 |
19 | For integration into SharpDevelop:
20 | - Review NR and DOM changes done in the timeframe
21 |
22 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/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.VB")]
13 | [assembly: AssemblyDescription("VB syntax tree")]
14 |
--------------------------------------------------------------------------------
/NRefactory/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 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.CSharp/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.CSharp")]
13 | [assembly: AssemblyDescription("C# parser and semantic analysis")]
14 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/OutputVisitor/VBFormattingOptions.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 |
6 | namespace ICSharpCode.NRefactory.VB
7 | {
8 | ///
9 | /// Description of VBFormattingOptions.
10 | ///
11 | public class VBFormattingOptions
12 | {
13 | public VBFormattingOptions()
14 | {
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/NRefactory/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 |
--------------------------------------------------------------------------------
/NRefactory/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 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/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.ConsistencyCheck")]
13 | [assembly: AssemblyDescription("Loads a solution and performs various self-tests using the parsed code.")]
14 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory/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")]
13 | [assembly: AssemblyDescription("Type system and other language-independent parts of NRefactory")]
14 |
15 | [assembly: CLSCompliant(true)]
16 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ThrowStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class ThrowStatementTests
14 | {
15 | // TODO : ThrowStatementTests
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/BlockStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class BlockStatementTests
14 | {
15 | // TODO create BlockStatementTests
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/LockStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class LockStatementTests
14 | {
15 | // TODO : write some tests on SyncLock
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/TryCatchStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class TryCatchStatementTests
14 | {
15 | // TODO : TryCatchStatementTests
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ContinueStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class ContinueStatementTests
14 | {
15 | // TODO : add ContinueStatementTests
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/DoLoopStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class DoLoopStatementTests
14 | {
15 | // TODO write some DoLoopStatement tests
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ExpressionStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class ExpressionStatementTests
14 | {
15 | // TODO : Create ExpressionStatementTests
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Lexer/Special/BlankLine.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 |
6 | namespace ICSharpCode.NRefactory.VB
7 | {
8 | // public class BlankLine : AbstractSpecial
9 | // {
10 | // public BlankLine(Location point) : base(point)
11 | // {
12 | // }
13 | //
14 | // public override object AcceptVisitor(ISpecialVisitor visitor, object data)
15 | // {
16 | // return visitor.Visit(this, data);
17 | // }
18 | // }
19 | }
20 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Lexer/TokenTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using ICSharpCode.NRefactory.VB.Parser;
6 | using NUnit.Framework;
7 |
8 | namespace ICSharpCode.NRefactory.VB.Tests.Lexer
9 | {
10 | [TestFixture]
11 | public class TokenTests
12 | {
13 | [Test]
14 | public void TokenToStringDoesNotThrowException()
15 | {
16 | Assert.DoesNotThrow(
17 | () => {
18 | string text = new Token(71, 1, 1).ToString();
19 | }
20 | );
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Lexer/Extensions.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 |
9 | namespace ICSharpCode.NRefactory.VB.Parser
10 | {
11 | public static class Extensions
12 | {
13 | public static bool IsElement(this IEnumerable items, Func check)
14 | {
15 | T item = items.FirstOrDefault();
16 |
17 | if (item != null)
18 | return check(item);
19 | return false;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/PrettyPrinter/VBNet/VBNetPrettyPrintOptions.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 |
6 | namespace ICSharpCode.NRefactory.VB.PrettyPrinter
7 | {
8 | ///
9 | /// Description of VBNetPrettyPrintOptions.
10 | ///
11 | public class VBNetPrettyPrintOptions : AbstractPrettyPrintOptions
12 | {
13 | ///
14 | /// Gets/Sets if the optional "ByVal" modifier should be written.
15 | ///
16 | public bool OutputByValModifier { get; set; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/NRefactory/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 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Lexer/SavepointEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.Collections.Generic;
6 |
7 | namespace ICSharpCode.NRefactory.VB.Parser
8 | {
9 | public class SavepointEventArgs : EventArgs
10 | {
11 | public TextLocation SavepointLocation { get; private set; }
12 | public VBLexerMemento State { get; private set; }
13 |
14 | public SavepointEventArgs(TextLocation savepointLocation, VBLexerMemento state)
15 | {
16 | this.SavepointLocation = savepointLocation;
17 | this.State = state;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/StopStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class StopStatementTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetStopStatementTest()
18 | {
19 | StopStatement stopStatement = ParseUtil.ParseStatement("Stop");
20 | }
21 | #endregion
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ResumeStatement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class ResumeStatementTests
14 | {
15 | [Test]
16 | public void ResumeStatementTest()
17 | {
18 | ResumeStatement resumeStatement = ParseUtil.ParseStatement("Resume");
19 | }
20 |
21 | // TODO : write some more
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ErrorStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class ErrorStatementTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetErrorStatementTest()
18 | {
19 | ErrorStatement errorStatement = ParseUtil.ParseStatement("Error a");
20 | }
21 | #endregion
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/EraseStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class EraseStatementTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetEraseStatementTest()
18 | {
19 | EraseStatement eraseStatement = ParseUtil.ParseStatement("Erase a, b, c");
20 | }
21 | #endregion
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/WithStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class WithStatementTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetWithStatementTest()
18 | {
19 | WithStatement withStatement = ParseUtil.ParseStatement("With MyObj : End With");
20 | }
21 | #endregion
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/SnippetParserTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using ICSharpCode.NRefactory.VB.Ast;
5 | using System;
6 | using NUnit.Framework;
7 |
8 | namespace ICSharpCode.NRefactory.VB.Tests
9 | {
10 | [TestFixture]
11 | public class SnippetParserTests
12 | {
13 | // [Test]
14 | // public void InvalidExpressionSyntax()
15 | // {
16 | // // SD2-1584: ensure we don't crash on this invalid VB code
17 | // SnippetParser parser = new SnippetParser();
18 | // INode node = parser.Parse("i == 5");
19 | // Assert.IsTrue(parser.Errors.Count > 0);
20 | // }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/PrimitiveExpressionTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class PrimitiveExpressionTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void PrimitiveExpression1Test()
18 | {
19 | InvocationExpression ie = ParseUtil.ParseExpression("546.ToString()");
20 | }
21 | #endregion
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/OnErrorStatementTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class OnErrorStatementTest
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetOnErrorStatementTest()
18 | {
19 | OnErrorStatement onErrorStatement = ParseUtil.ParseStatement("On Error Goto err");
20 | }
21 | #endregion
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ThisReferenceExpressionTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class ThisReferenceExpressionTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetThisReferenceExpressionTest1()
18 | {
19 | ThisReferenceExpression ie = ParseUtil.ParseExpression("Me");
20 | }
21 | #endregion
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/TokenRole.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ICSharpCode.NRefactory.CSharp
4 | {
5 | ///
6 | /// A specific role only used for C# tokens
7 | ///
8 | public sealed class TokenRole : Role
9 | {
10 | ///
11 | /// Gets the token as string. Note that the token Name and Token value may differ.
12 | ///
13 | public string Token {
14 | get;
15 | private set;
16 | }
17 |
18 | ///
19 | /// Gets the char length of the token.
20 | ///
21 | public int Length {
22 | get;
23 | private set;
24 | }
25 |
26 | public TokenRole (string token) : base (token, CSharpTokenNode.Null)
27 | {
28 | this.Token = token;
29 | this.Length = token.Length;
30 | }
31 | }
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/AddHandlerStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class AddHandlerStatementTests
14 | {
15 | [Test]
16 | public void AddHandlerTest()
17 | {
18 | AddHandlerStatement addHandlerStatement = ParseUtil.ParseStatement("AddHandler Obj.Ev_Event, AddressOf EventHandler");
19 | // TODO : extend tests
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/GotoStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class GotoStatementTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetGotoStatementTest()
18 | {
19 | GotoStatement gotoStmt = ParseUtil.ParseStatement("GoTo myLabel");
20 | Assert.AreEqual("myLabel", gotoStmt.Label);
21 | }
22 | #endregion
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/RaiseEventStatementTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class RaiseEventStatementTest
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetRaiseEventStatementTest()
18 | {
19 | RaiseEventStatement raiseEventStatement = ParseUtil.ParseStatement("RaiseEvent MyEvent(a, 5, (6))");
20 | }
21 | #endregion
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ICSharpCode.Decompiler/Tests/CustomAttributes/CustomAttributeTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using NUnit.Framework;
6 |
7 | namespace ICSharpCode.Decompiler.Tests.CustomAttributes
8 | {
9 | [TestFixture]
10 | public class CustomAttributeTests : DecompilerTestBase
11 | {
12 | [Test]
13 | public void CustomAttributeSamples()
14 | {
15 | ValidateFileRoundtrip(@"CustomAttributes\S_CustomAttributeSamples.cs");
16 | }
17 |
18 | [Test]
19 | public void CustomAttributesMultiTest()
20 | {
21 | ValidateFileRoundtrip(@"CustomAttributes\S_CustomAttributes.cs");
22 | }
23 |
24 | [Test]
25 | public void AssemblyCustomAttributesMultiTest()
26 | {
27 | ValidateFileRoundtrip(@"CustomAttributes\S_AssemblyCustomAttribute.cs");
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/RemoveHandlerStatement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class RemoveHandlerStatementTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetRemoveHandlerTest()
18 | {
19 | RemoveHandlerStatement removeHandlerStatement = ParseUtil.ParseStatement("RemoveHandler MyHandler, AddressOf MyMethod");
20 | }
21 | #endregion
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ForeachStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class ForeachStatementTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetForeachStatementTest()
18 | {
19 | ForeachStatement foreachStmt = ParseUtil.ParseStatement("For Each i As Integer In myColl : Next");
20 | // TODO : Extend test.
21 | }
22 | #endregion
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/CodeDOMParenthesizedExpressionTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.CodeDom;
6 | using ICSharpCode.NRefactory.VB.Ast;
7 | using ICSharpCode.NRefactory.VB.Visitors;
8 | using NUnit.Framework;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Output.CodeDom.Tests
11 | {
12 | [TestFixture]
13 | public class CodeDOMParenthesizedExpressionTest
14 | {
15 | [Test]
16 | public void TestParenthesizedExpression()
17 | {
18 | object output = new ParenthesizedExpression(new PrimitiveExpression(5, "5")).AcceptVisitor(new CodeDomVisitor(), null);
19 | Assert.IsTrue(output is CodePrimitiveExpression);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/ICSharpCode.Decompiler/Ast/Transforms/FlattenSwitchBlocks.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using ICSharpCode.NRefactory.CSharp;
6 |
7 | namespace ICSharpCode.Decompiler.Ast.Transforms
8 | {
9 | class FlattenSwitchBlocks : IAstTransform
10 | {
11 | public void Run(AstNode compilationUnit)
12 | {
13 | foreach (var switchSection in compilationUnit.Descendants.OfType())
14 | {
15 | if (switchSection.Statements.Count != 1)
16 | continue;
17 |
18 | var blockStatement = switchSection.Statements.First() as BlockStatement;
19 | if (blockStatement == null || blockStatement.Statements.Any(st => st is VariableDeclarationStatement))
20 | continue;
21 |
22 | blockStatement.Remove();
23 | blockStatement.Statements.MoveTo(switchSection.Statements);
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/BaseReferenceExpressionTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class BaseReferenceExpressionTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetBaseReferenceExpressionTest1()
18 | {
19 | MemberReferenceExpression fre = ParseUtil.ParseExpression("MyBase.myField");
20 | Assert.IsTrue(fre.TargetObject is BaseReferenceExpression);
21 | }
22 | #endregion
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ClassReferenceExpressionTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class ClassReferenceExpressionTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetClassReferenceExpressionTest1()
18 | {
19 | MemberReferenceExpression fre = ParseUtil.ParseExpression("MyClass.myField");
20 | Assert.IsTrue(fre.TargetObject is ClassReferenceExpression);
21 | }
22 | #endregion
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Lexer/XmlModeInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 |
6 | namespace ICSharpCode.NRefactory.VB.Parser
7 | {
8 | public class XmlModeInfo : ICloneable
9 | {
10 | public bool inXmlTag, inXmlCloseTag, isDocumentStart;
11 | public int level;
12 |
13 | public XmlModeInfo(bool isSpecial)
14 | {
15 | level = isSpecial ? -1 : 0;
16 | inXmlTag = inXmlCloseTag = isDocumentStart = false;
17 | }
18 |
19 | public object Clone()
20 | {
21 | return new XmlModeInfo(false) {
22 | inXmlCloseTag = this.inXmlCloseTag,
23 | inXmlTag = this.inXmlTag,
24 | isDocumentStart = this.isDocumentStart,
25 | level = this.level
26 | };
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/CodeDOMPrimitiveExpressionTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.CodeDom;
6 | using ICSharpCode.NRefactory.VB.Ast;
7 | using ICSharpCode.NRefactory.VB.Visitors;
8 | using NUnit.Framework;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Output.CodeDom.Tests
11 | {
12 | [TestFixture]
13 | public class CodeDOMPrimitiveExpressionsTests
14 | {
15 | [Test]
16 | public void TestPrimitiveExpression()
17 | {
18 | object output = new PrimitiveExpression(5, "5").AcceptVisitor(new CodeDomVisitor(), null);
19 | Assert.IsTrue(output is CodePrimitiveExpression);
20 | Assert.AreEqual(((CodePrimitiveExpression)output).Value, 5);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/EventDeclarationTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using ICSharpCode.NRefactory.VB.Ast;
6 | using NUnit.Framework;
7 |
8 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
9 | {
10 | [TestFixture]
11 | public class EventDeclarationTests
12 | {
13 | #region VB.NET
14 | [Test]
15 | public void VBNetSimpleEventDeclarationTest()
16 | {
17 | EventDeclaration ed = ParseUtil.ParseTypeMember("event MyEvent(x as Integer)");
18 | Assert.AreEqual(1, ed.Parameters.Count);
19 | Assert.AreEqual("MyEvent", ed.Name);
20 | Assert.IsFalse(ed.HasAddRegion);
21 | Assert.IsFalse(ed.HasRemoveRegion);
22 | }
23 | #endregion
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Lexer/Special/TagComment.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 |
6 | namespace ICSharpCode.NRefactory.VB.Parser
7 | {
8 | ///
9 | /// Description of TagComment.
10 | ///
11 | // public class TagComment : Comment
12 | // {
13 | // string tag;
14 | //
15 | // public string Tag {
16 | // get {
17 | // return tag;
18 | // }
19 | // set {
20 | // tag = value;
21 | // }
22 | // }
23 | //
24 | // public TagComment(string tag, string comment, bool commentStartsLine, Location startPosition, Location endPosition) : base(CommentType.SingleLine, comment, commentStartsLine, startPosition, endPosition)
25 | // {
26 | // this.tag = tag;
27 | // }
28 | // }
29 | }
30 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Lexer/ExpressionFinderState.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 |
9 | namespace ICSharpCode.NRefactory.VB.Parser
10 | {
11 | public class ExpressionFinderState
12 | {
13 | public bool WasQualifierTokenAtStart { get; set; }
14 | public bool NextTokenIsPotentialStartOfExpression { get; set; }
15 | public bool ReadXmlIdentifier { get; set; }
16 | public bool IdentifierExpected { get; set; }
17 | public bool NextTokenIsStartOfImportsOrAccessExpression { get; set; }
18 | public Stack StateStack { get; set; }
19 | public Stack BlockStack { get; set; }
20 | public int CurrentState { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Lexer/VBLexerMemento.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.Collections.Generic;
6 |
7 | namespace ICSharpCode.NRefactory.VB.Parser
8 | {
9 | public sealed class VBLexerMemento
10 | {
11 | public int Line { get; set; }
12 | public int Column { get; set; }
13 | public int PrevTokenKind { get; set; }
14 | public bool LineEnd { get; set; }
15 | public bool IsAtLineBegin { get; set; }
16 | public bool MisreadExclamationMarkAsTypeCharacter { get; set; }
17 | public bool EncounteredLineContinuation { get; set; }
18 | public ExpressionFinderState ExpressionFinder { get; set; }
19 | public Stack XmlModeInfoStack { get; set; }
20 | public bool InXmlMode { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/EndStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class EndStatementTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetEndStatementTest()
18 | {
19 | EndStatement endStatement = ParseUtil.ParseStatement("End");
20 | }
21 |
22 | [Test]
23 | public void VBNetEndStatementInIfThenTest2()
24 | {
25 | IfElseStatement endStatement = ParseUtil.ParseStatement("IF a THEN End");
26 | }
27 | #endregion
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/BuildTools/UpdateAssemblyInfo/UpdateAssemblyInfo.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | # SharpDevelop 4.0.1.7088
5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateAssemblyInfo", "UpdateAssemblyInfo.csproj", "{605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}"
6 | EndProject
7 | Global
8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
9 | Debug|Any CPU = Debug|Any CPU
10 | Release|Any CPU = Release|Any CPU
11 | EndGlobalSection
12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
13 | {605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}.Release|Any CPU.Build.0 = Release|Any CPU
16 | {605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | EndGlobalSection
18 | EndGlobal
19 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ParenthesizedExpressionTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class ParenthesizedExpressionTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetPrimitiveParenthesizedExpression()
18 | {
19 | ParenthesizedExpression p = ParseUtil.ParseExpression("((1))");
20 | Assert.IsTrue(p.Expression is ParenthesizedExpression);
21 | p = p.Expression as ParenthesizedExpression;;
22 | Assert.IsTrue(p.Expression is PrimitiveExpression);
23 | }
24 | #endregion
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/LabelStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class LabelStatementTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetLabelStatementTest()
18 | {
19 | MethodDeclaration method = ParseUtil.ParseTypeMember("Sub Test \n myLabel: Console.WriteLine() \n End Sub");
20 | Assert.AreEqual(2, method.Body.Children.Count);
21 | LabelStatement labelStmt = (LabelStatement)method.Body.Children[0];
22 | Assert.AreEqual("myLabel", labelStmt.Label);
23 | }
24 | #endregion
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Statements/GoToStatement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 |
7 | namespace ICSharpCode.NRefactory.VB.Ast
8 | {
9 | public class GoToStatement : Statement
10 | {
11 | /// either PrimitiveExpression or IdentifierExpression
12 | public Expression Label {
13 | get { return GetChildByRole(Roles.Expression); }
14 | set { SetChildByRole(Roles.Expression, value); }
15 | }
16 |
17 | protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
18 | {
19 | throw new NotImplementedException();
20 | }
21 |
22 | public override S AcceptVisitor(IAstVisitor visitor, T data)
23 | {
24 | return visitor.VisitGoToStatement(this, data);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/GetTypeExpression.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 |
6 | namespace ICSharpCode.NRefactory.VB.Ast
7 | {
8 | public class GetTypeExpression : Expression
9 | {
10 | public GetTypeExpression()
11 | {
12 | }
13 |
14 | public AstType Type {
15 | get { return GetChildByRole(Roles.Type); }
16 | set { SetChildByRole(Roles.Type, value); }
17 | }
18 |
19 | protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
20 | {
21 | var expr = other as GetTypeExpression;
22 | return expr != null &&
23 | Type.DoMatch(expr.Type, match);
24 | }
25 |
26 | public override S AcceptVisitor(IAstVisitor visitor, T data)
27 | {
28 | return visitor.VisitGetTypeExpression(this, data);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/PrettyPrinter/AbstractPrettyPrintOptions.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | namespace ICSharpCode.NRefactory.VB.PrettyPrinter
5 | {
6 | ///
7 | /// Description of PrettyPrintOptions.
8 | ///
9 | public class AbstractPrettyPrintOptions
10 | {
11 | char indentationChar = '\t';
12 | int tabSize = 4;
13 | int indentSize = 4;
14 |
15 | public char IndentationChar {
16 | get {
17 | return indentationChar;
18 | }
19 | set {
20 | indentationChar = value;
21 | }
22 | }
23 |
24 | public int TabSize {
25 | get {
26 | return tabSize;
27 | }
28 | set {
29 | tabSize = value;
30 | }
31 | }
32 |
33 | public int IndentSize {
34 | get {
35 | return indentSize;
36 | }
37 | set {
38 | indentSize = value;
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ConditionalExpressionTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class ConditionalExpressionTests
14 | {
15 | #region VB.NET
16 |
17 | [Test]
18 | public void VBNetConditionalExpressionTest()
19 | {
20 | ConditionalExpression ce = ParseUtil.ParseExpression("If(x IsNot Nothing, x.Test, \"nothing\")");
21 |
22 | Assert.IsTrue(ce.Condition is BinaryOperatorExpression);
23 | Assert.IsTrue(ce.TrueExpression is MemberReferenceExpression);
24 | Assert.IsTrue(ce.FalseExpression is PrimitiveExpression);
25 | }
26 |
27 | #endregion
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ForNextStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class ForNextStatementTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetForNextStatementTest()
18 | {
19 | ForNextStatement forNextStatement = ParseUtil.ParseStatement("For i=0 To 10 Step 2 : Next i");
20 | }
21 |
22 | [Test]
23 | public void VBNetForNextStatementWithComplexExpressionTest()
24 | {
25 | ForNextStatement forNextStatement = ParseUtil.ParseStatement("For SomeMethod().Property = 0 To 10 : Next SomeMethod().Property");
26 | }
27 | #endregion
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Statements/WhileStatement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 |
7 | namespace ICSharpCode.NRefactory.VB.Ast
8 | {
9 | public class WhileStatement : Statement
10 | {
11 | public Expression Condition {
12 | get { return GetChildByRole(Roles.Expression); }
13 | set { SetChildByRole(Roles.Expression, value); }
14 | }
15 |
16 | public BlockStatement Body {
17 | get { return GetChildByRole(Roles.Body); }
18 | set { SetChildByRole(Roles.Body, value); }
19 | }
20 |
21 | protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
22 | {
23 | throw new NotImplementedException();
24 | }
25 |
26 | public override S AcceptVisitor(IAstVisitor visitor, T data)
27 | {
28 | return visitor.VisitWhileStatement(this, data);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/ICSharpCode.Decompiler/Tests/IL/SequenceOfNestedIfs.Output.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | [Serializable]
3 | public class Material
4 | {
5 | public static implicit operator bool(Material m)
6 | {
7 | return m == null;
8 | }
9 | }
10 | [Serializable]
11 | public class SequenceOfNestedIfs
12 | {
13 | public bool _clear;
14 | public Material _material;
15 | public override bool CheckShader()
16 | {
17 | return false;
18 | }
19 | public override void CreateMaterials()
20 | {
21 | if (!this._clear)
22 | {
23 | if (!this.CheckShader())
24 | {
25 | return;
26 | }
27 | this._material = new Material();
28 | }
29 | if (!this._material)
30 | {
31 | if (!this.CheckShader())
32 | {
33 | return;
34 | }
35 | this._material = new Material();
36 | }
37 | if (!this._material)
38 | {
39 | if (!this.CheckShader())
40 | {
41 | return;
42 | }
43 | this._material = new Material();
44 | }
45 | if (!this._material)
46 | {
47 | if (this.CheckShader())
48 | {
49 | this._material = new Material();
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/OperatorDeclarationTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using ICSharpCode.NRefactory.VB.Ast;
6 | using NUnit.Framework;
7 |
8 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
9 | {
10 | [TestFixture]
11 | public class OperatorDeclarationTests
12 | {
13 | #region VB.NET
14 |
15 | [Test]
16 | public void VBNetImplictOperatorDeclarationTest()
17 | {
18 | string programm = @"Public Shared Operator + (ByVal v As Complex) As Complex
19 | Return v
20 | End Operator";
21 |
22 | OperatorDeclaration od = ParseUtil.ParseTypeMember(programm);
23 | Assert.IsFalse(od.IsConversionOperator);
24 | Assert.AreEqual(1, od.Parameters.Count);
25 | Assert.AreEqual(ConversionType.None, od.ConversionType);
26 | Assert.AreEqual("Complex", od.TypeReference.Type);
27 | }
28 | #endregion
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Lexer/LATextReaderTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using ICSharpCode.NRefactory.VB.Parser;
7 | using NUnit.Framework;
8 |
9 | namespace ICSharpCode.NRefactory.VB.Tests.Lexer
10 | {
11 | [TestFixture]
12 | public class LATextReaderTests
13 | {
14 | [Test]
15 | public void TestPeek()
16 | {
17 | LATextReader reader = new LATextReader(new StringReader("abcd"));
18 |
19 | CheckPeek(reader, 0, 'a');
20 | CheckPeek(reader, 2, 'c');
21 | CheckPeek(reader, 3, 'd');
22 | CheckPeek(reader, 1, 'b');
23 | CheckPeek(reader, 0, 'a');
24 | Assert.AreEqual((int)'a', reader.Read());
25 | CheckPeek(reader, 1, 'c');
26 | CheckPeek(reader, 2, 'd');
27 | CheckPeek(reader, 0, 'b');
28 | }
29 |
30 | void CheckPeek(LATextReader reader, int num1, char char2)
31 | {
32 | Assert.AreEqual((int)char2, reader.Peek(num1));
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory/Properties/GlobalAssemblyInfo.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: AssemblyCompany("ICSharpCode")]
13 | [assembly: AssemblyProduct("SharpDevelop/MonoDevelop")]
14 | [assembly: AssemblyCopyright("Copyright 2010-2012 AlphaSierraPapa")]
15 |
16 | // This sets the default COM visibility of types in the assembly to invisible.
17 | // If you need to expose a type to COM, use [ComVisible(true)] on that type.
18 | [assembly: ComVisible(false)]
19 |
20 | // We keep the AssemblyVersion at 5.0.0.0 for all versions of NRefactory 5.
21 | // This eliminates the need for binding redirects.
22 | [assembly: AssemblyVersion("5.0.0.0")]
23 |
24 | // [AssemblyFileVersion] is the version of the NuGet package,
25 | // should follow http://semver.org/ rules
26 | [assembly: AssemblyFileVersion("5.2.0")]
27 |
--------------------------------------------------------------------------------
/NRefactory/doc/license.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010-2012 AlphaSierraPapa
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 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Statements/DoLoopStatement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 |
7 | namespace ICSharpCode.NRefactory.VB.Ast
8 | {
9 | public class DoLoopStatement : Statement
10 | {
11 | public ConditionType ConditionType { get; set; }
12 |
13 | public Expression Expression {
14 | get { return GetChildByRole(Roles.Expression); }
15 | set { SetChildByRole(Roles.Expression, value); }
16 | }
17 |
18 | public BlockStatement Body {
19 | get { return GetChildByRole(Roles.Body); }
20 | set { SetChildByRole(Roles.Body, value); }
21 | }
22 |
23 | protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
24 | {
25 | throw new NotImplementedException();
26 | }
27 |
28 | public override S AcceptVisitor(IAstVisitor visitor, T data)
29 | {
30 | return visitor.VisitDoLoopStatement(this, data);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ReturnStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class ReturnStatementTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetEmptyReturnStatementTest()
18 | {
19 | ReturnStatement returnStatement = ParseUtil.ParseStatement("Return");
20 | Assert.IsTrue(returnStatement.Expression.IsNull);
21 | }
22 |
23 | [Test]
24 | public void VBNetReturnStatementTest()
25 | {
26 | ReturnStatement returnStatement = ParseUtil.ParseStatement("Return 5");
27 | Assert.IsFalse(returnStatement.Expression.IsNull);
28 | Assert.IsTrue(returnStatement.Expression is PrimitiveExpression);
29 | }
30 | #endregion
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/DeclareDeclarationTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using ICSharpCode.NRefactory.VB.Ast;
6 | using NUnit.Framework;
7 |
8 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
9 | {
10 | [TestFixture]
11 | public class DeclareDeclarationTests
12 | {
13 | #region VB.NET
14 | [Test]
15 | public void VBNetDeclareDeclarationTest()
16 | {
17 | string program = "Declare Ansi Function GetUserName Lib \"advapi32.dll\" Alias \"GetUserNameA\" (ByVal lpBuffer As String, ByRef nSize As Integer) As Integer\n";
18 | DeclareDeclaration dd = ParseUtil.ParseTypeMember(program);
19 | Assert.AreEqual("System.Int32", dd.TypeReference.Type);
20 | Assert.AreEqual("GetUserName", dd.Name);
21 | Assert.AreEqual("advapi32.dll", dd.Library);
22 | Assert.AreEqual("GetUserNameA", dd.Alias);
23 | Assert.AreEqual(CharsetModifier.Ansi, dd.Charset);
24 | }
25 | #endregion
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Statements/WithStatement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 |
7 | namespace ICSharpCode.NRefactory.VB.Ast
8 | {
9 | ///
10 | /// With Expression
11 | /// Block
12 | /// End With
13 | ///
14 | public class WithStatement : Statement
15 | {
16 | public Expression Expression {
17 | get { return GetChildByRole(Roles.Expression); }
18 | set { SetChildByRole(Roles.Expression, value); }
19 | }
20 |
21 | public BlockStatement Body {
22 | get { return GetChildByRole(Roles.Body); }
23 | set { SetChildByRole(Roles.Body, value); }
24 | }
25 |
26 | public override S AcceptVisitor (IAstVisitor visitor, T data)
27 | {
28 | return visitor.VisitWithStatement(this, data);
29 | }
30 |
31 | protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
32 | {
33 | throw new NotImplementedException();
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/NRefactory/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 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/ParenthesizedExpression.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 |
6 | namespace ICSharpCode.NRefactory.VB.Ast
7 | {
8 | ///
9 | /// Description of ParenthesizedExpression.
10 | ///
11 | public class ParenthesizedExpression : Expression
12 | {
13 | public ParenthesizedExpression()
14 | {
15 | }
16 |
17 | public Expression Expression {
18 | get { return GetChildByRole(Roles.Expression); }
19 | set { SetChildByRole(Roles.Expression, value); }
20 | }
21 |
22 | protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
23 | {
24 | var expr = other as ParenthesizedExpression;
25 | return expr != null &&
26 | Expression.DoMatch(expr.Expression, match);
27 | }
28 |
29 | public override S AcceptVisitor(IAstVisitor visitor, T data)
30 | {
31 | return visitor.VisitParenthesizedExpression(this, data);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/SimpleNameExpression.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 |
6 | namespace ICSharpCode.NRefactory.VB.Ast
7 | {
8 | ///
9 | /// Description of SimpleNameExpression.
10 | ///
11 | public class SimpleNameExpression : Expression
12 | {
13 | public Identifier Identifier { get; set; }
14 |
15 | public AstNodeCollection TypeArguments {
16 | get { return GetChildrenByRole(Roles.TypeArgument); }
17 | }
18 |
19 | protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
20 | {
21 | var node = other as SimpleNameExpression;
22 | return node != null
23 | && Identifier.DoMatch(node.Identifier, match)
24 | && TypeArguments.DoMatch(node.TypeArguments, match);
25 | }
26 |
27 | public override S AcceptVisitor(IAstVisitor visitor, T data)
28 | {
29 | return visitor.VisitSimpleNameExpression(this, data);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Statements/SyncLockStatement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 |
7 | namespace ICSharpCode.NRefactory.VB.Ast
8 | {
9 | ///
10 | /// SyncLock Expression
11 | /// Block
12 | /// End SyncLock
13 | ///
14 | public class SyncLockStatement : Statement
15 | {
16 | public Expression Expression {
17 | get { return GetChildByRole(Roles.Expression); }
18 | set { SetChildByRole(Roles.Expression, value); }
19 | }
20 |
21 | public BlockStatement Body {
22 | get { return GetChildByRole(Roles.Body); }
23 | set { SetChildByRole(Roles.Body, value); }
24 | }
25 |
26 | public override S AcceptVisitor (IAstVisitor visitor, T data)
27 | {
28 | return visitor.VisitSyncLockStatement(this, data);
29 | }
30 |
31 | protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
32 | {
33 | throw new NotImplementedException();
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/GetXmlNamespaceExpression.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 |
6 | namespace ICSharpCode.NRefactory.VB.Ast
7 | {
8 | public class GetXmlNamespaceExpression : Expression
9 | {
10 | public GetXmlNamespaceExpression(XmlIdentifier namespaceName)
11 | {
12 | SetChildByRole(Roles.XmlIdentifier, namespaceName);
13 | }
14 |
15 | public XmlIdentifier NamespaceName {
16 | get { return GetChildByRole(Roles.XmlIdentifier); }
17 | set { SetChildByRole(Roles.XmlIdentifier, value); }
18 | }
19 |
20 | protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
21 | {
22 | var expr = other as GetXmlNamespaceExpression;
23 | return expr != null &&
24 | NamespaceName.DoMatch(expr.NamespaceName, match);
25 | }
26 |
27 | public override S AcceptVisitor(IAstVisitor visitor, T data)
28 | {
29 | return visitor.VisitGetXmlNamespaceExpression(this, data);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/ICSharpCode.Decompiler/Tests/CustomAttributes.code.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | namespace aa
3 | {
4 | public static class CustomAtributes
5 | {
6 | [Flags]
7 | public enum EnumWithFlag
8 | {
9 | All = 15,
10 | None = 0,
11 | Item1 = 1,
12 | Item2 = 2,
13 | Item3 = 4,
14 | Item4 = 8
15 | }
16 | [AttributeUsage(AttributeTargets.All)]
17 | public class MyAttribute : Attribute
18 | {
19 | public MyAttribute(CustomAtributes.EnumWithFlag en)
20 | {
21 | }
22 | }
23 | [CustomAtributes.MyAttribute(CustomAtributes.EnumWithFlag.Item1 | CustomAtributes.EnumWithFlag.Item2)]
24 | private static int field;
25 | [CustomAtributes.MyAttribute(CustomAtributes.EnumWithFlag.All)]
26 | public static string Property
27 | {
28 | get
29 | {
30 | return "aa";
31 | }
32 | }
33 | [Obsolete("some message")]
34 | public static void ObsoletedMethod()
35 | {
36 | Console.WriteLine("{0} $$$ {1}", AttributeTargets.Interface, AttributeTargets.Property | AttributeTargets.Field);
37 | AttributeTargets attributeTargets = AttributeTargets.Property | AttributeTargets.Field;
38 | Console.WriteLine("{0} $$$ {1}", AttributeTargets.Interface, attributeTargets);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Statements/UsingStatement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 |
7 | namespace ICSharpCode.NRefactory.VB.Ast
8 | {
9 | public class UsingStatement : Statement
10 | {
11 | public static readonly Role ResourceRole = new Role("Resource", AstNode.Null);
12 |
13 | /// either multiple VariableInitializers or one Expression
14 | public AstNodeCollection Resources {
15 | get { return GetChildrenByRole(ResourceRole); }
16 | }
17 |
18 | public BlockStatement Body {
19 | get { return GetChildByRole(Roles.Body); }
20 | set { SetChildByRole(Roles.Body, value); }
21 | }
22 |
23 | protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
24 | {
25 | throw new NotImplementedException();
26 | }
27 |
28 | public override S AcceptVisitor(IAstVisitor visitor, T data)
29 | {
30 | return visitor.VisitUsingStatement(this, data);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Lexer/LATextReader.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.Collections.Generic;
6 | using System.IO;
7 |
8 | namespace ICSharpCode.NRefactory.VB.Parser
9 | {
10 | public class LATextReader : TextReader
11 | {
12 | List buffer;
13 | TextReader reader;
14 |
15 | public LATextReader(TextReader reader)
16 | {
17 | this.buffer = new List();
18 | this.reader = reader;
19 | }
20 |
21 | public override int Peek()
22 | {
23 | return Peek(0);
24 | }
25 |
26 | public override int Read()
27 | {
28 | int c = Peek();
29 | buffer.RemoveAt(0);
30 | return c;
31 | }
32 |
33 | public int Peek(int step)
34 | {
35 | while (step >= buffer.Count) {
36 | buffer.Add(reader.Read());
37 | }
38 |
39 | if (step < 0)
40 | return -1;
41 |
42 | return buffer[step];
43 | }
44 |
45 | protected override void Dispose(bool disposing)
46 | {
47 | if (disposing)
48 | reader.Dispose();
49 | base.Dispose(disposing);
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/IdentifierExpression.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 |
6 | namespace ICSharpCode.NRefactory.VB.Ast
7 | {
8 | public class IdentifierExpression : Expression
9 | {
10 | public IdentifierExpression()
11 | {
12 |
13 | }
14 |
15 | public IdentifierExpression(Identifier identifier)
16 | {
17 | this.Identifier = identifier;
18 | }
19 |
20 | public Identifier Identifier {
21 | get { return GetChildByRole(Roles.Identifier); }
22 | set { SetChildByRole(Roles.Identifier, value); }
23 | }
24 |
25 | public AstNodeCollection TypeArguments {
26 | get { return GetChildrenByRole(Roles.TypeArgument); }
27 | }
28 |
29 | protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
30 | {
31 | throw new NotImplementedException();
32 | }
33 |
34 | public override S AcceptVisitor(IAstVisitor visitor, T data)
35 | {
36 | return visitor.VisitIdentifierExpression(this, data);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/GlobalReferenceExpressionTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class GlobalReferenceExpressionTests
14 | {
15 | [Test]
16 | public void VBNetGlobalReferenceExpressionTest()
17 | {
18 | TypeReferenceExpression tre = ParseUtil.ParseExpression("Global.System");
19 | Assert.IsTrue(tre.TypeReference.IsGlobal);
20 | Assert.AreEqual("System", tre.TypeReference.Type);
21 | }
22 |
23 | [Test]
24 | public void VBNetGlobalTypeDeclaration()
25 | {
26 | LocalVariableDeclaration lvd = ParseUtil.ParseStatement("Dim a As Global.System.String");
27 | TypeReference typeRef = lvd.GetTypeForVariable(0);
28 | Assert.IsTrue(typeRef.IsGlobal);
29 | Assert.AreEqual("System.String", typeRef.Type);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Statements/LabelDeclarationStatement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 |
7 | namespace ICSharpCode.NRefactory.VB.Ast
8 | {
9 | ///
10 | /// Label:
11 | ///
12 | public class LabelDeclarationStatement : Statement
13 | {
14 | /// either PrimitiveExpression or IdentifierExpression
15 | public Expression Label {
16 | get { return GetChildByRole(Roles.Expression); }
17 | set { SetChildByRole(Roles.Expression, value); }
18 | }
19 |
20 | public VBTokenNode Colon {
21 | get { return GetChildByRole(Roles.Colon); }
22 | }
23 |
24 | public override S AcceptVisitor (IAstVisitor visitor, T data)
25 | {
26 | return visitor.VisitLabelDeclarationStatement(this, data);
27 | }
28 |
29 | protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
30 | {
31 | LabelDeclarationStatement o = other as LabelDeclarationStatement;
32 | return o != null && this.Label.DoMatch(o.Label, match);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/TypeOfIsExpression.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 |
6 | namespace ICSharpCode.NRefactory.VB.Ast
7 | {
8 | public class TypeOfIsExpression : Expression
9 | {
10 | public TypeOfIsExpression()
11 | {
12 | }
13 |
14 | public Expression TypeOfExpression {
15 | get { return GetChildByRole(Roles.Expression); }
16 | set { SetChildByRole(Roles.Expression, value); }
17 | }
18 |
19 | public AstType Type {
20 | get { return GetChildByRole(Roles.Type); }
21 | set { SetChildByRole(Roles.Type, value); }
22 | }
23 |
24 | protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
25 | {
26 | var expr = other as TypeOfIsExpression;
27 | return expr != null &&
28 | TypeOfExpression.DoMatch(expr.TypeOfExpression, match) &&
29 | Type.DoMatch(expr.Type, match);
30 | }
31 |
32 | public override S AcceptVisitor(IAstVisitor visitor, T data)
33 | {
34 | return visitor.VisitTypeOfIsExpression(this, data);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/TypeOfIsExpressionTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class TypeOfIsExpressionTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBNetSimpleTypeOfIsExpression()
18 | {
19 | TypeOfIsExpression ce = ParseUtil.ParseExpression("TypeOf o Is MyObject");
20 | Assert.AreEqual("MyObject", ce.TypeReference.Type);
21 | Assert.IsTrue(ce.Expression is SimpleNameExpression);
22 | }
23 |
24 | [Test]
25 | public void VBNetGenericTypeOfIsExpression()
26 | {
27 | TypeOfIsExpression ce = ParseUtil.ParseExpression("TypeOf o Is List(of T)");
28 | Assert.AreEqual("List", ce.TypeReference.Type);
29 | Assert.AreEqual("T", ce.TypeReference.GenericTypes[0].Type);
30 | Assert.IsTrue(ce.Expression is SimpleNameExpression);
31 | }
32 | #endregion
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Statements/ExpressionStatement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 |
7 | namespace ICSharpCode.NRefactory.VB.Ast
8 | {
9 | ///
10 | /// Expression
11 | ///
12 | // TODO this does not directly reflect the VB grammar!
13 | public class ExpressionStatement : Statement
14 | {
15 | public Expression Expression {
16 | get { return GetChildByRole (Roles.Expression); }
17 | set { SetChildByRole (Roles.Expression, value); }
18 | }
19 |
20 | public override S AcceptVisitor (IAstVisitor visitor, T data)
21 | {
22 | return visitor.VisitExpressionStatement(this, data);
23 | }
24 |
25 | public ExpressionStatement()
26 | {
27 | }
28 |
29 | public ExpressionStatement(Expression expression)
30 | {
31 | this.Expression = expression;
32 | }
33 |
34 | protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
35 | {
36 | ExpressionStatement o = other as ExpressionStatement;
37 | return o != null && this.Expression.DoMatch(o.Expression, match);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/TypeReferenceExpression.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 |
6 | namespace ICSharpCode.NRefactory.VB.Ast
7 | {
8 | ///
9 | /// Represents an AstType as an expression.
10 | /// This is used when calling a method on a primitive type: "Integer.Parse()"
11 | ///
12 | public class TypeReferenceExpression : Expression
13 | {
14 | public AstType Type {
15 | get { return GetChildByRole(Roles.Type); }
16 | set { SetChildByRole(Roles.Type, value); }
17 | }
18 |
19 | public override S AcceptVisitor(IAstVisitor visitor, T data)
20 | {
21 | return visitor.VisitTypeReferenceExpression(this, data);
22 | }
23 |
24 | public TypeReferenceExpression ()
25 | {
26 | }
27 |
28 | public TypeReferenceExpression (AstType type)
29 | {
30 | SetChildByRole(Roles.Type, type);
31 | }
32 |
33 | protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
34 | {
35 | TypeReferenceExpression o = other as TypeReferenceExpression;
36 | return o != null && this.Type.DoMatch(o.Type, match);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Statements/ThrowStatement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 |
7 | namespace ICSharpCode.NRefactory.VB.Ast
8 | {
9 | ///
10 | /// Throw Expression
11 | ///
12 | public class ThrowStatement : Statement
13 | {
14 | public VBTokenNode ThrowToken {
15 | get { return GetChildByRole (Roles.Keyword); }
16 | }
17 |
18 | public Expression Expression {
19 | get { return GetChildByRole(Roles.Expression); }
20 | set { SetChildByRole(Roles.Expression, value); }
21 | }
22 |
23 | public ThrowStatement()
24 | {
25 | }
26 |
27 | public ThrowStatement(Expression expression)
28 | {
29 | AddChild (expression, Roles.Expression);
30 | }
31 |
32 | public override S AcceptVisitor(IAstVisitor visitor, T data)
33 | {
34 | return visitor.VisitThrowStatement(this, data);
35 | }
36 |
37 | protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
38 | {
39 | ThrowStatement o = other as ThrowStatement;
40 | return o != null && this.Expression.DoMatch(o.Expression, match);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/NRefactory/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 : ICodeActionProvider 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 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 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Statements/LocalDeclarationStatement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 |
7 | namespace ICSharpCode.NRefactory.VB.Ast
8 | {
9 | ///
10 | /// ( Dim | Static | Const ) VariableDeclarator { , VariableDeclarator }
11 | ///
12 | public class LocalDeclarationStatement : Statement
13 | {
14 | public AstNodeCollection Variables {
15 | get { return GetChildrenByRole(VariableDeclarator.VariableDeclaratorRole); }
16 | }
17 |
18 | public Modifiers Modifiers {
19 | get { return AttributedNode.GetModifiers(this); }
20 | set { AttributedNode.SetModifiers(this, value); }
21 | }
22 |
23 | public VBModifierToken ModifierToken {
24 | get { return GetChildByRole(AttributedNode.ModifierRole); }
25 | }
26 |
27 | public override S AcceptVisitor (IAstVisitor visitor, T data)
28 | {
29 | return visitor.VisitLocalDeclarationStatement(this, data);
30 | }
31 |
32 | protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
33 | {
34 | throw new NotImplementedException();
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Statements/ReturnStatement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 |
7 | namespace ICSharpCode.NRefactory.VB.Ast
8 | {
9 | ///
10 | /// Return Expression
11 | ///
12 | public class ReturnStatement : Statement
13 | {
14 | public VBTokenNode ReturnToken {
15 | get { return GetChildByRole (Roles.Keyword); }
16 | }
17 |
18 | public Expression Expression {
19 | get { return GetChildByRole(Roles.Expression); }
20 | set { SetChildByRole(Roles.Expression, value); }
21 | }
22 |
23 | public ReturnStatement()
24 | {
25 | }
26 |
27 | public ReturnStatement(Expression expression)
28 | {
29 | AddChild (expression, Roles.Expression);
30 | }
31 |
32 | public override S AcceptVisitor(IAstVisitor visitor, T data)
33 | {
34 | return visitor.VisitReturnStatement(this, data);
35 | }
36 |
37 | protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
38 | {
39 | ReturnStatement o = other as ReturnStatement;
40 | return o != null && this.Expression.DoMatch(o.Expression, match);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB/Ast/Statements/ForEachStatement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 |
7 | namespace ICSharpCode.NRefactory.VB.Ast
8 | {
9 | public class ForEachStatement : Statement
10 | {
11 | public static readonly Role VariableRole = new Role("Variable", AstNode.Null);
12 |
13 | public AstNode Variable {
14 | get { return GetChildByRole(VariableRole); }
15 | set { SetChildByRole(VariableRole, value); }
16 | }
17 |
18 | public Expression InExpression {
19 | get { return GetChildByRole(Roles.Expression); }
20 | set { SetChildByRole(Roles.Expression, value); }
21 | }
22 |
23 | public BlockStatement Body {
24 | get { return GetChildByRole(Roles.Body); }
25 | set { SetChildByRole(Roles.Body, value); }
26 | }
27 |
28 | protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
29 | {
30 | throw new NotImplementedException();
31 | }
32 |
33 | public override S AcceptVisitor(IAstVisitor visitor, T data)
34 | {
35 | return visitor.VisitForEachStatement(this, data);
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/CodeDOMTypeReferenceTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.CodeDom;
6 | using System.Collections.Generic;
7 |
8 | using ICSharpCode.NRefactory.VB.Ast;
9 | using ICSharpCode.NRefactory.VB.Visitors;
10 | using NUnit.Framework;
11 |
12 | namespace ICSharpCode.NRefactory.VB.Tests.Output.CodeDom.Tests
13 | {
14 | [TestFixture]
15 | public class CodeDOMTypeReferenceTest
16 | {
17 | [TestAttribute]
18 | public void InnerClassTypeReferencTest()
19 | {
20 | InnerClassTypeReference ictr = new InnerClassTypeReference(
21 | new TypeReference("OuterClass", new List { new TypeReference("String") }),
22 | "InnerClass",
23 | new List { new TypeReference("Int32"), new TypeReference("Int64") });
24 | Assert.AreEqual("OuterClass+InnerClass", ictr.ToString());
25 | CodeTypeOfExpression result = (CodeTypeOfExpression)new TypeOfExpression(ictr).AcceptVisitor(new CodeDomVisitor(), null);
26 | Assert.AreEqual("OuterClass`1+InnerClass`2", result.Type.BaseType);
27 | Assert.AreEqual(3, result.Type.TypeArguments.Count);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/SwitchStatementTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using System.IO;
6 | using NUnit.Framework;
7 | using ICSharpCode.NRefactory.VB.Parser;
8 | using ICSharpCode.NRefactory.VB.Ast;
9 |
10 | namespace ICSharpCode.NRefactory.VB.Tests.Ast
11 | {
12 | [TestFixture]
13 | public class SwitchStatementTests
14 | {
15 | #region VB.NET
16 | [Test]
17 | public void VBSwitchStatementTest()
18 | {
19 | SwitchStatement switchStmt = ParseUtil.ParseStatement("Select Case a\n Case 4, 5\n Case 6\n Case Else\n End Select");
20 | Assert.AreEqual("a", ((SimpleNameExpression)switchStmt.SwitchExpression).Identifier);
21 | // TODO: Extend test
22 | }
23 |
24 | [Test]
25 | public void InvalidVBSwitchStatementTest()
26 | {
27 | SwitchStatement switchStmt = ParseUtil.ParseStatement("Select Case a\n Case \n End Select", true);
28 | Assert.AreEqual("a", ((SimpleNameExpression)switchStmt.SwitchExpression).Identifier);
29 | SwitchSection sec = switchStmt.SwitchSections[0];
30 | Assert.AreEqual(0, sec.SwitchLabels.Count);
31 | }
32 | #endregion
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/ICSharpCode.Decompiler/Tests/Helpers/RemoveCompilerAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | using ICSharpCode.Decompiler.Ast.Transforms;
7 | using ICSharpCode.NRefactory.CSharp;
8 |
9 | namespace ICSharpCode.Decompiler.Tests.Helpers
10 | {
11 | class RemoveCompilerAttribute : DepthFirstAstVisitor