UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

37 lines 1.26 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.expressionList = void 0; const post_process_1 = require("./post-process"); const visitor_1 = require("../../../../r-bridge/lang-4.x/ast/model/processing/visitor"); const type_1 = require("../../../../r-bridge/lang-4.x/ast/model/type"); const initialExpressionListInfo = { allExpressionLists: 0, deepestNesting: 0 }; function visitLists(info, input) { let nest = -1; // we start with nesting 0 let total = 0; (0, visitor_1.visitAst)(input.normalizedRAst.ast, node => { if (node.type === type_1.RType.ExpressionList) { nest++; total++; info.deepestNesting = Math.max(info.deepestNesting, nest); } }, node => { if (node.type === type_1.RType.ExpressionList) { nest--; } }); info.allExpressionLists += total; } exports.expressionList = { name: 'Expression Lists', description: 'Counts expression list nestings', process(existing, input) { visitLists(existing, input); return existing; }, initialValue: initialExpressionListInfo, postProcess: post_process_1.postProcess }; //# sourceMappingURL=statistics-expression-list.js.map