File tree Expand file tree Collapse file tree 4 files changed +17
-5
lines changed
src/Infrastructure/HydraScript.Infrastructure Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 11using System . Diagnostics . CodeAnalysis ;
22using System . IO . Abstractions ;
33using HydraScript . Domain . FrontEnd . Lexer ;
4+ using Microsoft . Extensions . DependencyInjection ;
45using Microsoft . Extensions . Options ;
56
67namespace HydraScript . Infrastructure . Dumping ;
78
89internal class DumpingLexer (
10+ [ FromKeyedServices ( DecoratorKey . Value ) ]
911 ILexer lexer ,
1012 IFileSystem fileSystem ,
1113 IOptions < InputFile > inputFile ) : ILexer
Original file line number Diff line number Diff line change 11using System . IO . Abstractions ;
22using HydraScript . Domain . FrontEnd . Parser ;
3+ using Microsoft . Extensions . DependencyInjection ;
34
45namespace HydraScript . Infrastructure . Dumping ;
56
6- internal class DumpingParser ( IParser parser , IFileSystem fileSystem ) : IParser
7+ internal class DumpingParser (
8+ [ FromKeyedServices ( DecoratorKey . Value ) ] IParser parser ,
9+ IFileSystem fileSystem ) : IParser
710{
811 public IAbstractSyntaxTree Parse ( string text )
912 {
Original file line number Diff line number Diff line change 11using System . IO . Abstractions ;
22using HydraScript . Domain . BackEnd ;
3+ using Microsoft . Extensions . DependencyInjection ;
34using Microsoft . Extensions . Options ;
45
56namespace HydraScript . Infrastructure . Dumping ;
67
78internal class DumpingVirtualMachine (
9+ [ FromKeyedServices ( DecoratorKey . Value ) ]
810 IVirtualMachine virtualMachine ,
911 IFileSystem fileSystem ,
1012 IOptions < InputFile > inputFile ) : IVirtualMachine
Original file line number Diff line number Diff line change @@ -48,11 +48,16 @@ public static void AddInfrastructure(
4848
4949 if ( dump )
5050 {
51- services . Decorate < ILexer , DumpingLexer > ( ) ;
52- services . Decorate < IParser , DumpingParser > ( ) ;
53- services . Decorate < IVirtualMachine , DumpingVirtualMachine > ( ) ;
51+ services . AddKeyedSingleton < ILexer , RegexLexer > ( DecoratorKey . Value ) ;
52+ services . AddSingleton < ILexer , DumpingLexer > ( ) ;
53+
54+ services . AddKeyedSingleton < IParser , TopDownParser > ( DecoratorKey . Value ) ;
55+ services . AddSingleton < IParser , DumpingParser > ( ) ;
56+
57+ services . AddKeyedSingleton < IVirtualMachine , VirtualMachine > ( DecoratorKey . Value ) ;
58+ services . AddSingleton < IVirtualMachine , DumpingVirtualMachine > ( ) ;
5459 }
5560
5661 services . AddSingleton < Executor > ( ) ;
5762 }
58- }
63+ }
You can’t perform that action at this time.
0 commit comments