You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2019/03/08 21:28:48 UTC
[royale-compiler] branch develop updated: compiler: extra null
reference check in DefinitionBase.getContainingToplevelDefinition() similar
to the one later in the same method
This is an automated email from the ASF dual-hosted git repository.
joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
The following commit(s) were added to refs/heads/develop by this push:
new 591580f compiler: extra null reference check in DefinitionBase.getContainingToplevelDefinition() similar to the one later in the same method
591580f is described below
commit 591580f027877a69f6ca896a0e3b96fa07b00b10
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Fri Mar 8 13:27:41 2019 -0800
compiler: extra null reference check in DefinitionBase.getContainingToplevelDefinition() similar to the one later in the same method
---
.../compiler/internal/definitions/DefinitionBase.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java
index a219328..50a4951 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java
@@ -549,6 +549,12 @@ public abstract class DefinitionBase implements IDocumentableDefinition, IDefini
private static DefinitionBase getContainingToplevelDefinition(DefinitionBase definition)
{
ASScope currentContainingScope = definition.getContainingASScope();
+ if (currentContainingScope == null)
+ {
+ // With some synthetic definitions you can't find a containint top level definition.
+ // This happens with Vector<T>, for example. In this case, return null
+ return null;
+ }
DefinitionBase currentDefinition = definition;
IScopedDefinition containingDefinition = currentContainingScope.getContainingDefinition();
@@ -557,10 +563,11 @@ public abstract class DefinitionBase implements IDocumentableDefinition, IDefini
currentDefinition = (DefinitionBase)containingDefinition;
currentContainingScope = currentDefinition.getContainingASScope();
- // With some synthetic definitions you can't find a containint top level definition.
- // This happens with Vector<T>, for example. In this case, return null
if (currentContainingScope == null)
- return null;
+ {
+ // See comment above
+ return null;
+ }
containingDefinition = currentContainingScope.getContainingDefinition();
}