From 72ba85b3af4dbfc6019fd0d18c17278cb611b641 Mon Sep 17 00:00:00 2001 From: Futago-za Ryuu Date: Thu, 22 Mar 2018 00:07:53 +0000 Subject: [PATCH] Use 'visitor.on' instead of 'visitor.for' --- lib/ast/visitor.js | 2 +- lib/typings/api.d.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/ast/visitor.js b/lib/ast/visitor.js index 198b5e1..4148331 100644 --- a/lib/ast/visitor.js +++ b/lib/ast/visitor.js @@ -40,7 +40,7 @@ module.exports = { }; // Helper's to create visitor's for use with the ASTVisitor class -const on = ASTVisitor.for = { +const on = ASTVisitor.on = { // Visit a node that is defined as a property on another node property( name ) { diff --git a/lib/typings/api.d.ts b/lib/typings/api.d.ts index b9c4968..f08e728 100644 --- a/lib/typings/api.d.ts +++ b/lib/typings/api.d.ts @@ -317,7 +317,15 @@ declare namespace peg { } + interface IOn { + + property( name: string ): IVisitor; + children( name: string ): IVisitor; + + } + const build: IVisitorBuilder; + const on: IFor; } @@ -325,6 +333,7 @@ declare namespace peg { ASTVisitor: visitor.ASTVisitor; build: visitor.IVisitorBuilder; + on: visitor.IOn; }