compiler finally supports 'object {.pragma.}' syntax
This commit is contained in:
parent
d4c2f2509c
commit
cb79bf9f16
4 changed files with 25 additions and 4 deletions
|
|
@ -476,6 +476,11 @@ proc semObjectNode(c: PContext, n: PNode, prev: PType): PType =
|
||||||
addSon(result, base)
|
addSon(result, base)
|
||||||
result.n = newNodeI(nkRecList, n.info)
|
result.n = newNodeI(nkRecList, n.info)
|
||||||
semRecordNodeAux(c, n.sons[2], check, pos, result.n, result.sym)
|
semRecordNodeAux(c, n.sons[2], check, pos, result.n, result.sym)
|
||||||
|
if n.sons[0].kind != nkEmpty:
|
||||||
|
# dummy symbol for `pragma`:
|
||||||
|
var s = newSymS(skType, newIdentNode(getIdent("dummy"), n.info), c)
|
||||||
|
s.typ = result
|
||||||
|
pragma(c, s, n.sons[0], typePragmas)
|
||||||
|
|
||||||
proc addParamOrResult(c: PContext, param: PSym, kind: TSymKind) =
|
proc addParamOrResult(c: PContext, param: PSym, kind: TSymKind) =
|
||||||
if kind == skMacro and param.typ.kind in {tyTypeDesc, tyExpr, tyStmt}:
|
if kind == skMacro and param.typ.kind in {tyTypeDesc, tyExpr, tyStmt}:
|
||||||
|
|
|
||||||
16
tests/run/tfinalobj.nim
Normal file
16
tests/run/tfinalobj.nim
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
discard """
|
||||||
|
outp: "abc"
|
||||||
|
"""
|
||||||
|
|
||||||
|
type
|
||||||
|
TA = object {.pure, final.}
|
||||||
|
x: string
|
||||||
|
|
||||||
|
var
|
||||||
|
a: TA
|
||||||
|
a.x = "abc"
|
||||||
|
|
||||||
|
doAssert TA.sizeof == string.sizeof
|
||||||
|
|
||||||
|
echo a.x
|
||||||
|
|
||||||
6
todo.txt
6
todo.txt
|
|
@ -10,7 +10,9 @@ version 0.9.0
|
||||||
- deactivate lambda lifting for JS backend
|
- deactivate lambda lifting for JS backend
|
||||||
- Test capture of for loop vars; test generics;
|
- Test capture of for loop vars; test generics;
|
||||||
- test constant closures
|
- test constant closures
|
||||||
|
- implement closures that support nesting > 1
|
||||||
|
|
||||||
|
- document and fix 'do' notation
|
||||||
- dead code elim for JS backend; 'of' operator for JS backend
|
- dead code elim for JS backend; 'of' operator for JS backend
|
||||||
- unsigned ints and bignums; requires abstract integer literal type:
|
- unsigned ints and bignums; requires abstract integer literal type:
|
||||||
use tyInt+node for that
|
use tyInt+node for that
|
||||||
|
|
@ -21,7 +23,6 @@ version 0.9.0
|
||||||
- we need to support iteration of 2 different data structures in parallel
|
- we need to support iteration of 2 different data structures in parallel
|
||||||
- make exceptions compatible with C++ exceptions
|
- make exceptions compatible with C++ exceptions
|
||||||
- change how comments are part of the AST
|
- change how comments are part of the AST
|
||||||
- activate more thread tests
|
|
||||||
- rethink the syntax: distinction between expr and stmt is unfortunate;
|
- rethink the syntax: distinction between expr and stmt is unfortunate;
|
||||||
indentation handling is quite complex too; problem with exception handling
|
indentation handling is quite complex too; problem with exception handling
|
||||||
is that often the scope of ``try`` is wrong and apart from that ``try`` is
|
is that often the scope of ``try`` is wrong and apart from that ``try`` is
|
||||||
|
|
@ -43,7 +44,6 @@ Bugs
|
||||||
|
|
||||||
- bug: stress testing basic method example (eval example)
|
- bug: stress testing basic method example (eval example)
|
||||||
without ``-d:release`` leaks memory?
|
without ``-d:release`` leaks memory?
|
||||||
- bug: object {.pure, final.} does not work again!
|
|
||||||
- bug: pragma statements in combination with symbol files are evaluated twice
|
- bug: pragma statements in combination with symbol files are evaluated twice
|
||||||
but this can lead to compilation errors
|
but this can lead to compilation errors
|
||||||
|
|
||||||
|
|
@ -126,8 +126,8 @@ Low priority
|
||||||
- warning for implicit openArray -> varargs conversion
|
- warning for implicit openArray -> varargs conversion
|
||||||
- implement explicit varargs; **but** ``len(varargs)`` problem remains!
|
- implement explicit varargs; **but** ``len(varargs)`` problem remains!
|
||||||
--> solve by implicit conversion from varargs to openarray
|
--> solve by implicit conversion from varargs to openarray
|
||||||
- implement closures that support nesting > 1
|
|
||||||
- optimize method dispatchers
|
- optimize method dispatchers
|
||||||
|
- activate more thread tests
|
||||||
- implement ``--script:sh|bat`` command line option; think about script
|
- implement ``--script:sh|bat`` command line option; think about script
|
||||||
generation
|
generation
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue