Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | 1x 1x 1x 1x 1x | import React from 'react'; import Node from '../../components/Node'; import * as P from 'pretty-fast-pretty-printer'; import * as Spec from '../../nodeSpec'; import {ASTNode, pluralize} from '../../ast'; export class LetLikeExpr extends ASTNode { constructor(from, to, form, bindings, expr, options={}) { super(from, to, 'letLikeExpr', options); this.form = form; this.bindings = bindings; this.expr = expr; } static spec = Spec.nodeSpec([ Spec.value('form'), Spec.required('bindings'), Spec.required('expr') ]) longDescription(_level) { return `a ${this.form} expression with ${pluralize("binding", this.bindings.exprs)}`; } pretty() { return P.lambdaLikeSexpr(this.form, P.brackets(this.bindings), this.expr); } render(props) { return ( <Node node={this} {...props}> <span className="blocks-operator">{this.form}</span> {this.bindings.reactElement()} {this.expr.reactElement()} </Node> ); } } export class WhenUnless extends ASTNode { constructor(from, to, form, predicate, exprs, options={}) { super(from, to, 'whenUnlessExpr', options); this.form = form; this.predicate = predicate; this.exprs = exprs; } static spec = Spec.nodeSpec([ Spec.value('form'), Spec.required('predicate'), Spec.required('exprs') ]) longDescription(level) { return `a ${this.form} expression: ${this.form} ${this.predicate.describe(level)}, ${this.exprs.describe(level)}`; } pretty() { return P.standardSexpr(this.form, [this.predicate, this.exprs]); } render(props) { return ( <Node node={this} {...props}> <span className="blocks-operator">{this.form}</span> {this.predicate.reactElement()} {this.exprs.reactElement()} </Node> ); } } |