示例#1
0
        public async Task InspectAsync(IRVisClient rVisClient)
        {
            if (_pathToContainingDirectory.IsntAString())
            {
                SetUpStaging();
            }
            RequireDirectory(_pathToContainingDirectory);
            var pathToCode = Combine(_pathToContainingDirectory, _codeFileName);

            await rVisClient.ClearAsync();

            var inspection = await rVisClient.InspectSymbolsAsync(pathToCode);

            SymbolInfos = inspection.ToArr();

            UnaryFunctions = SymbolInfos
                             .Filter(si =>
                                     si.Level == 0 &&
                                     si.Symbol.IsAString() &&
                                     si.SymbolType == SymbolType.Function &&
                                     si.Length == 1)
                             .OrderBy(si => si.Symbol)
                             .ToArr();

            Scalars = SymbolInfos
                      .Filter(si =>
                              si.Level == 0 &&
                              si.Symbol.IsAString() &&
                              si.SymbolType == SymbolType.Vector &&
                              si.Length == 1 &&
                              si.Scalar.HasValue)
                      .OrderBy(si => si.Symbol)
                      .ToArr();

            ScalarSets = SymbolInfos
                         .Filter(si =>
                                 si.Level == 0 &&
                                 si.Symbol.IsAString() &&
                                 (si.SymbolType == SymbolType.Vector || si.SymbolType == SymbolType.List) &&
                                 si.Names?.Length > 1 &&
                                 si.Value?.NRows == 1)
                         .OrderBy(si => si.Symbol)
                         .ToArr();

            DataSets = SymbolInfos
                       .Filter(si =>
                               si.Level == 0 &&
                               si.Value?.ColumnNames.All(cn => cn.IsAString()) == true &&
                               si.Value?.NRows > 1)
                       .OrderBy(si => si.Symbol)
                       .ToArr();

            ParameterCandidates = Scalars.Map(s => new ParameterCandidate(s));

            ValueCandidates = DataSets.Map(ds => new ValueCandidate(ds, SymbolInfos));
        }