<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><p style="margin: 0.0px 0.0px 0.0px 0.0px">Change 20080818-dda-Z by <a href="mailto:dda@lester.local">dda@lester.local</a> on 2008-08-18 14:43:32 EDT</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>in /Users/dda/laszlo/src/svn/openlaszlo/trunk-a</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>for <a href="http://svn.openlaszlo.org/openlaszlo/trunk">http://svn.openlaszlo.org/openlaszlo/trunk</a></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">Summary: SWF9: line number fixes for error messages</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">New Features:</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">Bugs Fixed: LPP-6576 [Syntax error without reporting file name or line number w/ 4.1]</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">Technical Reviewer: ptw (pending)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">QA Reviewer: (pending)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">Doc Reviewer: (pending)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">Documentation:</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">Release Notes:</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">Details:</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>Multiple fixes for line number error messages.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>First - line number information was being suppressed unless debug was on.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>This can make sense for debugging information, but some line number info</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>is needed to remap error messages from generated .as files back to original</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>file/line numbers.<span class="Apple-converted-space"> </span>The suppression was previously added since building LFC with</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>full linenumber info can blow up memory in the unparser (the line number info in the</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>unparsed strings can get very long as they are replicated over and over in the</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>bottom up unparser (*)).<span class="Apple-converted-space"> </span>Now we force 'trackLines' to true when not building LFC.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>Second - we are careful when we emit: '/* -*- file: foo.lzx#123 -*- */' source locators</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>that are used for the IDE debugger.<span class="Apple-converted-space"> </span>It turns out that we need to save</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>additional line number information to be used for translating error messages.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>In the test program given by this Jira, the code that had the error did not</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>correspond to a user input line number (it was an error in lps/components/rpc/rpc.lzx),</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>the debugger was not told about that line.<span class="Apple-converted-space"> </span>But the error message still needs to be</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>translated.<span class="Apple-converted-space"> </span>Now we separate the decision of whether to save line number info</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>for translating error messages vs emitting line number info for the debugger.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>Third - there was a tacit assumption on my part that each .as file (i.e. class)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>generated had source mainly from a single input file. <span class="Apple-converted-space"> </span>This is not true, for</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>one example, the LzApplication class can contain code from many sources.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>Now, the line number mapping in TranslationUnit contains both a source file name</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>and a source file line number.<span class="Apple-converted-space"> </span>In anticipation of future work (see below), I</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>encapsulated a source file name into an object along with a SourceFileMap</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>that allows us to give each source file a unique index within</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>the compilation.<span class="Apple-converted-space"> </span>This could make for some shorthand notations for file names</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>used internally.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>(*) Potentially we could fix the out of memory errors by rewriting the unparser to not build up its result using</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>Strings with 'annotated' line numbers but use a more structured output.<span class="Apple-converted-space"> </span>Possible future work.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>Or, the annotated strings could become much shorter by using our new source file indices.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>In addition, this changeset has a way to dump line number annotations, and introduces an option</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>to consolidate outputs used for debugging the compiler.<span class="Apple-converted-space"> </span>Now, in addition to saving script files via</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>lzc -S foo.lzx, one can use lzc -SS foo.lzx to generate several files (all named beginning with "NAME-" for</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>input file "NAME.lzx") that are useful for debugging the compiler:</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><span class="Apple-converted-space"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>NAME-astin-N.txt<span class="Apple-converted-space"> </span>dumped AST input to the generator (N chosen uniquely)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>NAME-astout-N.txt <span class="Apple-converted-space"> </span>dumped AST output from the generator</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>NAME-lineann-N.txt<span class="Apple-converted-space"> </span>line annotations</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>NAME.lzs<span class="Apple-converted-space"> </span>script file</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><span class="Apple-converted-space"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>Changes by file:</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>SourceFile.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>SourceFileMap.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>new files</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>encapsulate source file names, assigning a unique index for each</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><span class="Apple-converted-space"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>CommonGenerator.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>Create a SourceFileMap to be used during the compilation</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><span class="Apple-converted-space"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>SWF9Generator.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>JavascriptGenerator.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>Use the SourceFileMap with ParseTreePrinter</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>Pass the dumpLineAnnotations option to ParseTreePrinter</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>turn on trackLines appropriately (SWF9Generator.java)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><span class="Apple-converted-space"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>SWF9External.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>Show file and line number from error mapped by TranslationUnit.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><span class="Apple-converted-space"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>TranslationUnit.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>Track both filenames (SourceFiles) and line numbers in the</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>line number mapping.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><span class="Apple-converted-space"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>compiler/Main.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>Implement -SS option</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><span class="Apple-converted-space"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>SWF9ParseTreePrinter.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>implement dumpAnnotationsFile option</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><span class="Apple-converted-space"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>ParseTreePrinter.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>implement dumpAnnotationsFile option</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>Break out the decision to emit source locations for debugger use</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>and tell TranslationUnit about line number info that can be used</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>for mapping error messages.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>Fixed error where 'previous' line number was given to translation unit.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><span class="Apple-converted-space"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>sc/Compiler.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>implement unique numbered file for debug output</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>e.g. -dumpASTInput='foo-*.txt' will dump to</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>foo-1.txt, then foo-2.txt, etc.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>This is convenient when there are multiple calls to the compiler</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">Tests:</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>-<span class="Apple-converted-space"> </span>Backported this change to r10708, which includes the mistake in rpc,</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>and tried the test case from LPP-6834, and get the error line:</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>org.openlaszlo.sc.CompilerError: rpc/rpc.lzx: 202: Error: Access of undefined property LzJavaRPCService, in line: return LzJavaRPCService</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>-<span class="Apple-converted-space"> </span>Used the same test case in the current tree, but inserted an error (call to undefined 'stuff()',</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>and got a valid error message and accurate file and line .</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>-<span class="Apple-converted-space"> </span>Tried nexb619.lzx to verify that source locations for debugger are unaffected.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>-<span class="Apple-converted-space"> </span>smokecheck SWF8, DHTML</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>-<span class="Apple-converted-space"> </span>weather+lzpix<span class="Apple-converted-space"> </span>ALL</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px"><span class="Apple-converted-space"> </span>-<span class="Apple-converted-space"> </span>hello <span class="Apple-converted-space"> </span>SWF9</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">Files:</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">A<span class="Apple-converted-space"> </span>WEB-INF/lps/server/src/org/openlaszlo/sc/SourceFile.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">M<span class="Apple-converted-space"> </span>WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">M<span class="Apple-converted-space"> </span>WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">A<span class="Apple-converted-space"> </span>WEB-INF/lps/server/src/org/openlaszlo/sc/SourceFileMap.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">M<span class="Apple-converted-space"> </span>WEB-INF/lps/server/src/org/openlaszlo/sc/CommonGenerator.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">M<span class="Apple-converted-space"> </span>WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">M<span class="Apple-converted-space"> </span>WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9ParseTreePrinter.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">M<span class="Apple-converted-space"> </span>WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">M<span class="Apple-converted-space"> </span>WEB-INF/lps/server/src/org/openlaszlo/sc/TranslationUnit.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">M<span class="Apple-converted-space"> </span>WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">M<span class="Apple-converted-space"> </span>WEB-INF/lps/server/src/org/openlaszlo/compiler/Main.java</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px">Changeset: <a href="http://svn.openlaszlo.org/openlaszlo/patches/20080818-dda-Z.tar">http://svn.openlaszlo.org/openlaszlo/patches/20080818-dda-Z.tar</a></p>
<br><br><div> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br class="Apple-interchange-newline">--</div><div><br>Don Anderson<br>Java/C/C++, Berkeley DB, systems consultant<br><br>voice: 617-547-7881<br>email: <a href="mailto:dda@ddanderson.com">dda@ddanderson.com</a><br>www: <a href="http://www.ddanderson.com/">http://www.ddanderson.com</a><br></div></div></span></span><br class="Apple-interchange-newline"></div></span></div></span><br class="Apple-interchange-newline"> </div><br></body></html>