fixes regression due to object assignment fixes
This commit is contained in:
parent
866ce10b05
commit
85d83fd8cb
3 changed files with 11 additions and 9 deletions
|
|
@ -166,6 +166,10 @@ proc getTypeDescAux(m: BModule, typ: PType, check: var IntSet): PRope
|
||||||
proc needsComplexAssignment(typ: PType): bool =
|
proc needsComplexAssignment(typ: PType): bool =
|
||||||
result = containsGarbageCollectedRef(typ)
|
result = containsGarbageCollectedRef(typ)
|
||||||
|
|
||||||
|
proc isObjLackingTypeField(typ: PType): bool {.inline.} =
|
||||||
|
result = (typ.kind == tyObject) and ((tfFinal in typ.flags) and
|
||||||
|
(typ.sons[0] == nil) or isPureObject(typ))
|
||||||
|
|
||||||
proc isInvalidReturnType(rettype: PType): bool =
|
proc isInvalidReturnType(rettype: PType): bool =
|
||||||
# Arrays and sets cannot be returned by a C procedure, because C is
|
# Arrays and sets cannot be returned by a C procedure, because C is
|
||||||
# such a poor programming language.
|
# such a poor programming language.
|
||||||
|
|
@ -177,10 +181,12 @@ proc isInvalidReturnType(rettype: PType): bool =
|
||||||
of ctArray:
|
of ctArray:
|
||||||
result = not (skipTypes(rettype, typedescInst).kind in
|
result = not (skipTypes(rettype, typedescInst).kind in
|
||||||
{tyVar, tyRef, tyPtr})
|
{tyVar, tyRef, tyPtr})
|
||||||
of ctStruct:
|
of ctStruct:
|
||||||
result = needsComplexAssignment(skipTypes(rettype, typedescInst))
|
let t = skipTypes(rettype, typedescInst)
|
||||||
|
result = needsComplexAssignment(t) or
|
||||||
|
(t.kind == tyObject and not isObjLackingTypeField(t))
|
||||||
else: result = false
|
else: result = false
|
||||||
|
|
||||||
const
|
const
|
||||||
CallingConvToStr: array[TCallingConvention, string] = ["N_NIMCALL",
|
CallingConvToStr: array[TCallingConvention, string] = ["N_NIMCALL",
|
||||||
"N_STDCALL", "N_CDECL", "N_SAFECALL",
|
"N_STDCALL", "N_CDECL", "N_SAFECALL",
|
||||||
|
|
@ -678,10 +684,6 @@ when false:
|
||||||
var tmp = getNimType(m)
|
var tmp = getNimType(m)
|
||||||
appf(m.s[cfsTypeInit2], "$2 = &$1;$n", [tmp, name])
|
appf(m.s[cfsTypeInit2], "$2 = &$1;$n", [tmp, name])
|
||||||
|
|
||||||
proc isObjLackingTypeField(typ: PType): bool {.inline.} =
|
|
||||||
result = (typ.kind == tyObject) and ((tfFinal in typ.flags) and
|
|
||||||
(typ.sons[0] == nil) or isPureObject(typ))
|
|
||||||
|
|
||||||
proc genTypeInfoAuxBase(m: BModule, typ: PType, name, base: PRope) =
|
proc genTypeInfoAuxBase(m: BModule, typ: PType, name, base: PRope) =
|
||||||
var nimtypeKind: int
|
var nimtypeKind: int
|
||||||
#allocMemTI(m, typ, name)
|
#allocMemTI(m, typ, name)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
import db_sqlite
|
import db_sqlite
|
||||||
|
|
||||||
var db: DbConn
|
var db: TDbConn
|
||||||
exec(db, sql"create table blabla()")
|
exec(db, sql"create table blabla()")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
type
|
type
|
||||||
TMyObj = TYourObj
|
TMyObj = TYourObj
|
||||||
TYourObj = object of TObject
|
TYourObj = object of RootObj
|
||||||
x, y: int
|
x, y: int
|
||||||
|
|
||||||
proc init: TYourObj =
|
proc init: TYourObj =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue