File tree Expand file tree Collapse file tree 4 files changed +23
-17
lines changed
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/compiler Expand file tree Collapse file tree 4 files changed +23
-17
lines changed Original file line number Diff line number Diff line change @@ -519,6 +519,22 @@ public Void visitCall(CallExpression expression) {
519519 javaWriter .iSub ();
520520 }, PushOption .AFTER );
521521 return null ;
522+ case OPTIONAL_IS_NULL :
523+ case OPTIONAL_IS_NOT_NULL :
524+ expression .target .accept (this );
525+ final Label isFalse = new Label ();
526+ final Label end = new Label ();
527+
528+ if (builtin == BuiltinID .OPTIONAL_IS_NULL )
529+ javaWriter .ifNonNull (isFalse );
530+ else
531+ javaWriter .ifNull (isFalse );
532+ javaWriter .iConst1 ();
533+ javaWriter .goTo (end );
534+ javaWriter .label (isFalse );
535+ javaWriter .iConst0 ();
536+ javaWriter .label (end );
537+ return null ;
522538 default :
523539 expression .target .accept (this );
524540 for (Expression argument : expression .arguments .arguments ) {
@@ -1035,21 +1051,6 @@ public Void visitCall(CallExpression expression) {
10351051 break ;
10361052 case AUTOOP_NOTEQUALS :
10371053 throw new UnsupportedOperationException ("Not yet supported!" );
1038- case OPTIONAL_IS_NULL :
1039- case OPTIONAL_IS_NOT_NULL :
1040- final Label isFalse = new Label ();
1041- final Label end = new Label ();
1042-
1043- if (builtin == BuiltinID .OPTIONAL_IS_NULL )
1044- javaWriter .ifNonNull (isFalse );
1045- else
1046- javaWriter .ifNull (isFalse );
1047- javaWriter .iConst1 ();
1048- javaWriter .goTo (end );
1049- javaWriter .label (isFalse );
1050- javaWriter .iConst0 ();
1051- javaWriter .label (end );
1052- break ;
10531054
10541055 default :
10551056 throw new UnsupportedOperationException ("Unknown builtin: " + builtin );
Original file line number Diff line number Diff line change 11group= ' org.openzen.zencode'
2- version= ' 0.1 .0'
2+ version= ' 0.2 .0'
Original file line number Diff line number Diff line change @@ -5,3 +5,8 @@ println(1 - 2);
55println(1 + 3 as long );
66
77println(<hello world in bracket parser>);
8+
9+
10+ var a = null as string ?;
11+ if (a == null )
12+ println(" A is null!" );
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ apply plugin: 'java'
66apply plugin : ' maven'
77
88String mavenGroupId = ' org.openzen.zencode'
9- String mavenVersion = ' 0.1.2 '
9+ String mavenVersion = ' 0.2.0 '
1010
1111sourceCompatibility = ' 1.8'
1212[compileJava, compileTestJava]* . options* . encoding = ' UTF-8'
You can’t perform that action at this time.
0 commit comments