Exemple #1
0
        private HashSet <CollectionName> ExecuteCodeAndCollectReferencedCollections(string code, string additionalSources)
        {
            var javascriptParser = new JavaScriptParser(code, DefaultParserOptions);
            var program          = javascriptParser.ParseProgram();

            _engine.ExecuteWithReset(program);
            var loadVisitor = new EsprimaReferencedCollectionVisitor();

            if (string.IsNullOrEmpty(additionalSources) == false)
            {
                loadVisitor.Visit(new JavaScriptParser(additionalSources, DefaultParserOptions).ParseProgram());
            }

            loadVisitor.Visit(program);
            return(loadVisitor.ReferencedCollection);
        }
Exemple #2
0
        private HashSet <CollectionName> ExecuteCodeAndCollectReferencedCollections(string code)
        {
            var javascriptParser = new JavaScriptParser(code, DefaultParserOptions);
            var program          = javascriptParser.ParseProgram();

            _engine.ExecuteWithReset(program);
            var loadVisitor = new EsprimaReferencedCollectionVisitor();

            loadVisitor.Visit(program);
            return(loadVisitor.ReferencedCollection);
        }
Exemple #3
0
        private MapMetadata ExecuteCodeAndCollectReferencedCollections(string code, string additionalSources)
        {
            var javascriptParser = new JavaScriptParser(code, DefaultParserOptions);
            var program          = javascriptParser.ParseScript();

            _engine.ExecuteWithReset(program);
            var loadVisitor = new EsprimaReferencedCollectionVisitor();

            if (string.IsNullOrEmpty(additionalSources) == false)
            {
                loadVisitor.Visit(new JavaScriptParser(additionalSources, DefaultParserOptions).ParseScript());
            }

            loadVisitor.Visit(program);
            return(new MapMetadata
            {
                ReferencedCollections = loadVisitor.ReferencedCollection,
                HasCompareExchangeReferences = loadVisitor.HasCompareExchangeReferences
            });
        }