mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 02:12:11 +00:00
produce errors on proc types with implicit empty param lists.
This commit is contained in:
@@ -608,7 +608,7 @@ proc parseParamList(p: var TParser, retColon = true): PNode =
|
||||
var a: PNode
|
||||
result = newNodeP(nkFormalParams, p)
|
||||
addSon(result, ast.emptyNode) # return type
|
||||
if p.tok.tokType == tkParLe:
|
||||
if p.tok.tokType == tkParLe:
|
||||
getTok(p)
|
||||
optInd(p, result)
|
||||
while true:
|
||||
@@ -626,9 +626,9 @@ proc parseParamList(p: var TParser, retColon = true): PNode =
|
||||
optInd(p, a)
|
||||
optPar(p)
|
||||
eat(p, tkParRi)
|
||||
let b = if retColon: p.tok.tokType == tkColon
|
||||
else: p.tok.tokType == tkOpr and IdentEq(p.tok.ident, "->")
|
||||
if b:
|
||||
let hasRet = if retColon: p.tok.tokType == tkColon
|
||||
else: p.tok.tokType == tkOpr and IdentEq(p.tok.ident, "->")
|
||||
if hasRet:
|
||||
getTok(p)
|
||||
optInd(p, result)
|
||||
result.sons[0] = parseTypeDesc(p)
|
||||
@@ -662,6 +662,7 @@ proc parseProcExpr(p: var TParser, isExpr: bool): PNode =
|
||||
info: TLineInfo
|
||||
info = parLineInfo(p)
|
||||
getTok(p)
|
||||
let hasSignature = p.tok.tokType in {tkParLe, tkColon}
|
||||
params = parseParamList(p)
|
||||
pragmas = optPragmas(p)
|
||||
if (p.tok.tokType == tkEquals) and isExpr:
|
||||
@@ -675,8 +676,9 @@ proc parseProcExpr(p: var TParser, isExpr: bool): PNode =
|
||||
addSon(result, parseStmt(p))
|
||||
else:
|
||||
result = newNodeI(nkProcTy, info)
|
||||
addSon(result, params)
|
||||
addSon(result, pragmas)
|
||||
if hasSignature:
|
||||
addSon(result, params)
|
||||
addSon(result, pragmas)
|
||||
|
||||
proc isExprStart(p: TParser): bool =
|
||||
case p.tok.tokType
|
||||
|
||||
@@ -1889,7 +1889,7 @@ proc setpwent*() {.importc, header: "<pwd.h>".}
|
||||
|
||||
proc uname*(a1: var Tutsname): cint {.importc, header: "<sys/utsname.h>".}
|
||||
|
||||
proc pthread_atfork*(a1, a2, a3: proc {.noconv.}): cint {.
|
||||
proc pthread_atfork*(a1, a2, a3: proc () {.noconv.}): cint {.
|
||||
importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_destroy*(a1: ptr Tpthread_attr): cint {.
|
||||
importc, header: "<pthread.h>".}
|
||||
@@ -2015,7 +2015,7 @@ proc pthread_mutexattr_setprotocol*(a1: ptr Tpthread_mutexattr, a2: cint): cint
|
||||
proc pthread_mutexattr_setpshared*(a1: ptr Tpthread_mutexattr, a2: cint): cint {.importc, header: "<pthread.h>".}
|
||||
proc pthread_mutexattr_settype*(a1: ptr Tpthread_mutexattr, a2: cint): cint {.importc, header: "<pthread.h>".}
|
||||
|
||||
proc pthread_once*(a1: ptr Tpthread_once, a2: proc {.noconv.}): cint {.importc, header: "<pthread.h>".}
|
||||
proc pthread_once*(a1: ptr Tpthread_once, a2: proc () {.noconv.}): cint {.importc, header: "<pthread.h>".}
|
||||
|
||||
proc pthread_rwlock_destroy*(a1: ptr Tpthread_rwlock): cint {.importc, header: "<pthread.h>".}
|
||||
proc pthread_rwlock_init*(a1: ptr Tpthread_rwlock,
|
||||
|
||||
@@ -971,7 +971,7 @@ proc toBiggestInt*(f: biggestfloat): biggestint {.
|
||||
## rounds `f` if it does not contain an integer value. If the conversion
|
||||
## fails (because `f` is infinite for example), `EInvalidValue` is raised.
|
||||
|
||||
proc addQuitProc*(QuitProc: proc {.noconv.}) {.importc: "atexit", nodecl.}
|
||||
proc addQuitProc*(QuitProc: proc() {.noconv.}) {.importc: "atexit", nodecl.}
|
||||
## adds/registers a quit procedure. Each call to ``addQuitProc``
|
||||
## registers another quit procedure. Up to 30 procedures can be
|
||||
## registered. They are executed on a last-in, first-out basis
|
||||
@@ -1511,7 +1511,7 @@ const nimrodStackTrace = compileOption("stacktrace")
|
||||
# of the code
|
||||
|
||||
var
|
||||
dbgLineHook*: proc
|
||||
dbgLineHook*: proc ()
|
||||
## set this variable to provide a procedure that should be called before
|
||||
## each executed instruction. This should only be used by debuggers!
|
||||
## Only code compiled with the ``debugger:on`` switch calls this hook.
|
||||
@@ -1531,7 +1531,7 @@ var
|
||||
## do when setting this. If ``localRaiseHook`` returns false, the exception
|
||||
## is caught and does not propagate further through the call stack.
|
||||
|
||||
outOfMemHook*: proc
|
||||
outOfMemHook*: proc ()
|
||||
## set this variable to provide a procedure that should be called
|
||||
## in case of an `out of memory`:idx: event. The standard handler
|
||||
## writes an error message and terminates the program. `outOfMemHook` can
|
||||
|
||||
Reference in New Issue
Block a user