Example #1
0
        private DslContainer Initialize(DslContainer dslContainer)
        {
            var swTotal = Stopwatch.StartNew();
            var nodes   = _dslParser.GetConcepts();

            var swConvert      = Stopwatch.StartNew();
            var parsedConcepts = ConceptInfoHelper.ConvertNodesToConceptInfos(nodes);

            _performanceLogger.Write(swConvert, nameof(ConceptInfoHelper.ConvertNodesToConceptInfos));

            var alternativeInitializationGeneratedReferences = InitializeAlternativeInitializationConcepts(parsedConcepts);

            var swFirstAdd = Stopwatch.StartNew();

            dslContainer.AddNewConceptsAndReplaceReferences(new[] { CreateInitializationConcept() });
            dslContainer.AddNewConceptsAndReplaceReferences(parsedConcepts);
            dslContainer.AddNewConceptsAndReplaceReferences(alternativeInitializationGeneratedReferences);
            _performanceLogger.Write(swFirstAdd, $"Initialize: First AddNewConceptsAndReplaceReferences ({dslContainer.Concepts.Count()} concepts).");

            ExpandMacroConcepts(dslContainer);
            CheckSemantics(dslContainer);
            dslContainer.SortReferencesBeforeUsingConcept(_buildOptions.InitialConceptsSort);
            ReportObsoleteConcepts(dslContainer);
            _dslModelFile.SaveConcepts(dslContainer.Concepts);

            _performanceLogger.Write(swTotal, $"Initialize ({dslContainer.Concepts.Count()} concepts).");
            return(dslContainer);
        }