Skip to content

Commit c9f5a12

Browse files
committed
debug: add printf
1 parent 4ad8ba4 commit c9f5a12

File tree

5 files changed

+49
-15
lines changed

5 files changed

+49
-15
lines changed

.travis.yml

+12-10
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,23 @@ git:
66
matrix:
77
include:
88
- env:
9-
- VIM_VERSION=v7.4
10-
- MAKE_TARGET=test
11-
- TEST_PROFILE=vim-profile-v7.4.txt
12-
- env:
13-
- VIM_VERSION=v8.0.0000
14-
- MAKE_TARGET=test
15-
- TEST_PROFILE=vim-profile-v8.0.txt
9+
# - VIM_VERSION=v7.4
10+
# - MAKE_TARGET=test
11+
# - TEST_PROFILE=vim-profile-v7.4.txt
12+
# - env:
13+
# - VIM_VERSION=v8.0.0000
14+
# - MAKE_TARGET=test
15+
# - TEST_PROFILE=vim-profile-v8.0.txt
16+
# - env:
17+
# - VIM_VERSION=master
18+
# - MAKE_TARGET=test
19+
# - TEST_PROFILE=vim-profile-master.txt
1620
- env:
1721
- VIM_VERSION=master
18-
- MAKE_TARGET=test
19-
- TEST_PROFILE=vim-profile-master.txt
22+
- MAKE_TARGET="clean_compiled check js/test py/test test/node_position/test_position.out"
2023
- env:
2124
- VIM_VERSION=installed
2225
- MAKE_TARGET="clean_compiled check js/test py/test test/node_position/test_position.out"
23-
- TEST_PROFILE=vim-profile-installed.txt
2426

2527
install:
2628
- |

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ COMPILED_FILES:=js/vimlparser.js py/vimlparser.py
33
all: $(COMPILED_FILES)
44

55
js/vimlparser.js: autoload/vital/__vimlparser__/VimlParser.vim js/jscompiler.vim js/vimlfunc.js
6+
echo 'make: before: scripts/jscompile.sh'
67
scripts/jscompile.sh $< $@
8+
echo 'amake: fter: scripts/jscompile.sh'
79

810
py/vimlparser.py: autoload/vital/__vimlparser__/VimlParser.vim py/pycompiler.vim py/vimlfunc.py
911
scripts/pycompile.sh $< $@

autoload/vital/vimlparser.vim

+4-4
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ let s:Vital._import = s:_function('s:_import')
183183
" s:_get_module() returns module object wihch has all script local functions.
184184
function! s:_get_module(name) abort dict
185185
let funcname = s:_import_func_name(self.plugin_name(), a:name)
186-
try
187-
return call(funcname, [])
188-
catch /^Vim\%((\a\+)\)\?:E117/
186+
" try
187+
" return call(funcname, [])
188+
" catch /^Vim\%((\a\+)\)\?:E117/
189189
return s:_get_builtin_module(a:name)
190-
endtry
190+
" endtry
191191
endfunction
192192

193193
function! s:_get_builtin_module(name) abort

js/jscompiler.vim

+27
Original file line numberDiff line numberDiff line change
@@ -849,8 +849,11 @@ function! s:convert(in, out) abort
849849
let r = s:StringReader.new(readfile(a:in))
850850
let p = s:VimLParser.new()
851851
let c = s:JavascriptCompiler.new()
852+
call writefile(['before c.compile(p.parse(r))'], '/dev/stderr')
852853
let lines = c.compile(p.parse(r))
854+
call writefile(['after c.compile(p.parse(r))'], '/dev/stderr')
853855
unlet lines[0 : index(lines, 'var NIL = [];') - 1]
856+
call writefile(['len(lines):', len(lines)], '/dev/stderr')
854857
let tail = [
855858
\ 'if (require.main === module) {',
856859
\ ' main();',
@@ -863,8 +866,12 @@ function! s:convert(in, out) abort
863866
\ ' };',
864867
\ '}',
865868
\ ]
869+
call writefile(['a:out:', a:out], '/dev/stderr')
866870
call writefile(head + lines + tail, a:out)
867871
catch
872+
call writefile(['catch!'], '/dev/stderr')
873+
call writefile([v:exception], '/dev/stderr')
874+
call writefile([v:throwpoint], '/dev/stderr')
868875
throw substitute(v:throwpoint, '\.\.\zs\d\+', '\=s:numtoname(submatch(0))', 'g') . "\n" . v:exception
869876
endtry
870877
endfunction
@@ -900,13 +907,33 @@ function! s:parse_args() abort
900907
endfunction:
901908

902909
function! s:main() abort
910+
call writefile(['called main'], '/dev/stderr')
911+
912+
try
913+
call writefile(['try without error'], '/dev/stderr')
914+
catch
915+
call writefile(['catch 1'], '/dev/stderr')
916+
endtry
917+
918+
try
919+
call writefile(['try w/ error'], '/dev/stderr')
920+
throw 'debug error!'
921+
catch
922+
call writefile(['catch debug error'], '/dev/stderr')
923+
endtry
924+
903925
try
926+
call writefile(['before parse_args'], '/dev/stderr')
904927
let args = s:parse_args()
928+
call writefile(['args:'] + args, '/dev/stderr')
905929
call s:convert(args[0], args[1])
930+
call writefile(['after s:convert'], '/dev/stderr')
906931
catch
907932
call writefile([v:exception], has('win32') ? 'conout$' : '/dev/stderr')
933+
call writefile(['cquit'], '/dev/stderr')
908934
cquit
909935
endtry
936+
call writefile(['end main'], '/dev/stderr')
910937
endfunction
911938

912939
call s:main()

scripts/jscompile.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
#!/bin/sh
2-
vim -E -s -N --cmd 'set rtp+=.' -c 'exe "so" argv()[0]' -c q -- js/jscompiler.vim $*
2+
echo 'before jscompiler.vim'
3+
vim -E -s -N --cmd 'set rtp+=.' -c 'exe "so" argv()[0]' -c qa -- js/jscompiler.vim $*
4+
echo $?
5+
echo 'after jscompiler.vim'

0 commit comments

Comments
 (0)