You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2021/09/08 16:28:34 UTC

[GitHub] [royale-compiler] joshtynjala commented on issue #191: Internal Error NPE thrown for try-catch declaration in mxml

joshtynjala commented on issue #191:
URL: https://github.com/apache/royale-compiler/issues/191#issuecomment-915387444


   I can reproduce this issue. It seems to happen when a variable is declared in the `catch` block. As best I can tell, it reproduces with any type (for instance, I changed it to `String` in the example below instead of `TitleWindow` from the original report, and it still reproduced).
   
   ```actionscript
   public function bar():void {
       try {
           trace("hi");
       }
       catch(e:Error) {
           var s:String;
       }
   }
   ```
   
   This is the method in `ABCGeneratingReducer` with the null exception:
   
   ```java
   public Name reduce_declName(IASNode iNode )
   {
       // We are the name of a declaration, get the containing DefinitionNode and grab the
       // name from there
       BaseDefinitionNode bdn = (BaseDefinitionNode)iNode.getAncestorOfType(BaseDefinitionNode.class);
       DefinitionBase db = bdn.getDefinition();
       Name n = db.getMName(currentScope.getProject());
       return n;
   }
   ```
   
   The result of `bdn.getDefinition()` returns `null`. The `BaseDefinitionNode` refers to the local variable in the `catch` block. As best I can tell, its definition must not have been populated. Not sure why yet. Needs further investigation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@royale.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org