diff options
author | Zahary Karadjov <zahary@gmail.com> | 2014-03-05 01:14:37 +0200 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2014-03-05 02:23:53 +0200 |
commit | 5324c9ebba1aa21c893db03c1d56d3ce1b42f162 (patch) | |
tree | e800cefb7f6ee456bfa19c1dd5e6004131c23ed1 /compiler/semexprs.nim | |
parent | 016492375f149a0e71239845d55f8771e151299c (diff) | |
download | Nim-5324c9ebba1aa21c893db03c1d56d3ce1b42f162.tar.gz |
iterators now return tyIter(T);
tyIter(T) represents an "iteration yielding values of type T" I'm planning to use that in the context of the `is` operator supporting predicates such as `C.items is iterator` and also in the upcoming support for higher-order inline iterators.
Diffstat (limited to 'compiler/semexprs.nim')
-rw-r--r-- | compiler/semexprs.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 538489490..34d58118d 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1266,7 +1266,7 @@ proc semYield(c: PContext, n: PNode): PNode = n.sons[0] = semExprWithType(c, n.sons[0]) # check for type compatibility: var restype = c.p.owner.typ.sons[0] if restype != nil: - n.sons[0] = fitNode(c, restype, n.sons[0]) + n.sons[0] = fitNode(c, restype.base, n.sons[0]) if n.sons[0].typ == nil: internalError(n.info, "semYield") semYieldVarResult(c, n, restype) else: @@ -1884,7 +1884,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = message(n.info, warnDeprecated, "bind") result = semExpr(c, n.sons[0], flags) of nkTypeOfExpr, nkTupleTy, nkRefTy..nkEnumTy, nkStaticTy: - var typ = semTypeNode(c, n, nil).skipTypes({tyTypeDesc}) + var typ = semTypeNode(c, n, nil).skipTypes({tyTypeDesc, tyIter}) result.typ = makeTypeDesc(c, typ) #result = symNodeFromType(c, typ, n.info) of nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand, nkCallStrLit: |