All files / src/core wall.ts

100% Statements 14/14
100% Branches 0/0
100% Functions 2/2
100% Lines 14/14
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 29  15x 15x 15x 15x 15x 15x 15x         18x 18x             18x 5x   18x   15x 15x    
import Clause from "../models/Clause";
import coerceIntoClause from "../utils/coerceIntoClause";
import { cat, ExprClause } from "./regex";
import fclause from './fclause';
import walk from '../walk';
 
export const WallFnClause = fclause( {
  args: cat( ExprClause ),
  ret: ExprClause,
} );
 
function wallOp( expr ) {
  var clause = coerceIntoClause( expr );
  var wallS = new Clause( {
    type: 'WALL',
    exprs: [ clause ],
    opts: { enclosedClause: clause },
    conformFn: null,
    generateFn: null
  } );
  wallS.conform = function andConform( x ) {
    return walk( wallS, x, { conform: true } );
  }
  return wallS;
}
 
const wall = WallFnClause.instrument( wallOp );
export default wall;