File tree Expand file tree Collapse file tree 6 files changed +32
-18
lines changed Expand file tree Collapse file tree 6 files changed +32
-18
lines changed Original file line number Diff line number Diff line change 1- # Generated by enumgen.nim. DO NOT EDIT!
1+ # Generated by gear2/generator/ enumgen.nim in Nimony repo . DO NOT EDIT!
22
33import " .." / [ast, options]
44
@@ -27,7 +27,7 @@ proc toNifTag*(s: TNodeKind): string =
2727 of nkStrLit: " strlit"
2828 of nkRStrLit: " rstrlit"
2929 of nkTripleStrLit: " triplestrlit"
30- of nkNilLit: " nillit "
30+ of nkNilLit: " nil "
3131 of nkComesFrom: " comesfrom"
3232 of nkDotCall: " dotcall"
3333 of nkCommand: " cmd"
@@ -197,7 +197,7 @@ proc parseNodeKind*(s: string): TNodeKind =
197197 of " strlit" : nkStrLit
198198 of " rstrlit" : nkRStrLit
199199 of " triplestrlit" : nkTripleStrLit
200- of " nillit " : nkNilLit
200+ of " nil " : nkNilLit
201201 of " comesfrom" : nkComesFrom
202202 of " dotcall" : nkDotCall
203203 of " cmd" : nkCommand
@@ -800,7 +800,7 @@ proc toNifTag*(s: TMagic): string =
800800 of mString: " string"
801801 of mCstring: " cstring"
802802 of mPointer: " pointer"
803- of mNil: " nil "
803+ of mNil: " nilm "
804804 of mExpr: " exprm"
805805 of mStmt: " stmtm"
806806 of mTypeDesc: " typedesc"
@@ -1082,7 +1082,7 @@ proc parseMagic*(s: string): TMagic =
10821082 of " string" : mString
10831083 of " cstring" : mCstring
10841084 of " pointer" : mPointer
1085- of " nil " : mNil
1085+ of " nilm " : mNil
10861086 of " exprm" : mExpr
10871087 of " stmtm" : mStmt
10881088 of " typedesc" : mTypeDesc
Original file line number Diff line number Diff line change @@ -274,6 +274,10 @@ proc fromNif(c: var DecodeContext; n: var Cursor): PNode =
274274 of ParLe :
275275 let kind = n.nodeKind
276276 case kind:
277+ of nkNilLit:
278+ result = newNode (nkNilLit)
279+ inc n
280+ skipParRi n
277281 of nkPostfix, nkTypeSection, nkStmtList:
278282 result = newNode (kind)
279283 inc n
Original file line number Diff line number Diff line change @@ -202,6 +202,8 @@ proc toNif(c: var EncodeContext; n: PNode) =
202202 c.b.addStrLit n.strVal, " R"
203203 of nkTripleStrLit:
204204 c.b.addStrLit n.strVal, " T"
205+ of nkNilLit:
206+ c.b.addKeyw toNifTag (nkNilLit)
205207 of nkIdentDefs:
206208 c.b.withNode n:
207209 assert n.len == 3
Original file line number Diff line number Diff line change 33proc writeTypeFlags (c: var EncodeContext ; t: PType ) =
44 writeFlags c.b, t.flags, " tf"
55
6- proc isNominalRef (t: PType ): bool {.inline .} =
7- let e = t.elementType
8- t.sym != nil and e.kind == tyObject and (e.sym == nil or sfAnon in e.sym.flags)
9-
106template singleElement (keyw: string ) {.dirty .} =
117 c.b.withTree keyw:
128 writeTypeFlags (c, t)
@@ -97,18 +93,12 @@ proc toNif(c: var EncodeContext; t: PType; isTypeSection = false) =
9793 toNif c, son
9894 else :
9995 symToNif c, t.sym
100- of tyPtr:
101- if isNominalRef (t):
102- symToNif c, t.sym
103- else :
104- c.typeHead t:
105- toNif c, t.elementType
106- of tyRef:
107- if isNominalRef (t):
96+ of tyRef, tyPtr:
97+ if tfRefsAnonObj in t.flags and not isTypeSection:
10898 symToNif c, t.sym
10999 else :
110100 c.typeHead t:
111- toNif c, t.elementType
101+ toNif c, t.elementType, isTypeSection
112102 of tyVar:
113103 c.b.withTree (if isOutParam (t): " out" else : " mut" ):
114104 toNif c, t.elementType
Original file line number Diff line number Diff line change @@ -25,3 +25,5 @@ var uint64litH = 18446744073709551615'u64
2525var floatlit = 1.25
2626var float32lit = 1.25 'f32
2727var float64lit = 1.25 'f64
28+
29+ var nillit: ptr int = nil
Original file line number Diff line number Diff line change 1212 TestObject2 * = object
1313 x: TestObject
1414
15+ TestRefInt = ref int
16+ TestPtrInt = ptr int
17+
18+ TestRefObj = ref object
19+ x: int
20+
21+ TestPtrObj = ptr object
22+ x: int
23+
1524var x: TestInt
1625var testEnum: TestEnum
1726var testEnum1 = X
1827var testDistinct: TestDistinct
1928var testObject: TestObject
2029var testObject2* : TestObject2
30+
31+ var testRefInt: TestRefInt = nil
32+ var testRefInt2: ref int = nil
33+ var testPtrInt: TestPtrInt = nil
34+ var testPtrInt2: ptr int = nil
35+ var testRefObj: TestRefObj = nil
36+ var testPtrObj: TestPtrObj = nil
You can’t perform that action at this time.
0 commit comments