Skip to content

Commit 3cacfde

Browse files
committed
Sane stack transitional behaviour in bodies
1 parent f62e9e8 commit 3cacfde

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

ngc/ClrGenerator.fs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,8 @@ type ClrCallGenerator(context : Context, typeBuilder : TypeBuilder, clrType : Ty
8282

8383
args_seq.Generate ilGen
8484
ilGen.Emit(OpCodes.Call, Option.get clrMethod)
85-
if (Option.get clrMethod).ReturnType = typeof<Void> then
86-
ilGen.Emit(OpCodes.Ldnull);
8785
member this.ReturnTypes() =
88-
if (Option.get clrMethod).ReturnType = typeof<Void> then [typeof<obj>] else [(Option.get clrMethod).ReturnType]
86+
[(Option.get clrMethod).ReturnType]
8987

9088
type InstanceCallGenerator(context : Context, typeBuilder : TypeBuilder, instance : SExp, methodName : string, arguments : SExp list, gf : IGeneratorFactory) =
9189
interface IGenerator with

ngc/FormGenerator.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ type BodyGenerator(context:Context,typeBuilder:TypeBuilder,body:SExp list, gf:IG
8686
let gen = gf.MakeGenerator context last
8787
let val_type = gen.ReturnTypes()
8888
gen.Generate ilGen
89-
if (val_type = [typeof<System.Void>]) then
89+
if ((List.head val_type) = typeof<System.Void>) then
9090
ilGen.Emit(OpCodes.Ldnull)
9191
| sexp :: rest ->
9292
let gen = gf.MakeGenerator context sexp

0 commit comments

Comments
 (0)