fixes #2585
This commit is contained in:
parent
13c5f792dc
commit
bcd8053b23
3 changed files with 37 additions and 5 deletions
|
|
@ -184,7 +184,7 @@ proc isAssignable*(owner: PSym, n: PNode): TAssignableResult =
|
||||||
case n.kind
|
case n.kind
|
||||||
of nkSym:
|
of nkSym:
|
||||||
# don't list 'skLet' here:
|
# don't list 'skLet' here:
|
||||||
if n.sym.kind in {skVar, skResult, skTemp}:
|
if n.sym.kind in {skVar, skResult, skTemp, skParam}:
|
||||||
if owner != nil and owner.id == n.sym.owner.id and
|
if owner != nil and owner.id == n.sym.owner.id and
|
||||||
sfGlobal notin n.sym.flags:
|
sfGlobal notin n.sym.flags:
|
||||||
result = arLocalLValue
|
result = arLocalLValue
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,6 @@ proc newOptionEntry*(): POptionEntry
|
||||||
proc newLib*(kind: TLibKind): PLib
|
proc newLib*(kind: TLibKind): PLib
|
||||||
proc addToLib*(lib: PLib, sym: PSym)
|
proc addToLib*(lib: PLib, sym: PSym)
|
||||||
proc makePtrType*(c: PContext, baseType: PType): PType
|
proc makePtrType*(c: PContext, baseType: PType): PType
|
||||||
proc makeVarType*(c: PContext, baseType: PType): PType
|
|
||||||
proc newTypeS*(kind: TTypeKind, c: PContext): PType
|
proc newTypeS*(kind: TTypeKind, c: PContext): PType
|
||||||
proc fillTypeS*(dest: PType, kind: TTypeKind, c: PContext)
|
proc fillTypeS*(dest: PType, kind: TTypeKind, c: PContext)
|
||||||
|
|
||||||
|
|
@ -213,9 +212,12 @@ proc makePtrType(c: PContext, baseType: PType): PType =
|
||||||
result = newTypeS(tyPtr, c)
|
result = newTypeS(tyPtr, c)
|
||||||
addSonSkipIntLit(result, baseType.assertNotNil)
|
addSonSkipIntLit(result, baseType.assertNotNil)
|
||||||
|
|
||||||
proc makeVarType(c: PContext, baseType: PType): PType =
|
proc makeVarType*(c: PContext, baseType: PType): PType =
|
||||||
result = newTypeS(tyVar, c)
|
if baseType.kind == tyVar:
|
||||||
addSonSkipIntLit(result, baseType.assertNotNil)
|
result = baseType
|
||||||
|
else:
|
||||||
|
result = newTypeS(tyVar, c)
|
||||||
|
addSonSkipIntLit(result, baseType.assertNotNil)
|
||||||
|
|
||||||
proc makeTypeDesc*(c: PContext, typ: PType): PType =
|
proc makeTypeDesc*(c: PContext, typ: PType): PType =
|
||||||
result = newTypeS(tyTypeDesc, c)
|
result = newTypeS(tyTypeDesc, c)
|
||||||
|
|
|
||||||
30
tests/template/tstmt_semchecked_twice.nim
Normal file
30
tests/template/tstmt_semchecked_twice.nim
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
# bug #2585
|
||||||
|
|
||||||
|
type
|
||||||
|
RenderPass = object
|
||||||
|
state: ref int
|
||||||
|
|
||||||
|
RenderData* = object
|
||||||
|
fb: int
|
||||||
|
walls: seq[RenderPass]
|
||||||
|
|
||||||
|
Mat2 = int
|
||||||
|
Vector2[T] = T
|
||||||
|
Pixels=int
|
||||||
|
|
||||||
|
template use*(fb: int, st: stmt) : stmt =
|
||||||
|
echo "a ", $fb
|
||||||
|
st
|
||||||
|
echo "a ", $fb
|
||||||
|
|
||||||
|
proc render(rdat: var RenderData; passes: var openarray[RenderPass]; proj: Mat2;
|
||||||
|
indexType = 1) =
|
||||||
|
for i in 0 .. <len(passes):
|
||||||
|
echo "blah ", repr(passes[i])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
proc render2*(rdat: var RenderData; screenSz: Vector2[Pixels]; proj: Mat2) =
|
||||||
|
use rdat.fb:
|
||||||
|
render(rdat, rdat.walls, proj, 1)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue