private ObjectLiteral EvaluateConfigObjectLiteral(FileModuleLiteral moduleLiteral, ObjectLiteral configObjectLiteral) { // Instantiate config module, and because config is qualifier-agnositic, it is instantiated with empty qualifier. var instantiatedModule = InstantiateModuleWithDefaultQualifier(moduleLiteral); // Decide here whether to use decoration for the config evaluation phase. // Let's say no decorators allowed at this stage. IDecorator <EvaluationResult> decoratorForConfig = null; // Create an evaluation context tree and root context. using (var contextTree = CreateContext(instantiatedModule, decoratorForConfig, EvaluatorConfigurationForConfig, FileType.GlobalConfiguration)) { var context = contextTree.RootContext; if (instantiatedModule.IsEmpty) { return(null); } // Note: Blocking on evaluation var success = instantiatedModule.EvaluateAllAsync(context, VisitedModuleTracker.Disabled).GetAwaiter().GetResult(); if (!success) { // Error has been reported during the evaluation. return(null); } return(configObjectLiteral == null?ResolveConfigObjectLiteral(instantiatedModule, context) : (ObjectLiteral)configObjectLiteral.Merge(context, EvaluationStackFrame.UnsafeFrom(new EvaluationResult[0]), new EvaluationResult(ResolveConfigObjectLiteral(instantiatedModule, context))).Value); } }