From 9219f3b7756f09a12ec684edaa109b484728615c Mon Sep 17 00:00:00 2001 From: mistlog Date: Mon, 27 Jan 2020 12:36:18 +0800 Subject: [PATCH] init path --- package.json | 2 +- source-view/code-object/module.md | 2 ++ src/code-object/module.tsx | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 3aaf3b3..0bd590b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typedraft", - "version": "0.1.9", + "version": "0.1.10", "description": "TypeDraft is a superset of typescript with built-in support for DSL extension and literate programming.", "keywords": [ "literate programming", diff --git a/source-view/code-object/module.md b/source-view/code-object/module.md index d2b844b..a9ce4f4 100644 --- a/source-view/code-object/module.md +++ b/source-view/code-object/module.md @@ -61,8 +61,10 @@ As we are only interested in the draft part of a module, then we need a way to r + function ToDraft(this: ModuleCode) { let draft: Draft = []; + const that = this; const visitor: Visitor = { Program(path) { + that.m_Path = path; path.get("body").forEach(path => { ; }); diff --git a/src/code-object/module.tsx b/src/code-object/module.tsx index b47fb11..69093f5 100644 --- a/src/code-object/module.tsx +++ b/src/code-object/module.tsx @@ -72,9 +72,11 @@ As we are only interested in the draft part of a module, then we need a way to r { let draft: Draft = []; + const that = this; const visitor: Visitor = { Program(path) { + that.m_Path = path; path.get("body").forEach(path => { //@ts-ignore