summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-07-30 16:28:58 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-07-30 16:34:42 +0200
commit39ebe2175bd4e8e62d03875d06b24feafd36f8f7 (patch)
treee27cc59112675e052c70c6063f6bcca8e29e103c /compiler
parent8876ed23f1dc6d12a8ae7bf061b7e31c3adf54b4 (diff)
downloadNim-39ebe2175bd4e8e62d03875d06b24feafd36f8f7.tar.gz
compiler almost free of deprecated expr/stmt names
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ast.nim6
-rw-r--r--compiler/ccgmerge.nim2
-rw-r--r--compiler/cgen.nim4
-rw-r--r--compiler/guards.nim16
-rw-r--r--compiler/lexer.nim10
-rw-r--r--compiler/lookups.nim4
-rw-r--r--compiler/modules.nim2
-rw-r--r--compiler/nimsets.nim2
-rw-r--r--compiler/parser.nim4
-rw-r--r--compiler/rodutils.nim2
-rw-r--r--compiler/semdestruct.nim2
-rw-r--r--compiler/semexprs.nim4
-rw-r--r--compiler/semgnrc.nim4
-rw-r--r--compiler/semparallel.nim2
-rw-r--r--compiler/sempass2.nim4
-rw-r--r--compiler/semtempl.nim2
-rw-r--r--compiler/semtypes.nim6
-rw-r--r--compiler/semtypinst.nim2
-rw-r--r--compiler/sigmatch.nim4
-rw-r--r--compiler/vm.nim6
-rw-r--r--compiler/vmdeps.nim18
-rw-r--r--compiler/vmgen.nim4
22 files changed, 55 insertions, 55 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim
index 306fcdedc..277a21ba5 100644
--- a/compiler/ast.nim
+++ b/compiler/ast.nim
@@ -990,12 +990,12 @@ proc add*(father, son: PNode) =
 proc `[]`*(n: PNode, i: int): PNode {.inline.} =
   result = n.sons[i]
 
-template `-|`*(b, s: expr): expr =
+template `-|`*(b, s: untyped): untyped =
   (if b >= 0: b else: s.len + b)
 
 # son access operators with support for negative indices
-template `{}`*(n: PNode, i: int): expr = n[i -| n]
-template `{}=`*(n: PNode, i: int, s: PNode): stmt =
+template `{}`*(n: PNode, i: int): untyped = n[i -| n]
+template `{}=`*(n: PNode, i: int, s: PNode) =
   n.sons[i -| n] = s
 
 when defined(useNodeIds):
diff --git a/compiler/ccgmerge.nim b/compiler/ccgmerge.nim
index 1b2104174..92b6aa9dc 100644
--- a/compiler/ccgmerge.nim
+++ b/compiler/ccgmerge.nim
@@ -113,7 +113,7 @@ proc genMergeInfo*(m: BModule): Rope =
   s.add("*/")
   result = s.rope
 
-template `^`(pos: int): expr = L.buf[pos]
+template `^`(pos: int): untyped = L.buf[pos]
 
 proc skipWhite(L: var TBaseLexer) =
   var pos = L.bufpos
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index 589fcb515..4dbe8572e 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -129,7 +129,7 @@ proc ropecg(m: BModule, frmt: FormatStr, args: varargs[Rope]): Rope =
     if i - 1 >= start:
       add(result, substr(frmt, start, i - 1))
 
