File tree Expand file tree Collapse file tree 5 files changed +7
-19
lines changed
src/Infrastructure/HydraScript.Infrastructure Expand file tree Collapse file tree 5 files changed +7
-19
lines changed Original file line number Diff line number Diff line change @@ -10,17 +10,15 @@ internal class DumpingLexer(
1010 [ FromKeyedServices ( DecoratorKey . Value ) ]
1111 ILexer lexer ,
1212 IFileSystem fileSystem ,
13- IOptions < InputFile > inputFile ) : ILexer
13+ IOptions < FileInfo > inputFile ) : ILexer
1414{
15- private readonly InputFile _inputFile = inputFile . Value ;
16-
1715 [ ExcludeFromCodeCoverage ]
1816 public IStructure Structure => lexer . Structure ;
1917
2018 public List < Token > GetTokens ( string text )
2119 {
2220 var tokens = lexer . GetTokens ( text ) ;
23- var fileName = _inputFile . Info . Name . Split ( ".js" ) [ 0 ] ;
21+ var fileName = inputFile . Value . Name . Split ( ".js" ) [ 0 ] ;
2422 fileSystem . File . WriteAllText (
2523 $ "{ fileName } .tokens",
2624 lexer . ToString ( ) ) ;
Original file line number Diff line number Diff line change @@ -9,15 +9,13 @@ internal class DumpingVirtualMachine(
99 [ FromKeyedServices ( DecoratorKey . Value ) ]
1010 IVirtualMachine virtualMachine ,
1111 IFileSystem fileSystem ,
12- IOptions < InputFile > inputFile ) : IVirtualMachine
12+ IOptions < FileInfo > inputFile ) : IVirtualMachine
1313{
14- private readonly InputFile _inputFile = inputFile . Value ;
15-
1614 public IExecuteParams ExecuteParams => virtualMachine . ExecuteParams ;
1715
1816 public void Run ( AddressedInstructions instructions )
1917 {
20- var fileName = _inputFile . Info . Name . Split ( ".js" ) [ 0 ] ;
18+ var fileName = inputFile . Value . Name . Split ( ".js" ) [ 0 ] ;
2119 fileSystem . File . WriteAllLines (
2220 $ "{ fileName } .tac",
2321 instructions . Select ( i => i . ToString ( ) ! ) ) ;
Original file line number Diff line number Diff line change @@ -10,13 +10,11 @@ public interface ISourceCodeProvider
1010
1111internal class SourceCodeProvider (
1212 IFileSystem fileSystem ,
13- IOptions < InputFile > inputFile ) : ISourceCodeProvider
13+ IOptions < FileInfo > inputFile ) : ISourceCodeProvider
1414{
15- private readonly InputFile _inputFile = inputFile . Value ;
16-
1715 public string GetText ( )
1816 {
19- var inputFilePath = _inputFile . Info . FullName ;
17+ var inputFilePath = inputFile . Value . FullName ;
2018 return fileSystem . File . ReadAllText ( inputFilePath ) ;
2119 }
2220}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ public static IServiceCollection AddInfrastructure(
3939 FileInfo inputFileInfo )
4040 {
4141 services . AddSingleton < IFileSystem , FileSystem > ( ) ;
42- services . AddSingleton ( Options . Create ( new InputFile { Info = inputFileInfo } ) ) ;
42+ services . AddSingleton ( Options . Create ( inputFileInfo ) ) ;
4343
4444 services . AddSingleton < IStaticAnalyzer , StaticAnalyzer > ( ) ;
4545 services . AddSingleton < ICodeGenerator , CodeGenerator > ( ) ;
You can’t perform that action at this time.
0 commit comments