Nicely done. Approved. I wonder if we should have a flag in our debugger to have it optionally enter the native debugger any time it would signal an error? Native debuggers probably already have a 'catch errors' feature, whereby they enter the debugger if an error is about to be thrown, but we've not implemented our runtime errors that way: we just call Debug.error. So, one idea would be for Debug.error to check for the flag and call the native debugger if the flag is set, rather than just returning.
Another approach would be to be more disciplined with our runtime errors. To actually throw an error for each of them and rely on our normal debug/catch mechanism to report them. On 2011-01-12, at 20:43, André Bargull wrote: > Change bargull-20110113-T2l by bargull@Bargull02 on 2011-01-13 02:23:19 > in /home/anba/src/svn/openlaszlo/trunk > for http://svn.openlaszlo.org/openlaszlo/trunk > > Summary: allow "debugger" statement in code > > New Features: LPP-5540 (DHTML: using "debugger"-keyword), LPP-9372 (Add LFC > APIs for native breakpoints and stack traces) (partial) > > Technical Reviewer: ptw > QA Reviewer: max > > Overview: > The "debugger" statement is now allowed in code and opens the runtime > debugger if available > > > Details: > Parser.jjt: > - add <DEBUGGER> to the allowed tokens for IdentifierOrKeyword() since > "debugger" is allowed to be in a MemberExpression > - add new DebuggerStatement() production > - add DebuggerStatement() to the TopLevelStatement() production > > CommonGenerator: > - handle ASTDebuggerStatement in visitStatement() > > EmptyParserVisitor: > - add visit() method for ASTDebuggerStatement > > GenericVisitor: > - handle ASTDebuggerStatement in visitStatement() > - add visit method for ASTDebuggerStatement > > ParserTreePrinter: > - handle ASTDebuggerStatement in visit() > - implement visit method which simply outputs "debugger" > > SWF9Generator: > - override visit method from CommonGenerator and replace ASTDebuggerStatement > with function call to "$lzsc$debugger()" > > SWF9ParseTreePrinter: > - throw exception in visit method for ASTDebuggerStatement, it should already > have been processed by SWF9Generator > > LzRuntime.lzs: > - provide access to the enterDebugger() function, this helps to avoid > importing the "flash.debugger" package everytime the debugger statement is > used > > > > Tests: > test case from bugreport in dhtml+firebug, swf10+fdb opens the runtime > debugger > > Files: > M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt > M WEB-INF/lps/lfc/compiler/LzRuntime.lzs > M WEB-INF/lps/server/src/org/openlaszlo/sc/EmptyParserVisitor.java > M WEB-INF/lps/server/src/org/openlaszlo/sc/CommonGenerator.java > M WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java > M WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9ParseTreePrinter.java > M WEB-INF/lps/server/src/org/openlaszlo/sc/GenericVisitor.java > M WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java > > Changeset: > http://svn.openlaszlo.org/openlaszlo/patches/bargull-20110113-T2l.tar >
