Selaa lähdekoodia

Fixed generation of ctors with no decl calling super decl. Fixes #417.

woollybah 6 vuotta sitten
vanhempi
commit
3f842be049
2 muutettua tiedostoa jossa 12 lisäystä ja 3 poistoa
  1. 11 2
      ctranslator.bmx
  2. 1 1
      options.bmx

+ 11 - 2
ctranslator.bmx

@@ -4548,7 +4548,16 @@ End Rem
 				If classDecl.superClass.ident = "Object" Then
 					Emit "bbObjectCtor((BBOBJECT)o);"
 				Else
-					Emit "_" + superid + "_New((" + TransObject(classDecl.superClass) + ")o);"
+					If fdecl And fdecl.scope <> classDecl And fdecl.argDecls.Length Then
+						t = "o"
+						For Local i:Int=0 Until fdecl.argDecls.Length
+							Local arg:TArgDecl=fdecl.argDecls[i]
+							t :+ ", " + arg.munged
+						Next
+						Emit "_" + newDecl.ClassScope().munged + "_" + newDecl.ident + MangleMethod(newDecl) + Bra(t) + ";"
+					Else
+						Emit "_" + superid + "_New((" + TransObject(classDecl.superClass) + ")o);"
+					End If
 				End If
 			End If
 	
@@ -4620,7 +4629,7 @@ End Rem
 		End If
 
 		'Local decl:TFuncDecl = classDecl.FindFuncDecl("new",,,,,,SCOPE_CLASS_LOCAL)
-		If fdecl And (fdecl.scope = classDecl Or fdecl.argDecls.Length) Then ' only our own New method, not any from superclasses
+		If fdecl And (fdecl.scope = classDecl) Then ' only our own New method, not any from superclasses
 			fdecl.Semant
 			If fdecl.munged <> "bbObjectCtor" Then
 				EmitLocalDeclarations(fdecl)

+ 1 - 1
options.bmx

@@ -25,7 +25,7 @@ SuperStrict
 
 Import "base.configmap.bmx"
 
-Const version:String = "0.103"
+Const version:String = "0.104"
 
 Const BUILDTYPE_APP:Int = 0
 Const BUILDTYPE_MODULE:Int = 1