All files / src/core fclause.ts

85.71% Statements 24/28
53.85% Branches 7/13
80% Functions 8/10
91.67% Lines 22/24
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28  15x 15x     15x 15x 15x 15x     15x 15x 15x 15x 15x   279x 279x 279x             279x 210x
import Clause from "../models/Clause";
import walk from "../walk";
import fnName from "../utils/fnName";

class FClause extends Clause{
  constructor(fnClause) {
    const { args, ret, fn } = fnClause;
    super( {
      type: 'FCLAUSE',
      exprs: [],
      opts: fnClause,
      conformFn: null,
      generateFn: null
    } );
    this.instrumentConformed = function instrumentConformed( fn ) {
      return walk( this, fn, { conform: true, instrument: true } );
    };
    this.instrument = function instrument( fn ) {
      return walk( this, fn, { conform: false, instrument: true } );
    };
  };
  instrumentConformed: Function;
  instrument: Function;
}
 
export default function fclause( fnClause ) {
  return new FClause(fnClause);
}