@@ -849,8 +849,11 @@ function! s:convert(in, out) abort
849
849
let r = s: StringReader .new (readfile (a: in ))
850
850
let p = s: VimLParser .new ()
851
851
let c = s: JavascriptCompiler .new ()
852
+ call writefile ([' before c.compile(p.parse(r))' ], ' /dev/stderr' )
852
853
let lines = c .compile (p .parse (r ))
854
+ call writefile ([' after c.compile(p.parse(r))' ], ' /dev/stderr' )
853
855
unlet lines [0 : index (lines , ' var NIL = [];' ) - 1 ]
856
+ call writefile ([' len(lines):' , len (lines )], ' /dev/stderr' )
854
857
let tail = [
855
858
\ ' if (require.main === module) {' ,
856
859
\ ' main();' ,
@@ -863,8 +866,12 @@ function! s:convert(in, out) abort
863
866
\ ' };' ,
864
867
\ ' }' ,
865
868
\ ]
869
+ call writefile ([' a:out:' , a: out ], ' /dev/stderr' )
866
870
call writefile (head + lines + tail, a: out )
867
871
catch
872
+ call writefile ([' catch!' ], ' /dev/stderr' )
873
+ call writefile ([v: exception ], ' /dev/stderr' )
874
+ call writefile ([v: throwpoint ], ' /dev/stderr' )
868
875
throw substitute (v: throwpoint , ' \.\.\zs\d\+' , ' \=s:numtoname(submatch(0))' , ' g' ) . " \n " . v: exception
869
876
endtry
870
877
endfunction
@@ -900,13 +907,33 @@ function! s:parse_args() abort
900
907
endfunction :
901
908
902
909
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
+
903
925
try
926
+ call writefile ([' before parse_args' ], ' /dev/stderr' )
904
927
let args = s: parse_args ()
928
+ call writefile ([' args:' ] + args , ' /dev/stderr' )
905
929
call s: convert (args [0 ], args [1 ])
930
+ call writefile ([' after s:convert' ], ' /dev/stderr' )
906
931
catch
907
932
call writefile ([v: exception ], has (' win32' ) ? ' conout$' : ' /dev/stderr' )
933
+ call writefile ([' cquit' ], ' /dev/stderr' )
908
934
cquit
909
935
endtry
936
+ call writefile ([' end main' ], ' /dev/stderr' )
910
937
endfunction
911
938
912
939
call s: main ()
0 commit comments