public BuildTargetAdvanced(BuildTargetSimple buildTargetSimple, ITranspileCommand transpileCommand, IBuildScopeCommand buildScopeCommand, IWriteCommand writeCommand) { this.buildTargetSimple = buildTargetSimple; this.transpileCommand = transpileCommand; this.buildScopeCommand = buildScopeCommand; this.writeCommand = writeCommand; }
public static BuildTargetAdvanced ConstructAdvanced(BuildTargetSimple buildTarget, BuildLogServiceCollection buildLogServices, ESMAnalyzer esmAnalyzer, TES5TypeInferencer typeInferencer) { switch (buildTarget.Name) { case StandaloneName: { StandaloneParsingService standaloneParsingService = new StandaloneParsingService(new SyntaxErrorCleanParser(new TES4OBScriptGrammar())); return(new BuildTargetAdvanced(buildTarget, new Standalone.TranspileCommand(standaloneParsingService, buildLogServices.MetadataLogService, esmAnalyzer), new Standalone.BuildScopeCommand(standaloneParsingService, esmAnalyzer, new TES5PropertyFactory(esmAnalyzer)), new Standalone.WriteCommand())); } case TIFName: { FragmentsParsingService fragmentsParsingService = new FragmentsParsingService(new SyntaxErrorCleanParser(new TES4ObscriptCodeGrammar())); return(new BuildTargetAdvanced(buildTarget, new TIF.TranspileCommand(fragmentsParsingService, buildLogServices.MetadataLogService, esmAnalyzer), new TIF.BuildScopeCommand(new TES5PropertyFactory(esmAnalyzer), new FragmentsReferencesBuilder(esmAnalyzer)), new TIF.WriteCommand())); } case PFName: { return(new BuildTargetAdvanced(buildTarget, new PF.TranspileCommand(), new PF.BuildScopeCommand(), new PF.WriteCommand())); } case QFName: { FragmentsParsingService fragmentsParsingService = new FragmentsParsingService(new SyntaxErrorCleanParser(new TES4ObscriptCodeGrammar())); TES5ObjectCallFactory objectCallFactory = new TES5ObjectCallFactory(typeInferencer); TES5ObjectPropertyFactory objectPropertyFactory = new TES5ObjectPropertyFactory(typeInferencer); TES5ReferenceFactory referenceFactory = new TES5ReferenceFactory(objectCallFactory, objectPropertyFactory, esmAnalyzer); TES5ValueFactory valueFactory = new TES5ValueFactory(objectCallFactory, referenceFactory, esmAnalyzer); TES5ObjectCallArgumentsFactory objectCallArgumentsFactory = new TES5ObjectCallArgumentsFactory(valueFactory); TES5ValueFactoryFunctionFiller.FillFunctions(valueFactory, objectCallFactory, objectCallArgumentsFactory, referenceFactory, objectPropertyFactory, buildLogServices.MetadataLogService, esmAnalyzer); TES5VariableAssignationConversionFactory assignationConversionFactory = new TES5VariableAssignationConversionFactory(objectCallFactory, referenceFactory, valueFactory, typeInferencer); TES5ReturnFactory returnFactory = new TES5ReturnFactory(objectCallFactory); TES5ChainedCodeChunkFactory chainedCodeChunkFactory = new TES5ChainedCodeChunkFactory(valueFactory, returnFactory, assignationConversionFactory); TES5FragmentFactory fragmentFactory = new TES5FragmentFactory(chainedCodeChunkFactory); ObjectiveHandlingFactory objectiveHandlingFactory = new ObjectiveHandlingFactory(objectCallFactory); QFFragmentFactory qfFragmentFactory = new QFFragmentFactory(buildLogServices.MappedTargetsLogService, objectiveHandlingFactory, esmAnalyzer); QF.WriteCommand writeCommand = new QF.WriteCommand(qfFragmentFactory); return(new BuildTargetAdvanced(buildTarget, new QF.TranspileCommand(fragmentsParsingService, fragmentFactory), new QF.BuildScopeCommand(new TES5PropertyFactory(esmAnalyzer), new FragmentsReferencesBuilder(esmAnalyzer)), writeCommand)); } default: { throw new InvalidOperationException("Unknown target " + buildTarget.Name); } } }