diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/astalgo.nim | 5 | ||||
-rw-r--r-- | compiler/ccgutils.nim | 6 | ||||
-rw-r--r-- | compiler/llstream.nim | 2 | ||||
-rw-r--r-- | compiler/lookups.nim | 2 | ||||
-rw-r--r-- | compiler/passes.nim | 2 | ||||
-rw-r--r-- | compiler/semcall.nim | 2 | ||||
-rw-r--r-- | compiler/semstmts.nim | 3 | ||||
-rw-r--r-- | compiler/sigmatch.nim | 6 |
8 files changed, 15 insertions, 13 deletions
diff --git a/compiler/astalgo.nim b/compiler/astalgo.nim index 79c386080..8d132ab26 100644 --- a/compiler/astalgo.nim +++ b/compiler/astalgo.nim @@ -681,9 +681,8 @@ proc initIdentIter(ti: var TIdentIter, tab: TStrTable, s: PIdent): PSym = else: result = nextIdentIter(ti, tab) proc nextIdentIter(ti: var TIdentIter, tab: TStrTable): PSym = - var h, start: THash - h = ti.h and high(tab.data) - start = h + var h = ti.h and high(tab.data) + var start = h result = tab.data[h] while result != nil: if result.name.id == ti.name.id: break diff --git a/compiler/ccgutils.nim b/compiler/ccgutils.nim index 134619d4a..59b9611fc 100644 --- a/compiler/ccgutils.nim +++ b/compiler/ccgutils.nim @@ -99,7 +99,7 @@ proc getUniqueType*(key: PType): PType = gCanonicalTypes[k] = key result = key of tyTypeDesc, tyTypeClasses, tyGenericParam, tyFromExpr, tyFieldAccessor: - internalError("GetUniqueType") + internalError("getUniqueType") of tyDistinct: if key.deepCopy != nil: result = key else: result = getUniqueType(lastSon(key)) @@ -133,9 +133,9 @@ proc getUniqueType*(key: PType): PType = else: # ugly slow case: need to compare by structure if idTableHasObjectAsKey(gTypeTable[k], key): return key - for h in countup(0, high(gTypeTable[k].data)): + for h in countup(0, high(gTypeTable[k].data)): var t = PType(gTypeTable[k].data[h].key) - if t != nil and sameType(t, key): + if t != nil and sameBackendType(t, key): return t idTablePut(gTypeTable[k], key, key) result = key diff --git a/compiler/llstream.nim b/compiler/llstream.nim index 69475965d..18ca4aec7 100644 --- a/compiler/llstream.nim +++ b/compiler/llstream.nim @@ -35,7 +35,7 @@ proc llStreamOpen*(data: string): PLLStream = result.s = data result.kind = llsString -proc llStreamOpen*(f: var File): PLLStream = +proc llStreamOpen*(f: File): PLLStream = new(result) result.f = f result.kind = llsFile diff --git a/compiler/lookups.nim b/compiler/lookups.nim index 21d07f280..6d3379bb9 100644 --- a/compiler/lookups.nim +++ b/compiler/lookups.nim @@ -176,7 +176,7 @@ proc addInterfaceDeclAux(c: PContext, sym: PSym) = if sfExported in sym.flags: # add to interface: if c.module != nil: strTableAdd(c.module.tab, sym) - else: internalError(sym.info, "AddInterfaceDeclAux") + else: internalError(sym.info, "addInterfaceDeclAux") proc addInterfaceDeclAt*(c: PContext, scope: PScope, sym: PSym) = addDeclAt(scope, sym) diff --git a/compiler/passes.nim b/compiler/passes.nim index df4816653..96088bd88 100644 --- a/compiler/passes.nim +++ b/compiler/passes.nim @@ -172,7 +172,7 @@ proc processModule(module: PSym, stream: PLLStream, rd: PRodReader) = let filename = fileIdx.toFullPathConsiderDirty if module.name.s == "-": module.name.s = "stdinfile" - s = llStreamOpenStdIn() + s = llStreamOpen(stdin) else: s = llStreamOpen(filename, fmRead) if s == nil: diff --git a/compiler/semcall.nim b/compiler/semcall.nim index 56cc9dd9e..d92e1ab20 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -42,7 +42,7 @@ proc pickBestCandidate(c: PContext, headSymbol: PNode, errors: var CandidateErrors) = var o: TOverloadIter var sym = initOverloadIter(o, c, headSymbol) - var symScope = o.lastOverloadScope + let symScope = o.lastOverloadScope var z: TCandidate diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 10c74e7ea..3fbb6f8f3 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -786,7 +786,8 @@ proc semProcAnnotation(c: PContext, prc: PNode; result = semStmt(c, x) # since a proc annotation can set pragmas, we process these here again. # This is required for SqueakNim-like export pragmas. - if result[namePos].kind == nkSym and result[pragmasPos].kind != nkEmpty: + if result.kind in procDefs and result[namePos].kind == nkSym and + result[pragmasPos].kind != nkEmpty: pragma(c, result[namePos].sym, result[pragmasPos], validPragmas) return diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 9f1e98190..a1b5c8dc9 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1270,9 +1270,11 @@ proc paramTypesMatchAux(m: var TCandidate, f, argType: PType, of isGeneric: inc(m.genericMatches) when true: - if skipTypes(arg.typ, abstractVar-{tyTypeDesc}).kind == tyTuple: + if arg.typ == nil: + result = arg + elif skipTypes(arg.typ, abstractVar-{tyTypeDesc}).kind == tyTuple: result = implicitConv(nkHiddenStdConv, f, copyTree(arg), m, c) - elif arg.typ != nil and arg.typ.isEmptyContainer: + elif arg.typ.isEmptyContainer: result = arg.copyTree result.typ = getInstantiatedType(c, arg, m, f) else: |