├── .gitattributes
├── .gitignore
├── Drawings
└── RoslynCodeAsData.vsd
├── MetaProgramming
├── .nuget
│ ├── NuGet.Config
│ ├── NuGet.exe
│ └── NuGet.targets
├── MetaProgramming.Nemerle.Macro
│ ├── EmptyMacro.n
│ ├── Fault.n
│ ├── MetaProgramming.Nemerle.Macro.nproj
│ ├── Properties
│ │ └── AssemblyInfo.n
│ └── TestMacro.n
├── MetaProgramming.Nemerle.Tests.CSharp
│ ├── FaultKeywordTests.cs
│ ├── MacroTests.cs
│ ├── MetaProgramming.Nemerle.Tests.CSharp.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
├── MetaProgramming.Nemerle
│ ├── CompileTimeVsRunTimeExecutionSample.n
│ ├── FaultKeywordSample.n
│ ├── MetaProgramming.Nemerle.nproj
│ └── Properties
│ │ └── AssemblyInfo.n
├── MetaProgramming.RoslynCTP.Tests
│ ├── ClassTemplateInfos.json
│ ├── CodeAsDataTests.ScriptAsData_ConvertJsonToScript_ScriptSubmission.approved.txt
│ ├── CodeAsDataTests.cs
│ ├── CodeSmells.Samples
│ │ ├── .nuget
│ │ │ ├── NuGet.Config
│ │ │ ├── NuGet.exe
│ │ │ └── NuGet.targets
│ │ ├── ClassWithExtraComplexity.cs
│ │ ├── ClassWithReturnNullMethods.cs
│ │ ├── CodeSmells.Samples.csproj
│ │ ├── CodeSmells.Samples.sln
│ │ └── Properties
│ │ │ └── AssemblyInfo.cs
│ ├── ConverterTests.CSharp2VB_Convert_ValidCode.approved.txt
│ ├── ConverterTests.VB2CSharp_Convert_ValidCode.approved.txt
│ ├── ConverterTests.cs
│ ├── InputData.json
│ ├── IntrospectionTests.cs
│ ├── IntrospectionTests`1.Introspection_SearchForComplexityGt10_ApprovedList.Integration.approved.txt
│ ├── IntrospectionTests`1.Introspection_SearchForComplexityGt10_ApprovedList.UnitTests.approved.txt
│ ├── IntrospectionTests`1.Introspection_SearchForReturnNullStatements_ApprovedList.Integration.approved.txt
│ ├── IntrospectionTests`1.Introspection_SearchForReturnNullStatements_ApprovedList.UnitTests.approved.txt
│ ├── MetaProgramming.RoslynCTP.Tests.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── RuntimeTextTemplateTests.RuntimeTextTemplate_TransformText_ExpectedOutput.approved.txt
│ ├── RuntimeTextTemplateTests.cs
│ ├── ScriptInfo.json
│ ├── Strategy
│ │ ├── CodeSmellsIntrospectionFixture.cs
│ │ ├── IIntrospectionFixture.cs
│ │ ├── IntegrationIntrospectionFixture.cs
│ │ └── StrategyNamer.cs
│ └── packages.config
├── MetaProgramming.RoslynCTP
│ ├── CSharpToVisualBasicConverter
│ │ ├── CSharpToVisualBasicConverter.csproj
│ │ ├── Cleanup
│ │ │ ├── CurlyCleanup.cs
│ │ │ ├── MissingCurlyCleanup.cs
│ │ │ ├── NewLineCleanup.cs
│ │ │ └── WhiteSpaceCleanup.cs
│ │ ├── Converting
│ │ │ ├── Converter.NodeVisitor.cs
│ │ │ ├── Converter.StatementVisitor.ForStatement.cs
│ │ │ ├── Converter.StatementVisitor.cs
│ │ │ └── Converter.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── Utilities
│ │ │ ├── CSharpExtensions.cs
│ │ │ ├── EnumerableExtensions.cs
│ │ │ └── StringExtensions.cs
│ │ └── packages.config
│ ├── CodeAsData.cs
│ ├── ConvertTo.cs
│ ├── Internal
│ │ └── PredicateBuilder.cs
│ ├── Introspection.cs
│ ├── MetaProgramming.RoslynCTP.csproj
│ ├── Model
│ │ ├── ClassTemplateInfo.cs
│ │ └── ScriptInfo.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── RuntimeTextTemplate.cs
│ ├── RuntimeTextTemplate.tt
│ ├── VisualBasicToCSharpConverter
│ │ ├── Converting
│ │ │ ├── Converter.vb
│ │ │ ├── NodeConvertingVisitor.vb
│ │ │ └── QueryClauseConvertingVisitor.vb
│ │ ├── My Project
│ │ │ └── AssemblyInfo.vb
│ │ ├── VisualBasicToCSharpConverter.vbproj
│ │ └── packages.config
│ └── packages.config
├── MetaProgramming.sln
└── README.md
├── Presentation
├── README.md
├── apple-touch-icon.png
├── architectural_validation_in_dotnet.html
├── css
│ ├── architectural_validation.css
│ ├── metaprogramming.css
│ ├── metaprogramming_roslyn_and_nemerle.css
│ └── scriptcs_for_project-less_development.css
├── images
│ ├── CodeAsData_ConvertVBtoCSharp.png
│ ├── FreeBSD-No-Bikeshed.png
│ ├── IronPythonScript.png
│ ├── JavaScriptMetaprogrammingViaScripting.pdn
│ ├── JavaScriptMetaprogrammingViaScripting_00_Begin.png
│ ├── JavaScriptMetaprogrammingViaScripting_01_SimpleMultiplication.png
│ ├── JavaScriptMetaprogrammingViaScripting_02_UseFunctionDynamicly.png
│ ├── JavaScriptMetaprogrammingViaScripting_03_InjectionValuesIntoLocalExecutionScope.png
│ ├── JavaScript_Eval_vs_Roslyn_ScriptEngine.png
│ ├── RoslynInspection_CalculateCyclomaticComplexity.png
│ ├── RoslynSyntaxTree_00.png
│ ├── chocolatey.png
│ ├── hotcode_logo.png
│ ├── introspection_return_null_with_approvaltests.png
│ ├── itera_logo.png
│ ├── nemerle_compiletime_macro_execution.png
│ ├── nodejs.png
│ ├── npm.png
│ ├── nuget.png
│ ├── postsharp_validation_aspect-virtual_keyword_is_required.png
│ ├── roslyn_ctp_compiler_pipeline_api_and_services.png
│ ├── roslyn_syntax_tree_for_return_null.png
│ ├── scriptcs.png
│ ├── scriptcs_execution_screenshot.png
│ └── type_name_collision.png
├── js
│ ├── architectural_validation.js
│ ├── impress.js
│ ├── jquery-ui.min.js
│ ├── jquery.jsPlumb-1.5.2-min.js
│ ├── jquery.min.js
│ └── metaprogramming_roslyn.js
├── metaprogramming_in_dotnet_roslynctp.html
├── metaprogramming_in_dotnet_roslynctp_and_nemerle.html
└── scriptcs_for_project-less_development.html
├── README.md
└── Snippets
├── CaaS
├── CodeDOM-BuildAtRuntime.linq
├── CodeDOM-BuildAtRuntimeCSharp45.linq
└── Roslyn-BuildAtRuntime.linq
├── CodeAsData
├── Roslyn-ConvertC#2VB.linq
└── Roslyn-ConvertVB2C#.linq
├── Introspection
├── AfterProgramming-ReturnNull.csx
├── AfterProgramming-ReturnNull.linq
├── OptionTypeAndNull.linq
├── Reflection-TestReferencesIntersection.linq
├── Roslyn-CyclomaticComplexity.linq
├── Roslyn-CyclomaticComplexityRx.linq
├── Roslyn-ReturnNull.linq
├── Roslyn-ReturnNullRx.linq
├── Roslyn-ReturnNullSyntaxWalker.linq
└── packages.config
├── Other
├── Roslyn-C#compilerIssues.csx
└── SyntaxTreesSamples.cs
├── Performance
├── C#-HardCodedRule.linq
├── DLR-ExpressionTrees.linq
└── Roslyn-ScriptingWithStaticlyTypedResult.linq
├── README.md
└── Scripting
├── IronPython-Scripting.linq
├── JsEvalSample.html
├── JsEvalSample.md
├── README.md
├── Roslyn-EvalSample.csx
├── Roslyn-EvalSample.linq
├── Roslyn-ScriptingWithDynamiclyTypeResult.linq
├── ScriptCs
├── Edge.js
│ ├── EdgeJs2ClrSample.js
│ ├── EdgeJs2ProjectlessCsx.js
│ └── ProjectlessCsx.csx
├── EmbededScriptCsWithNuGetSupport.csx
├── FluentAutomation.SeleniumWebDriver
│ ├── FluentAutomation.SeleniumWebDriver.csx
│ └── packages.config
├── README.md
├── ScriptCs-ScriptingFromC#.linq
├── ScriptCs.WebApi.Sample.csx
├── SeleniumWebDriver
│ ├── SeleniumWebDriver.FireFox.csx
│ ├── SeleniumWebDriver.PhantomJs.csx
│ └── packages.config
└── packages.config
├── packages.config
└── sample.py
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
2 | [Bb]in/
3 | [Oo]bj/
4 |
5 | # mstest test results
6 | TestResults
7 |
8 | ## Ignore Visual Studio temporary files, build results, and
9 | ## files generated by popular Visual Studio add-ons.
10 |
11 | # User-specific files
12 | *.suo
13 | *.user
14 | *.sln.docstates
15 | *.ide
16 |
17 | # Build results
18 | [Dd]ebug/
19 | [Rr]elease/
20 | x64/
21 | *_i.c
22 | *_p.c
23 | *.ilk
24 | *.meta
25 | *.obj
26 | *.pch
27 | *.pdb
28 | *.pgc
29 | *.pgd
30 | *.rsp
31 | *.sbr
32 | *.tlb
33 | *.tli
34 | *.tlh
35 | *.tmp
36 | *.log
37 | *.vspscc
38 | *.vssscc
39 | .builds
40 |
41 | # Visual C++ cache files
42 | ipch/
43 | *.aps
44 | *.ncb
45 | *.opensdf
46 | *.sdf
47 |
48 | # Visual Studio profiler
49 | *.psess
50 | *.vsp
51 | *.vspx
52 |
53 | # Guidance Automation Toolkit
54 | *.gpState
55 |
56 | # ReSharper is a .NET coding add-in
57 | _ReSharper*
58 |
59 | # NCrunch
60 | *.ncrunch*
61 | .*crunch*.local.xml
62 |
63 | # Installshield output folder
64 | [Ee]xpress
65 |
66 | # DocProject is a documentation generator add-in
67 | DocProject/buildhelp/
68 | DocProject/Help/*.HxT
69 | DocProject/Help/*.HxC
70 | DocProject/Help/*.hhc
71 | DocProject/Help/*.hhk
72 | DocProject/Help/*.hhp
73 | DocProject/Help/Html2
74 | DocProject/Help/html
75 |
76 | # Click-Once directory
77 | publish
78 |
79 | # Publish Web Output
80 | *.Publish.xml
81 |
82 | # NuGet Packages Directory
83 | packages
84 |
85 | # Windows Azure Build Output
86 | csx
87 | *.build.csdef
88 |
89 | # Windows Store app package directory
90 | AppPackages/
91 |
92 | # Others
93 | [Bb]in
94 | [Oo]bj
95 | sql
96 | TestResults
97 | [Tt]est[Rr]esult*
98 | *.Cache
99 | ClientBin
100 | [Ss]tyle[Cc]op.*
101 | ~$*
102 | *.dbmdl
103 | Generated_Code #added for RIA/Silverlight projects
104 |
105 | # Backup & report files from converting an old project file to a newer
106 | # Visual Studio version. Backup files are not needed, because we have git ;-)
107 | _UpgradeReport_Files/
108 | Backup*/
109 | UpgradeLog*.XML
110 |
111 | # ApprovalTests
112 | *.received.txt
113 |
114 | # Selenium PNGs
115 | test*.png
116 |
117 | # Node.js modules
118 | node_modules
119 |
120 | # Sublime projects/workspaces
121 | *.sublime-*
122 |
123 | #Video
124 | video
--------------------------------------------------------------------------------
/Drawings/RoslynCodeAsData.vsd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akimboyko/MetaProgramming/a07eeccf0f32a5a1f645ffe57e23c715cbcc55a4/Drawings/RoslynCodeAsData.vsd
--------------------------------------------------------------------------------
/MetaProgramming/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MetaProgramming/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akimboyko/MetaProgramming/a07eeccf0f32a5a1f645ffe57e23c715cbcc55a4/MetaProgramming/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.Nemerle.Macro/EmptyMacro.n:
--------------------------------------------------------------------------------
1 | using Nemerle;
2 | using Nemerle.Collections;
3 | using Nemerle.Compiler;
4 | using Nemerle.Text;
5 | using Nemerle.Utility;
6 |
7 | using System;
8 | using System.Collections.Generic;
9 | using System.Linq;
10 |
11 | namespace MetaProgramming.Nemerle.Macro
12 | {
13 | public macro Macro1()
14 | {
15 | <[ () ]>
16 | }
17 | }
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.Nemerle.Macro/Fault.n:
--------------------------------------------------------------------------------
1 | using Nemerle;
2 | using Nemerle.Collections;
3 | using Nemerle.Compiler;
4 | using Nemerle.Text;
5 | using Nemerle.Utility;
6 |
7 | using System;
8 | using System.Collections.Generic;
9 | using System.Linq;
10 |
11 | namespace MetaProgramming.Nemerle.Macro
12 | {
13 | macro execute(body, actionOnFault, actionOnFinally)
14 | syntax (
15 | "try",
16 | body,
17 | "fault",
18 | actionOnFault,
19 | "finally",
20 | actionOnFinally)
21 | {
22 | <[
23 | try
24 | {
25 | $body;
26 | }
27 | catch
28 | {
29 | | e is System.Exception => { $actionOnFault; throw; }
30 | }
31 | finally
32 | {
33 | $actionOnFinally;
34 | }
35 | ]>
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.Nemerle.Macro/MetaProgramming.Nemerle.Macro.nproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | 3bb3e243-467a-42d5-878f-0f1aa26195a5
9 | Library
10 | Properties
11 | MetaProgramming.Nemerle.Macro
12 | MetaProgramming.Nemerle.Macro
13 | v4.5
14 | 512
15 | true
16 | Net-4.5
17 | $(ProgramFiles)\Nemerle
18 | $(NemerleBinPathRoot)\$(NemerleVersion)
19 | MetaProgramming.Nemerle.Macro
20 |
21 |
22 | true
23 | false
24 | bin\Debug\
25 | DEBUG;TRACE
26 | prompt
27 | 4
28 |
29 |
30 | false
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 | $(OutputPath)\$(AssemblyName).xml
37 |
38 |
39 |
40 |
41 |
42 | 3.5
43 |
44 |
45 | 3.5
46 |
47 |
48 | 3.5
49 |
50 |
51 |
52 |
53 | False
54 | $(Nemerle)\Nemerle.dll
55 |
56 |
57 | False
58 | $(Nemerle)\Nemerle.Compiler.dll
59 |
60 |
61 | $(Nemerle)\Nemerle.Linq.dll
62 |
63 |
64 |
65 |
66 | Code
67 |
68 |
69 |
70 |
71 | Code
72 |
73 |
74 |
75 |
76 |
77 |
78 |
87 |
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.Nemerle.Macro/Properties/AssemblyInfo.n:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | [assembly: Nemerle.Macro.Resource(@"Properties\Resources.resx")]
6 | [assembly: Nemerle.Macro.Settings(@"Properties\Settings.settings")]
7 |
8 | // General Information about an assembly is controlled through the following
9 | // set of attributes. Change these attribute values to modify the information
10 | // associated with an assembly.
11 | [assembly: AssemblyTitle("MetaProgramming.Nemerle.Macro")]
12 | [assembly: AssemblyDescription("")]
13 | [assembly: AssemblyConfiguration("")]
14 | [assembly: AssemblyCompany("")]
15 | [assembly: AssemblyProduct("MetaProgramming.Nemerle.Macro")]
16 | [assembly: AssemblyCopyright("Copyright © 2013")]
17 | [assembly: AssemblyTrademark("")]
18 | [assembly: AssemblyCulture("")]
19 |
20 | // Setting ComVisible to false makes the types in this assembly not visible
21 | // to COM components. If you need to access a type in this assembly from
22 | // COM, set the ComVisible attribute to true on that type.
23 | [assembly: ComVisible(false)]
24 |
25 | // The following GUID is for the ID of the typelib if this project is exposed to COM
26 | [assembly: Guid("3bb3e243-467a-42d5-878f-0f1aa26195a5")]
27 |
28 | // Version information for an assembly consists of the following four values:
29 | //
30 | // Major Version
31 | // Minor Version
32 | // Build Number
33 | // Revision
34 | //
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.Nemerle.Macro/TestMacro.n:
--------------------------------------------------------------------------------
1 | using System;
2 | using Nemerle;
3 | using Nemerle.Collections;
4 | using Nemerle.Compiler;
5 | using Nemerle.Text;
6 | using Nemerle.Utility;
7 |
8 | namespace MetaProgramming.Nemerle.Macro
9 | {
10 | // Test macros to show difference between compile time and runtime execution
11 | public macro TestMacro(inputAST)
12 | {
13 | Console.WriteLine("Compile-time execution: '{0}' of type {1}\n",
14 | inputAST, inputAST.GetType());
15 |
16 | <[ Console.WriteLine("Run-time execution: {0} of type {1}\n",
17 | $inputAST, $inputAST.GetType()) ]>;
18 | }
19 |
20 | // Expected console output during build
21 | // 3> Compile-time execution: '"literal"' of type Nemerle.Compiler.Parsetree.PExpr+Literal
22 | // 3> Compile-time execution: 'x' of type Nemerle.Compiler.Parsetree.PExpr+Ref
23 | }
24 |
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.Nemerle.Tests.CSharp/FaultKeywordTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FluentAssertions;
3 | using NUnit.Framework;
4 |
5 | namespace MetaProgramming.Nemerle.Tests.CSharp
6 | {
7 | [TestFixture]
8 | public class FaultKeywordTests
9 | {
10 | [Test]
11 | public void FaultKeywordAtNemerle_NormalFlow_BodyHasBeenExecuted()
12 | {
13 | var finallyHasBeenExecuted = false;
14 | var uniqueString = Guid.NewGuid().ToString();
15 |
16 | new FaultKeywordSample()
17 | .ExecuteFaultCSharpNemerle(
18 | () => uniqueString,
19 | () => { throw new Exception("Should not execute `fault`"); },
20 | () => { finallyHasBeenExecuted = true; })
21 | .Should().Be(uniqueString);
22 |
23 | finallyHasBeenExecuted.Should().BeTrue();
24 | }
25 |
26 | [Test]
27 | public void FaultKeywordAtNemerle_ExceptionalFlow_BothBodyAndFaultHadBeenExecuted()
28 | {
29 | var bodyHasBeenExecuted = false;
30 | var faultHasBeenExecuted = false;
31 | var finallyHasBeenExecuted = false;
32 | var uniqueExceptionalMessage = string.Format("Exceptional Flow {0}", Guid.NewGuid());
33 |
34 | Action act = () =>
35 | new FaultKeywordSample()
36 | .ExecuteFaultCSharpNemerle(
37 | () =>
38 | {
39 | bodyHasBeenExecuted = true;
40 | throw new Exception(uniqueExceptionalMessage);
41 | },
42 | () => { faultHasBeenExecuted = true; },
43 | () => { finallyHasBeenExecuted = true; });
44 |
45 | act.ShouldThrow()
46 | .WithMessage(uniqueExceptionalMessage);
47 |
48 | bodyHasBeenExecuted.Should().BeTrue();
49 | faultHasBeenExecuted.Should().BeTrue();
50 | finallyHasBeenExecuted.Should().BeTrue();
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.Nemerle.Tests.CSharp/MacroTests.cs:
--------------------------------------------------------------------------------
1 | using FluentAssertions;
2 | using NUnit.Framework;
3 |
4 | namespace MetaProgramming.Nemerle.Tests.CSharp
5 | {
6 | [TestFixture]
7 | public class MacroTests
8 | {
9 | [Test]
10 | public void CompileTimeVsRunTime_Execution_ExpectedOutput()
11 | {
12 | string result = new CompileTimeVsRunTimeExecutionSample().Execute();
13 |
14 | result.Should().Be("output");
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.Nemerle.Tests.CSharp/MetaProgramming.Nemerle.Tests.CSharp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {44555B43-900C-4F80-B77B-D2C751788BA1}
8 | Library
9 | Properties
10 | MetaProgramming.Nemerle.Tests.CSharp
11 | MetaProgramming.Nemerle.Tests.CSharp
12 | v4.5
13 | 512
14 | ..\
15 | true
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 | ..\packages\FluentAssertions.2.0.1\lib\net45\FluentAssertions.dll
37 |
38 |
39 | ..\packages\NUnit.2.6.2\lib\nunit.framework.dll
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | {eee410f7-10df-452f-a2a5-d073ad12efd6}
60 | MetaProgramming.Nemerle
61 |
62 |
63 |
64 |
65 |
72 |
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.Nemerle.Tests.CSharp/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("MetaProgramming.Nemerle.Tests.CSharp")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("MetaProgramming.Nemerle.Tests.CSharp")]
13 | [assembly: AssemblyCopyright("Copyright © 2013")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("5a7bdbe2-b796-4088-89ed-6f22b584a189")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.Nemerle.Tests.CSharp/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.Nemerle/CompileTimeVsRunTimeExecutionSample.n:
--------------------------------------------------------------------------------
1 | using Nemerle.Collections;
2 | using Nemerle.Text;
3 | using Nemerle.Utility;
4 |
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 |
9 | using MetaProgramming.Nemerle.Macro;
10 |
11 | namespace MetaProgramming.Nemerle
12 | {
13 | public class CompileTimeVsRunTimeExecutionSample
14 | {
15 | public Execute() : string
16 | {
17 | TestMacro("literal");
18 |
19 | def x = 1 + 2;
20 |
21 | TestMacro(x);
22 |
23 | "output";
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.Nemerle/FaultKeywordSample.n:
--------------------------------------------------------------------------------
1 | using Nemerle;
2 | using Nemerle.Collections;
3 | using Nemerle.Text;
4 | using Nemerle.Utility;
5 |
6 | using System;
7 | using System.Collections.Generic;
8 | using System.Linq;
9 |
10 | using MetaProgramming.Nemerle.Macro;
11 |
12 | namespace MetaProgramming.Nemerle
13 | {
14 | public partial class FaultKeywordSample
15 | {
16 | public ExecuteFaultCSharpNemerle(body : Func[string], onFault : Action, onFinally : Action) : string
17 | {
18 | mutable result : string = null;
19 |
20 | try
21 | {
22 | result = body();
23 | }
24 | fault // here is a _new keyword_ `fault` only executed after exceptions
25 | {
26 | onFault();
27 | }
28 | finally
29 | {
30 | onFinally();
31 | }
32 |
33 | result;
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.Nemerle/MetaProgramming.Nemerle.nproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | eee410f7-10df-452f-a2a5-d073ad12efd6
9 | Library
10 | Properties
11 | MetaProgramming.Nemerle
12 | MetaProgramming.Nemerle
13 | v4.5
14 | 512
15 | true
16 | Net-4.5
17 | $(ProgramFiles)\Nemerle
18 | $(NemerleBinPathRoot)\$(NemerleVersion)
19 | MetaProgramming.Nemerle
20 |
21 |
22 | true
23 | false
24 | bin\Debug\
25 | DEBUG;TRACE
26 | prompt
27 | 4
28 |
29 |
30 | false
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 | $(OutputPath)\$(AssemblyName).xml
37 |
38 |
39 |
40 |
41 |
42 | 3.5
43 |
44 |
45 | 3.5
46 |
47 |
48 | 3.5
49 |
50 |
51 |
52 |
53 | False
54 | $(Nemerle)\Nemerle.dll
55 | True
56 |
57 |
58 | $(Nemerle)\Nemerle.Linq.dll
59 |
60 |
61 |
62 |
63 |
64 | Code
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | MetaProgramming.Nemerle.Macro
74 | {3bb3e243-467a-42d5-878f-0f1aa26195a5}
75 | False
76 |
77 |
78 |
79 |
88 |
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.Nemerle/Properties/AssemblyInfo.n:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | [assembly: Nemerle.Macro.Resource(@"Properties\Resources.resx")]
6 | [assembly: Nemerle.Macro.Settings(@"Properties\Settings.settings")]
7 |
8 | // General Information about an assembly is controlled through the following
9 | // set of attributes. Change these attribute values to modify the information
10 | // associated with an assembly.
11 | [assembly: AssemblyTitle("MetaProgramming.Nemerle")]
12 | [assembly: AssemblyDescription("")]
13 | [assembly: AssemblyConfiguration("")]
14 | [assembly: AssemblyCompany("")]
15 | [assembly: AssemblyProduct("MetaProgramming.Nemerle")]
16 | [assembly: AssemblyCopyright("Copyright © 2013")]
17 | [assembly: AssemblyTrademark("")]
18 | [assembly: AssemblyCulture("")]
19 |
20 | // Setting ComVisible to false makes the types in this assembly not visible
21 | // to COM components. If you need to access a type in this assembly from
22 | // COM, set the ComVisible attribute to true on that type.
23 | [assembly: ComVisible(false)]
24 |
25 | // The following GUID is for the ID of the typelib if this project is exposed to COM
26 | [assembly: Guid("eee410f7-10df-452f-a2a5-d073ad12efd6")]
27 |
28 | // Version information for an assembly consists of the following four values:
29 | //
30 | // Major Version
31 | // Minor Version
32 | // Build Number
33 | // Revision
34 | //
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.RoslynCTP.Tests/ClassTemplateInfos.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "Name" : "ProcessingModel",
4 | "IsPublic" : true,
5 | "Properties" :
6 | {
7 | "InputA" : "System.Decimal, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
8 | "InputB" : "System.Decimal, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
9 | "Factor" : "System.Decimal, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
10 | "Result" : "System.Nullable`1[[System.Decimal, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
11 | "Delta" : "System.Nullable`1[[System.Decimal, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
12 | "Description" : "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
13 | "Addition" : "System.Nullable`1[[System.Decimal, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
14 | }
15 | },
16 |
17 | {
18 | "Name" : "ReportModel",
19 | "IsPublic" : true,
20 | "Properties" :
21 | {
22 | "Σ" : "System.Nullable`1[[System.Decimal, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
23 | "Δ" : "System.Nullable`1[[System.Decimal, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
24 | "λ" : "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
25 | }
26 | }
27 | ]
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.RoslynCTP.Tests/CodeAsDataTests.ScriptAsData_ConvertJsonToScript_ScriptSubmission.approved.txt:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "Σ": 10.2500,
4 | "Δ": 0.2500,
5 | "λ": "Some description"
6 | },
7 | {
8 | "Σ": 20.0400,
9 | "Δ": 0.0400,
10 | "λ": "Some description"
11 | },
12 | {
13 | "Σ": 12.2250,
14 | "Δ": 0.2250,
15 | "λ": "Some description"
16 | },
17 | {
18 | "Σ": 7.2000,
19 | "Δ": 7.2000,
20 | "λ": "Some description"
21 | }
22 | ]
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.RoslynCTP.Tests/CodeAsDataTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using ApprovalTests;
5 | using ApprovalTests.Reporters;
6 | using MetaProgramming.RoslynCTP.Model;
7 | using Newtonsoft.Json;
8 | using NUnit.Framework;
9 |
10 | namespace MetaProgramming.RoslynCTP.Tests
11 | {
12 | [TestFixture]
13 | [UseReporter(typeof(DiffReporter))]
14 | public class CodeAsDataTests
15 | {
16 | [Test]
17 | public void ScriptAsData_ConvertJsonToScript_ScriptSubmission()
18 | {
19 | // Arrange
20 | // INFO: JSON deserializer
21 | var scriptInfo = JsonConvert.DeserializeObject(File.ReadAllText(@"./ScriptInfo.json"));
22 | var dataClassesInfo = JsonConvert.DeserializeObject(File.ReadAllText(@"./ClassTemplateInfos.json"));
23 | Func deserializeToType = type => JsonConvert.DeserializeObject(File.ReadAllText(@"./InputData.json"), type.MakeArrayType());
24 |
25 | // Act
26 | IEnumerable results = CodeAsData.ProcessScript(scriptInfo, dataClassesInfo, deserializeToType);
27 |
28 | // Assert
29 | Approvals.Verify(JsonConvert.SerializeObject(results, Formatting.Indented));
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.RoslynCTP.Tests/CodeSmells.Samples/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.RoslynCTP.Tests/CodeSmells.Samples/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/akimboyko/MetaProgramming/a07eeccf0f32a5a1f645ffe57e23c715cbcc55a4/MetaProgramming/MetaProgramming.RoslynCTP.Tests/CodeSmells.Samples/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.RoslynCTP.Tests/CodeSmells.Samples/ClassWithExtraComplexity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CodeSmells.Samples
4 | {
5 | public class ClassWithExtraComplexity
6 | {
7 | public string SimpleMethod()
8 | {
9 | return @"Simple Method with Cyclomatic complexity == 1";
10 | }
11 |
12 | public string ComplexMethod()
13 | {
14 | int seed = new Random(DateTime.Now.Millisecond).Next() % 10;
15 |
16 | if (seed == 0)
17 | {
18 | return @"Case 0";
19 | }
20 |
21 | if (seed == 1)
22 | {
23 | return @"Case 1";
24 | }
25 |
26 | if (seed == 2)
27 | {
28 | return @"Case 2";
29 | }
30 |
31 | if (seed == 3)
32 | {
33 | return @"Case 3";
34 | }
35 |
36 | if (seed == 4)
37 | {
38 | return @"Case 4";
39 | }
40 |
41 | if (seed == 5)
42 | {
43 | return @"Case 5";
44 | }
45 |
46 | if (seed == 6)
47 | {
48 | return @"Case 6";
49 | }
50 |
51 | if (seed == 7)
52 | {
53 | return @"Case 7";
54 | }
55 |
56 | if (seed == 8)
57 | {
58 | return @"Case 8";
59 | }
60 |
61 | if (seed == 9)
62 | {
63 | return @"Case 9";
64 | }
65 |
66 | return @"Default case";
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/MetaProgramming/MetaProgramming.RoslynCTP.Tests/CodeSmells.Samples/ClassWithReturnNullMethods.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace CodeSmells.Samples
4 | {
5 | public class ClassWithReturnNullMethods
6 | {
7 | public object ReturnSomeReferenceType()
8 | {
9 | return new object();
10 | }
11 |
12 | public object ReturnNullReferenceType()
13 | {
14 | return null;
15 | }
16 |
17 | public object ReturnDefaultReferenceType()
18 | {
19 | return default(object);
20 | }
21 |
22 | public IEnumerable