diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-07-27 18:20:13 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-07-27 18:20:13 +0200 |
commit | ef4b755183f6564cc0f35cdf01794626c4e5fe2f (patch) | |
tree | 1ea46f6bf9dc4d38067abae043907dcfbadd2ebc /compiler | |
parent | 4ec91a30c4ab4bdb45f9805168f124205235d19c (diff) | |
download | Nim-ef4b755183f6564cc0f35cdf01794626c4e5fe2f.tar.gz |
allows a destructor to be attached to a tyString/tySequence
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ast.nim | 6 | ||||
-rw-r--r-- | compiler/semstmts.nim | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index 3870c82ee..a61ac055e 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -1088,9 +1088,9 @@ proc newSym*(symKind: TSymKind, name: PIdent, owner: PSym, result.id = getID() when debugIds: registerId(result) - #if result.id == 93289: + #if result.id == 77131: # writeStacktrace() - # MessageOut(name.s & " has id: " & toString(result.id)) + # echo name.s proc isMetaType*(t: PType): bool = return t.kind in tyMetaTypes or @@ -1272,7 +1272,7 @@ proc newType*(kind: TTypeKind, owner: PSym): PType = when debugIds: registerId(result) when false: - if result.id == 205734: + if result.id == 76426: echo "KNID ", kind writeStackTrace() diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 781813795..f7d8b6b7b 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -1017,8 +1017,8 @@ proc checkForMetaFields(c: PContext; n: PNode) = case t.kind of tySequence, tySet, tyArray, tyOpenArray, tyVar, tyLent, tyPtr, tyRef, tyProc, tyGenericInvocation, tyGenericInst, tyAlias, tySink: - let start = int ord(t.kind in {tyGenericInvocation, tyGenericInst}) - for i in start ..< t.sons.len: + let start = ord(t.kind in {tyGenericInvocation, tyGenericInst}) + for i in start ..< t.len: checkMeta(t.sons[i]) else: checkMeta(t) @@ -1337,7 +1337,7 @@ proc semOverride(c: PContext, s: PSym, n: PNode) = if obj.kind in {tyGenericBody, tyGenericInst}: obj = obj.lastSon elif obj.kind == tyGenericInvocation: obj = obj.sons[0] else: break - if obj.kind in {tyObject, tyDistinct}: + if obj.kind in {tyObject, tyDistinct, tySequence, tyString}: if obj.destructor.isNil: obj.destructor = s else: @@ -1359,7 +1359,7 @@ proc semOverride(c: PContext, s: PSym, n: PNode) = if t.kind == tyGenericBody: t = t.lastSon elif t.kind == tyGenericInvocation: t = t.sons[0] else: break - if t.kind in {tyObject, tyDistinct, tyEnum}: + if t.kind in {tyObject, tyDistinct, tyEnum, tySequence, tyString}: if t.deepCopy.isNil: t.deepCopy = s else: localError(c.config, n.info, errGenerated, @@ -1388,7 +1388,7 @@ proc semOverride(c: PContext, s: PSym, n: PNode) = elif objB.kind in {tyGenericInvocation, tyGenericInst}: objB = objB.sons[0] else: break - if obj.kind in {tyObject, tyDistinct} and sameType(obj, objB): + if obj.kind in {tyObject, tyDistinct, tySequence, tyString} and sameType(obj, objB): let opr = if s.name.s == "=": addr(obj.assignment) else: addr(obj.sink) if opr[].isNil: opr[] = s |