@@ -203,7 +203,7 @@ private void WriteMainDriver(CompilationContext context, StringWriter output, Sc
203
203
return ;
204
204
205
205
context . WriteLine ( output , "@Generated" ) ;
206
- context . WriteLine ( output , "public static class DefaultImpl extends PTestDriver {" ) ;
206
+ context . WriteLine ( output , "public static class test_DefaultImpl extends PTestDriver {" ) ;
207
207
WriteDriver ( context , output , mainMachine . Name , decls ) ;
208
208
context . WriteLine ( output , "}" ) ;
209
209
context . WriteLine ( output ) ;
@@ -478,7 +478,7 @@ private void WriteForeignFunction(CompilationContext context, StringWriter outpu
478
478
479
479
string returnType = null ;
480
480
var returnStatement = "" ;
481
- if ( function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
481
+ if ( function . Signature . ReturnType == null || function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
482
482
{
483
483
returnType = "void" ;
484
484
}
@@ -524,7 +524,7 @@ private void WriteFunction(CompilationContext context, StringWriter output, Func
524
524
var staticKeyword = isStatic ? "static " : "" ;
525
525
526
526
string returnType = null ;
527
- if ( function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
527
+ if ( function . Signature . ReturnType == null || function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
528
528
returnType = "void" ;
529
529
else
530
530
returnType = GetPExType ( function . Signature . ReturnType ) ;
@@ -599,7 +599,7 @@ private void WriteFunctionBody(CompilationContext context, StringWriter output,
599
599
context . WriteLine ( output ) ;
600
600
}
601
601
602
- if ( ! function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
602
+ if ( function . Signature . ReturnType != null && ! function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
603
603
context . WriteLine ( output ,
604
604
$ "{ GetPExType ( function . Signature . ReturnType ) } { CompilationContext . ReturnValue } = { GetDefaultValue ( function . Signature . ReturnType ) } ;") ;
605
605
@@ -610,7 +610,7 @@ private void WriteFunctionBody(CompilationContext context, StringWriter output,
610
610
else
611
611
exited = WriteStmt ( function , context , output , ControlFlowContext . FreshFuncContext ( context ) , function . Body ) ;
612
612
if ( ! exited )
613
- if ( ! function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
613
+ if ( function . Signature . ReturnType != null && ! function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
614
614
context . Write ( output , $ "return { CompilationContext . ReturnValue } ;") ;
615
615
}
616
616
@@ -733,7 +733,7 @@ private bool WriteStmt(Function function, CompilationContext context, StringWrit
733
733
734
734
context . WriteLine ( output , ");" ) ;
735
735
736
- if ( function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
736
+ if ( function . Signature . ReturnType == null || function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
737
737
context . WriteLine ( output , "return;" ) ;
738
738
else
739
739
context . WriteLine ( output , "return null;" ) ;
@@ -756,7 +756,7 @@ private bool WriteStmt(Function function, CompilationContext context, StringWrit
756
756
757
757
context . WriteLine ( output , ");" ) ;
758
758
759
- if ( function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
759
+ if ( function . Signature . ReturnType == null || function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
760
760
context . WriteLine ( output , "return;" ) ;
761
761
else
762
762
context . WriteLine ( output , "return null;" ) ;
@@ -979,7 +979,7 @@ private bool WriteStmt(Function function, CompilationContext context, StringWrit
979
979
980
980
private void WriteContinuation ( CompilationContext context , StringWriter output , Continuation continuation )
981
981
{
982
- var voidReturn = continuation . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) ;
982
+ var voidReturn = continuation . Signature . ReturnType == null || continuation . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) ;
983
983
if ( ! voidReturn )
984
984
throw new NotImplementedException (
985
985
$ "Receive statement in a function with non-void return type is not supported. Found in function named { continuation . ParentFunction . Name } .") ;
@@ -1143,14 +1143,14 @@ private void WriteForeignFunCallStmt(CompilationContext context, StringWriter ou
1143
1143
IReadOnlyList < IPExpr > args , IPExpr dest = null )
1144
1144
{
1145
1145
string returnTemp = null ;
1146
- if ( ! function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
1146
+ if ( function . Signature . ReturnType != null && ! function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
1147
1147
{
1148
1148
returnTemp = context . FreshTempVar ( ) ;
1149
1149
context . Write ( output ,
1150
1150
$ "{ GetPExType ( function . Signature . ReturnType ) } { returnTemp } = ({ GetPExType ( function . Signature . ReturnType ) } )") ;
1151
1151
}
1152
1152
1153
- if ( function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
1153
+ if ( function . Signature . ReturnType == null || function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
1154
1154
{
1155
1155
context . Write ( output , "ForeignFunctionInterface.accept(" ) ;
1156
1156
context . Write ( output , $ "x -> ffi_{ context . GetNameForDecl ( function ) } (x)") ;
@@ -1173,7 +1173,7 @@ private void WriteForeignFunCallStmt(CompilationContext context, StringWriter ou
1173
1173
1174
1174
context . WriteLine ( output , ");" ) ;
1175
1175
1176
- if ( function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
1176
+ if ( function . Signature . ReturnType == null || function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
1177
1177
{
1178
1178
Debug . Assert ( dest == null ) ;
1179
1179
}
@@ -1195,7 +1195,7 @@ private void WriteFunCallStmt(CompilationContext context, StringWriter output, F
1195
1195
}
1196
1196
1197
1197
string returnTemp = null ;
1198
- if ( ! function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
1198
+ if ( function . Signature . ReturnType != null && ! function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
1199
1199
{
1200
1200
returnTemp = context . FreshTempVar ( ) ;
1201
1201
context . Write ( output , $ "{ GetPExType ( function . Signature . ReturnType ) } { returnTemp } = ") ;
@@ -1213,7 +1213,7 @@ private void WriteFunCallStmt(CompilationContext context, StringWriter output, F
1213
1213
1214
1214
context . WriteLine ( output , ");" ) ;
1215
1215
1216
- if ( function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
1216
+ if ( function . Signature . ReturnType == null || function . Signature . ReturnType . IsSameTypeAs ( PrimitiveType . Null ) )
1217
1217
{
1218
1218
Debug . Assert ( dest == null ) ;
1219
1219
}
0 commit comments