@@ -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
870877endfunction
@@ -900,13 +907,33 @@ function! s:parse_args() abort
900907endfunction :
901908
902909function ! 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' )
910937endfunction
911938
912939call s: main ()
0 commit comments