public TES5VariableAssignationConversionFactory(TES5ObjectCallFactory objectCallFactory, TES5ReferenceFactory referenceFactory, TES5ValueFactory valueFactory, TES5TypeInferencer typeInferencer)
 {
     this.objectCallFactory = objectCallFactory;
     this.referenceFactory  = referenceFactory;
     this.valueFactory      = valueFactory;
     this.typeInferencer    = typeInferencer;
 }
 public TES5ChainedCodeChunkFactory(TES5ValueFactory valueFactory, TES5ReturnFactory returnFactory, TES5VariableAssignationConversionFactory variableAssignationConversionFactory)
 {
     this.valueFactory  = valueFactory;
     this.returnFactory = returnFactory;
     this.variableAssignationConversionFactory = variableAssignationConversionFactory;
 }
Beispiel #3
0
        public static TES5CodeChunkCollection CreateCodeChunk(TES4Branch chunk, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope, TES5ChainedCodeChunkFactory codeChunkFactory, TES5ValueFactory valueFactory)
        {
            TES5SubBranch     mainBranch = ConvertSubBranch(chunk.MainBranch, codeScope, globalScope, multipleScriptsScope, codeChunkFactory, valueFactory);
            TES4SubBranchList branchList = chunk.ElseifBranches;
            TES5SubBranchList convertedElseIfBranches = null;

            if (branchList != null)
            {
                convertedElseIfBranches = new TES5SubBranchList();
                foreach (TES4SubBranch subBranch in branchList.Branches)
                {
                    convertedElseIfBranches.Add(ConvertSubBranch(subBranch, codeScope, globalScope, multipleScriptsScope, codeChunkFactory, valueFactory));
                }
            }

            TES4ElseSubBranch elseBranch          = chunk.ElseBranch;
            TES5ElseSubBranch convertedElseBranch = null;

            if (elseBranch != null)
            {
                convertedElseBranch = ConvertElseBranch(elseBranch, codeScope, globalScope, multipleScriptsScope, codeChunkFactory);
            }

            return(new TES5CodeChunkCollection()
            {
                new TES5Branch(mainBranch, convertedElseIfBranches, convertedElseBranch)
            });
        }
Beispiel #4
0
        private static TES5SubBranch ConvertSubBranch(TES4SubBranch branch, TES5CodeScope outerCodeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope, TES5ChainedCodeChunkFactory codeChunkFactory, TES5ValueFactory valueFactory)
        {
            ITES5Value     expression   = valueFactory.CreateValue(branch.Expression, outerCodeScope, globalScope, multipleScriptsScope);
            TES5CodeScope  newCodeScope = TES5CodeScopeFactory.CreateCodeScopeRecursive(outerCodeScope.LocalScope);
            TES4CodeChunks branchChunks = branch.CodeChunks;

            if (branchChunks != null)
            {
                foreach (ITES4CodeChunk codeChunk in branchChunks)
                {
                    TES5CodeChunkCollection codeChunks = codeChunkFactory.createCodeChunk(codeChunk, newCodeScope, globalScope, multipleScriptsScope);
                    if (codeChunks != null)
                    {
                        foreach (ITES5CodeChunk newCodeChunk in codeChunks)
                        {
                            newCodeScope.AddChunk(newCodeChunk);
                        }
                    }
                }
            }

            return(new TES5SubBranch(expression, newCodeScope));
        }
 public TES5ObjectCallArgumentsFactory(TES5ValueFactory factory)
 {
     this.valueFactory = factory;
 }