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 2019/01/12 23:00:42 UTC
[GitHub] sobotklp opened a new issue #71: Using a variable of type
flash.display.Graphics causes compiler 0.9.6 to throw an exception
sobotklp opened a new issue #71: Using a variable of type flash.display.Graphics causes compiler 0.9.6 to throw an exception
URL: https://github.com/apache/royale-compiler/issues/71
This issue only affects the nightly build of Royale 0.9.6. Using a variable or parameter with type `openfl.display.Graphics` causes an internal Java exception when compiling AS3.
Consider the following `Main.as`:
```
package {
import openfl.display.Graphics;
public class Main {
public function Main () {
console.log("ohai");
}
public function drawCircle(graphics:Graphics) {
graphics.lineStyle( 1, colOuter );
graphics.beginFill( colInner );
graphics.drawCircle( x, y, 2 );
graphics.endFill();
}
}
}
```
Compiling this code with `--external-library-path+=node_modules/openfl/dist/openfl.swc` causes Royale to throw the follow Java exception:
```
src/Main.as(10): col: 3 Internal error: java.lang.ClassCastException: org.apache.royale.compiler.internal.definitions.FunctionDefinition cannot be cast to org.apache.royale.compiler.definitions.ITypeDefinition
at org.apache.royale.compiler.internal.tree.as.IdentifierNode.resolve(IdentifierNode.java:395)
at org.apache.royale.compiler.internal.semantics.SemanticUtils.transformNameToConstantValue(SemanticUtils.java:2434)
at org.apache.royale.compiler.internal.as.codegen.ABCGeneratingReducer.isCompileTimeConstant(ABCGeneratingReducer.java:2457)
at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.isCompileTimeConstant(CmcEmitter.java:90)
at org.apache.royale.compiler.internal.as.codegen.CmcEmitter$JBurgAnnotation_IdentifierID_0.getCostFunctionResult_4411a827(CmcEmitter.java:14196)
at org.apache.royale.compiler.internal.as.codegen.CmcEmitter$JBurgAnnotation_IdentifierID_0.getCost(CmcEmitter.java:13949)
at org.apache.royale.compiler.internal.as.codegen.CmcEmitter$JBurgAnnotation_IdentifierID_0.getCost(CmcEmitter.java:13965)
at org.apache.royale.compiler.internal.as.codegen.CmcEmitter$JBurgAnnotation_FunctionCallID_2_n.getCostForRule_533ddba(CmcEmitter.java:13076)
at org.apache.royale.compiler.internal.as.codegen.CmcEmitter$JBurgAnnotation_FunctionCallID_2_n.getCost(CmcEmitter.java:12745)
at org.apache.royale.compiler.internal.as.codegen.CmcEmitter$JBurgAnnotation_FunctionCallID_2_n.getCost(CmcEmitter.java:12803)
at org.apache.royale.compiler.internal.as.codegen.CmcEmitter$JBurgAnnotation_FunctionCallID_2_n.getCost(CmcEmitter.java:12781)
at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.getNaryCost(CmcEmitter.java:39386)
at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.access$000(CmcEmitter.java:30)
...
```
I believe this commit is the culprit: https://github.com/apache/royale-compiler/commit/1063bf810a0928ba7d5d0bebf0fa6e8f51e683c3
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services