-template rfmt(m: BModule, fmt: string, args: varargs[Rope]): expr =
+template rfmt(m: BModule, fmt: string, args: varargs[Rope]): untyped =
   ropecg(m, fmt, args)
 
 proc appcg(m: BModule, c: var Rope, frmt: FormatStr,
@@ -215,7 +215,7 @@ proc accessThreadLocalVar(p: BProc, s: PSym)
 proc emulatedThreadVars(): bool {.inline.}
 proc genProc(m: BModule, prc: PSym)
 
-template compileToCpp(m: BModule): expr =
+template compileToCpp(m: BModule): untyped =
   gCmd == cmdCompileToCpp or sfCompileToCpp in m.module.flags
 
 include "ccgtypes.nim"
diff --git a/compiler/guards.nim b/compiler/guards.nim
index 5ad932e48..4e887d3e3 100644
--- a/compiler/guards.nim
+++ b/compiler/guards.nim
@@ -728,12 +728,12 @@ proc simpleSlice*(a, b: PNode): BiggestInt =
     result = -1
 
 
-template isMul(x): expr = x.getMagic in someMul
-template isDiv(x): expr = x.getMagic in someDiv
-template isAdd(x): expr = x.getMagic in someAdd
-template isSub(x): expr = x.getMagic in someSub
-template isVal(x): expr = x.kind in {nkCharLit..nkUInt64Lit}
-template isIntVal(x, y): expr = x.intVal == y
+template isMul(x): untyped = x.getMagic in someMul
+template isDiv(x): untyped = x.getMagic in someDiv
+template isAdd(x): untyped = x.getMagic in someAdd
+template isSub(x): untyped = x.getMagic in someSub
+template isVal(x): untyped = x.kind in {nkCharLit..nkUInt64Lit}
+template isIntVal(x, y): untyped = x.intVal == y
 
 import macros
 
@@ -776,8 +776,8 @@ proc isMinusOne(n: PNode): bool =
 proc pleViaModel(model: TModel; aa, bb: PNode): TImplication
 
 proc ple(m: TModel; a, b: PNode): TImplication =
-  template `<=?`(a,b): expr = ple(m,a,b) == impYes
-  template `>=?`(a,b): expr = ple(m, nkIntLit.newIntNode(b), a) == impYes
+  template `<=?`(a,b): untyped = ple(m,a,b) == impYes
+  template `>=?`(a,b): untyped = ple(m, nkIntLit.newIntNode(b), a) == impYes
 
   #   0 <= 3
   if a.isValue and b.isValue:
diff --git a/compiler/lexer.nim b/compiler/lexer.nim
index 0a96ed0ba..0eee5004e 100644
--- a/compiler/lexer.nim
+++ b/compiler/lexer.nim
@@ -138,7 +138,7 @@ proc getLineInfo*(L: TLexer, tok: TToken): TLineInfo {.inline.} =
 proc isKeyword*(kind: TTokType): bool =
   result = (kind >= tokKeywordLow) and (kind <= tokKeywordHigh)
 
-template ones(n: expr): expr = ((1 shl n)-1) # for utf-8 conversion
+template ones(n): untyped = ((1 shl n)-1) # for utf-8 conversion
 
 proc isNimIdentifier*(s: string): bool =
   if s[0] in SymStartChars:
@@ -893,10 +893,10 @@ proc scanComment(L: var TLexer, tok: var TToken) =
       inc(indent)
 
     when defined(nimfix):
-      template doContinue(): expr =
+      template doContinue(): untyped =
         buf[pos] == '#' and (col == indent or lastBackslash > 0)
     else:
-      template doContinue(): expr =
+      template doContinue(): untyped =
         buf[pos] == '#' and buf[pos+1] == '#'
     if doContinue():
       tok.literal.add "\n"
@@ -942,9 +942,9 @@ proc skip(L: var TLexer, tok: var TToken) =
           break
       tok.strongSpaceA = 0
       when defined(nimfix):
-        template doBreak(): expr = buf[pos] > ' '
+        template doBreak(): untyped = buf[pos] > ' '
       else:
-        template doBreak(): expr =
+        template doBreak(): untyped =
           buf[pos] > ' ' and (buf[pos] != '#' or buf[pos+1] == '#')
       if doBreak():
         tok.indent = indent
diff --git a/compiler/lookups.nim b/compiler/lookups.nim
index de43c4e4a..9ca864406 100644
--- a/compiler/lookups.nim
+++ b/compiler/lookups.nim
@@ -217,14 +217,14 @@ when defined(nimfix):
     of 'a'..'z': result = getIdent(toLower(x.s[0]) & x.s.substr(1))
     else: result = x
 
-  template fixSpelling(n: PNode; ident: PIdent; op: expr) =
+  template fixSpelling(n: PNode; ident: PIdent; op: untyped) =
     let alt = ident.altSpelling
     result = op(c, alt).skipAlias(n)
     if result != nil:
       prettybase.replaceDeprecated(n.info, ident, alt)
       return result
 else:
-  template fixSpelling(n: PNode; ident: PIdent; op: expr) = discard
+  template fixSpelling(n: PNode; ident: PIdent; op: untyped) = discard
 
 proc errorUseQualifier*(c: PContext; info: TLineInfo; s: PSym) =
   var err = "Error: ambiguous identifier: '" & s.name.s & "'"
diff --git a/compiler/modules.nim b/compiler/modules.nim
index 8df300f5f..1b4746484 100644
--- a/compiler/modules.nim
+++ b/compiler/modules.nim
@@ -38,7 +38,7 @@ proc getModule*(fileIdx: int32): PSym =
   if fileIdx >= 0 and fileIdx < gCompiledModules.len:
     result = gCompiledModules[fileIdx]
 
-template hash(x: PSym): expr =
+template hash(x: PSym): untyped =
   gMemCacheData[x.position].hash
 
 proc hashChanged(fileIdx: int32): bool =
diff --git a/compiler/nimsets.nim b/compiler/nimsets.nim
index f15ad6368..94507adf0 100644
--- a/compiler/nimsets.nim
+++ b/compiler/nimsets.nim
@@ -121,7 +121,7 @@ proc toTreeSet(s: TBitSet, settype: PType, info: TLineInfo): PNode =
       e = b
     inc(e)
 
-template nodeSetOp(a, b: PNode, op: expr) {.dirty.} =
+template nodeSetOp(a, b: PNode, op: untyped) {.dirty.} =
   var x, y: TBitSet
   toBitSet(a, x)
   toBitSet(b, y)
diff --git a/compiler/parser.nim b/compiler/parser.nim
index 2623dea9e..19ef0960a 100644
--- a/compiler/parser.nim
+++ b/compiler/parser.nim
@@ -202,7 +202,7 @@ proc isRightAssociative(tok: TToken): bool {.inline.} =
 
 proc getPrecedence(tok: TToken, strongSpaces: bool): int =
   ## Calculates the precedence of the given token.
-  template considerStrongSpaces(x): expr =
+  template considerStrongSpaces(x): untyped =
     x + (if strongSpaces: 100 - tok.strongSpaceA.int*10 else: 0)
 
   case tok.tokType
@@ -214,7 +214,7 @@ proc getPrecedence(tok: TToken, strongSpaces: bool): int =
     if L > 1 and tok.ident.s[L-1] == '>' and
       tok.ident.s[L-2] in {'-', '~', '='}: return considerStrongSpaces(1)
 
-    template considerAsgn(value: expr) =
+    template considerAsgn(value: untyped) =
       result = if tok.ident.s[L-1] == '=': 1 else: value
 
     case relevantChar
diff --git a/compiler/rodutils.nim b/compiler/rodutils.nim
index 945c94bc6..d24e8f560 100644
--- a/compiler/rodutils.nim
+++ b/compiler/rodutils.nim
@@ -64,7 +64,7 @@ const
 const
   vintDelta = 5
 
-template encodeIntImpl(self: expr) =
+template encodeIntImpl(self) =
   var d: char
   var v = x
   var rem = v mod 190
diff --git a/compiler/semdestruct.nim b/compiler/semdestruct.nim
index 18a1c262f..9ea581f3a 100644
--- a/compiler/semdestruct.nim
+++ b/compiler/semdestruct.nim
@@ -87,7 +87,7 @@ proc destroyCase(c: PContext, n: PNode, holder: PNode): PNode =
     result = nil
 
 proc destroyFieldOrFields(c: PContext, field: PNode, holder: PNode): PNode =
-  template maybeAddLine(e: expr): stmt =
+  template maybeAddLine(e) =
     let stmt = e
     if stmt != nil:
       if result == nil: result = newNode(nkStmtList)
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index d76bd791e..2d5e97fa1 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -1363,7 +1363,7 @@ proc asgnToResultVar(c: PContext, n, le, ri: PNode) {.inline.} =
       n.sons[1] = takeImplicitAddr(c, ri)
       x.typ.flags.incl tfVarIsPtr
 
-template resultTypeIsInferrable(typ: PType): expr =
+template resultTypeIsInferrable(typ: PType): untyped =
   typ.isMetaType and typ.kind != tyTypeDesc
 
 proc semAsgn(c: PContext, n: PNode; mode=asgnNormal): PNode =
@@ -1888,7 +1888,7 @@ proc semWhen(c: PContext, n: PNode, semCheck = true): PNode =
   # the correct branch. Otherwise the AST will be passed through semStmt.
   result = nil
 
-  template setResult(e: expr) =
+  template setResult(e: untyped) =
     if semCheck: result = semExpr(c, e) # do not open a new scope!
     else: result = e
 
diff --git a/compiler/semgnrc.nim b/compiler/semgnrc.nim
index 0fd2e546e..e4fd715da 100644
--- a/compiler/semgnrc.nim
+++ b/compiler/semgnrc.nim
@@ -47,10 +47,10 @@ proc semGenericStmtScope(c: PContext, n: PNode,
   result = semGenericStmt(c, n, flags, ctx)
   closeScope(c)
 
-template macroToExpand(s: expr): expr =
+template macroToExpand(s): untyped =
   s.kind in {skMacro, skTemplate} and (s.typ.len == 1 or sfAllUntyped in s.flags)
 
-template macroToExpandSym(s: expr): expr =
+template macroToExpandSym(s): untyped =
   s.kind in {skMacro, skTemplate} and (s.typ.len == 1)
 
 proc semGenericStmtSymbol(c: PContext, n: PNode, s: PSym,
diff --git a/compiler/semparallel.nim b/compiler/semparallel.nim
index 21429a8d8..90c1a315a 100644
--- a/compiler/semparallel.nim
+++ b/compiler/semparallel.nim
@@ -121,7 +121,7 @@ proc checkLocal(c: AnalysisCtx; n: PNode) =
   else:
     for i in 0 .. <n.safeLen: checkLocal(c, n.sons[i])
 
-template `?`(x): expr = x.renderTree
+template `?`(x): untyped = x.renderTree
 
 proc checkLe(c: AnalysisCtx; a, b: PNode) =
   case proveLe(c.guards, a, b)
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim
index 218ab2704..120c4c774 100644
--- a/compiler/sempass2.nim
+++ b/compiler/sempass2.nim
@@ -151,7 +151,7 @@ proc guardDotAccess(a: PEffects; n: PNode) =
     guardGlobal(a, n, g)
 
 proc makeVolatile(a: PEffects; s: PSym) {.inline.} =
-  template compileToCpp(a): expr =
+  template compileToCpp(a): untyped =
     gCmd == cmdCompileToCpp or sfCompileToCpp in getModule(a.owner).flags
   if a.inTryStmt > 0 and not compileToCpp(a):
     incl(s.flags, sfVolatile)
@@ -459,7 +459,7 @@ proc documentRaises*(n: PNode) =
     if p4 != nil: n.sons[pragmasPos].add p4
     if p5 != nil: n.sons[pragmasPos].add p5
 
-template notGcSafe(t): expr = {tfGcSafe, tfNoSideEffect} * t.flags == {}
+template notGcSafe(t): untyped = {tfGcSafe, tfNoSideEffect} * t.flags == {}
 
 proc importedFromC(n: PNode): bool =
   # when imported from C, we assume GC-safety.
diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim
index 3ee019674..9341e2929 100644
--- a/compiler/semtempl.nim
+++ b/compiler/semtempl.nim
@@ -632,7 +632,7 @@ proc semTemplateDef(c: PContext, n: PNode): PNode =
     c.patterns.add(s)
 
 proc semPatternBody(c: var TemplCtx, n: PNode): PNode =
-  template templToExpand(s: expr): expr =
+  template templToExpand(s: untyped): untyped =
     s.kind == skTemplate and (s.typ.len == 1 or sfAllUntyped in s.flags)
 
   proc newParam(c: var TemplCtx, n: PNode, s: PSym): PNode =
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index 26ce28852..a529e80c0 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -754,18 +754,18 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode,
     addDecl(c, s)
 
   # XXX: There are codegen errors if this is turned into a nested proc
-  template liftingWalk(typ: PType, anonFlag = false): expr =
+  template liftingWalk(typ: PType, anonFlag = false): untyped =
     liftParamType(c, procKind, genericParams, typ, paramName, info, anonFlag)
   #proc liftingWalk(paramType: PType, anon = false): PType =
 
   var paramTypId = if not anon and paramType.sym != nil: paramType.sym.name
                    else: nil
 
-  template maybeLift(typ: PType): expr =
+  template maybeLift(typ: PType): untyped =
     let lifted = liftingWalk(typ)
     (if lifted != nil: lifted else: typ)
 
-  template addImplicitGeneric(e: expr): expr =
+  template addImplicitGeneric(e): untyped =
     addImplicitGenericImpl(e, paramTypId)
 
   case paramType.kind:
diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim
index 076679bbf..12620d55d 100644
--- a/compiler/semtypinst.nim
+++ b/compiler/semtypinst.nim
@@ -511,6 +511,6 @@ proc generateTypeInstance*(p: PContext, pt: TIdTable, info: TLineInfo,
   popInfoContext()
 
 template generateTypeInstance*(p: PContext, pt: TIdTable, arg: PNode,
-                               t: PType): expr =
+                               t: PType): untyped =
   generateTypeInstance(p, pt, arg.info, t)
 
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index b8fd8bf1e..df094402c 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -575,7 +575,7 @@ proc matchUserTypeClass*(c: PContext, m: var TCandidate,
         typ = ff.sons[i]
         param: PSym
 
-      template paramSym(kind): expr =
+      template paramSym(kind): untyped =
         newSym(kind, typeParamName, body.sym, body.sym.info)
 
       case typ.kind
@@ -1585,7 +1585,7 @@ proc incrIndexType(t: PType) =
   assert t.kind == tyArrayConstr
   inc t.sons[0].n.sons[1].intVal
 
-template isVarargsUntyped(x): expr =
+template isVarargsUntyped(x): untyped =
   x.kind == tyVarargs and x.sons[0].kind == tyExpr and
     tfOldSchoolExprStmt notin x.sons[0].flags
 
diff --git a/compiler/vm.nim b/compiler/vm.nim
index ac4ea6ad9..5accf628e 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -115,7 +115,7 @@ template decodeBImm(k: untyped) {.dirty.} =
   let imm = instr.regC - byteExcess
   ensureKind(k)
 
-template decodeBx(k: expr) {.dirty.} =
+template decodeBx(k: untyped) {.dirty.} =
   let rbx = instr.regBx - wordExcess
   ensureKind(k)
 
@@ -162,7 +162,7 @@ proc moveConst(x: var TFullReg, y: TFullReg) =
 
 # this seems to be the best way to model the reference semantics
 # of system.NimNode:
-template asgnRef(x, y: expr) = moveConst(x, y)
+template asgnRef(x, y: untyped) = moveConst(x, y)
 
 proc copyValue(src: PNode): PNode =
   if src == nil or nfIsRef in src.flags:
@@ -233,7 +233,7 @@ proc regToNode(x: TFullReg): PNode =
   of rkRegisterAddr: result = regToNode(x.regAddr[])
   of rkNodeAddr: result = x.nodeAddr[]
 
-template getstr(a: expr): expr =
+template getstr(a: untyped): untyped =
   (if a.kind == rkNode: a.node.strVal else: $chr(int(a.intVal)))
 
 proc pushSafePoint(f: PStackFrame; pc: int) =
diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim
index a10e7c12e..18c5ae832 100644
--- a/compiler/vmdeps.nim
+++ b/compiler/vmdeps.nim
@@ -88,27 +88,27 @@ proc mapTypeToBracketX(name: string; m: TMagic; t: PType; info: TLineInfo;
 proc mapTypeToAstX(t: PType; info: TLineInfo;
                    inst=false; allowRecursionX=false): PNode =
   var allowRecursion = allowRecursionX
-  template atomicType(name, m): expr = atomicTypeX(name, m, t, info)
-  template mapTypeToAst(t,info): expr = mapTypeToAstX(t, info, inst)
-  template mapTypeToAstR(t,info): expr = mapTypeToAstX(t, info, inst, true)
-  template mapTypeToAst(t,i,info): expr =
+  template atomicType(name, m): untyped = atomicTypeX(name, m, t, info)
+  template mapTypeToAst(t,info): untyped = mapTypeToAstX(t, info, inst)
+  template mapTypeToAstR(t,info): untyped = mapTypeToAstX(t, info, inst, true)
+  template mapTypeToAst(t,i,info): untyped =
     if i<t.len and t.sons[i]!=nil: mapTypeToAstX(t.sons[i], info, inst)
     else: ast.emptyNode
-  template mapTypeToBracket(name, m, t, info): expr =
+  template mapTypeToBracket(name, m, t, info): untyped =
     mapTypeToBracketX(name, m, t, info, inst)
-  template newNodeX(kind):expr =
+  template newNodeX(kind): untyped =
     newNodeIT(kind, if t.n.isNil: info else: t.n.info, t)
-  template newIdent(s):expr =
+  template newIdent(s): untyped =
     var r = newNodeX(nkIdent)
     r.add !s
     r
-  template newIdentDefs(n,t):expr =
+  template newIdentDefs(n,t): untyped =
     var id = newNodeX(nkIdentDefs)
     id.add n  # name
     id.add mapTypeToAst(t, info)  # type
     id.add ast.emptyNode  # no assigned value
     id
-  template newIdentDefs(s):expr = newIdentDefs(s, s.typ)
+  template newIdentDefs(s): untyped = newIdentDefs(s, s.typ)
 
   if inst:
     if t.sym != nil:  # if this node has a symbol
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim
index 8991c238f..366662258 100644
--- a/compiler/vmgen.nim
+++ b/compiler/vmgen.nim
@@ -1266,7 +1266,7 @@ proc checkCanEval(c: PCtx; n: PNode) =
 proc isTemp(c: PCtx; dest: TDest): bool =
   result = dest >= 0 and c.prc.slots[dest].kind >= slotTempUnknown
 
-template needsAdditionalCopy(n): expr =
+template needsAdditionalCopy(n): untyped =
   not c.isTemp(dest) and not fitsRegister(n.typ)
 
 proc skipDeref(n: PNode): PNode =
@@ -1404,7 +1404,7 @@ proc genRdVar(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags) =
       # see tests/t99bott for an example that triggers it:
       cannotEval(n)
 
-template needsRegLoad(): expr =
+template needsRegLoad(): untyped =
   gfAddrOf notin flags and fitsRegister(n.typ.skipTypes({tyVar}))
 
 proc genArrAccess2(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode;