diff options
-rw-r--r-- | compiler/ccgstmts.nim | 3 | ||||
-rw-r--r-- | compiler/options.nim | 2 | ||||
-rw-r--r-- | compiler/semstmts.nim | 6 | ||||
-rw-r--r-- | compiler/semtempl.nim | 3 | ||||
-rw-r--r-- | compiler/service.nim | 68 |
5 files changed, 4 insertions, 78 deletions
diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index 7fd4ce22d..7bb929d2b 100644 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -340,13 +340,12 @@ proc genIf(p: BProc, n: PNode, d: var TLoc) = # bug #4230: avoid false sharing between branches: if d.k == locTemp and isEmptyType(n.typ): d.k = locNone if it.len == 2: - when newScopeForIf: startBlock(p) + startBlock(p) initLocExprSingleUse(p, it.sons[0], a) lelse = getLabel(p) inc(p.labels) lineF(p, cpsStmts, "if (!$1) goto $2;$n", [rdLoc(a), lelse]) - when not newScopeForIf: startBlock(p) if p.module.compileToCpp: # avoid "jump to label crosses initialization" error: add(p.s(cpsStmts), "{") diff --git a/compiler/options.nim b/compiler/options.nim index 2aa515e35..c6e5c5b9f 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -18,8 +18,6 @@ const useEffectSystem* = true useWriteTracking* = false hasFFI* = defined(useFFI) - newScopeForIf* = true - useCaas* = not defined(noCaas) copyrightYear* = "2018" type # please make sure we have under 32 options diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index bf004a531..6ef03456e 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -155,9 +155,8 @@ proc semIf(c: PContext, n: PNode): PNode = for i in countup(0, sonsLen(n) - 1): var it = n.sons[i] if it.len == 2: - when newScopeForIf: openScope(c) + openScope(c) it.sons[0] = forceBool(c, semExprWithType(c, it.sons[0])) - when not newScopeForIf: openScope(c) it.sons[1] = semExprBranch(c, it.sons[1]) typ = commonType(typ, it.sons[1]) closeScope(c) @@ -212,9 +211,8 @@ proc semCase(c: PContext, n: PNode): PNode = of nkElifBranch: chckCovered = false checkSonsLen(x, 2, c.config) - when newScopeForIf: openScope(c) + openScope(c) x.sons[0] = forceBool(c, semExprWithType(c, x.sons[0])) - when not newScopeForIf: openScope(c) x.sons[1] = semExprBranch(c, x.sons[1]) typ = commonType(typ, x.sons[1]) closeScope(c) diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim index 75c6bc4bb..2952831e9 100644 --- a/compiler/semtempl.nim +++ b/compiler/semtempl.nim @@ -340,9 +340,8 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode = for i in countup(0, sonsLen(n)-1): var it = n.sons[i] if it.len == 2: - when newScopeForIf: openScope(c) + openScope(c) it.sons[0] = semTemplBody(c, it.sons[0]) - when not newScopeForIf: openScope(c) it.sons[1] = semTemplBody(c, it.sons[1]) closeScope(c) else: diff --git a/compiler/service.nim b/compiler/service.nim deleted file mode 100644 index 0e82c03f8..000000000 --- a/compiler/service.nim +++ /dev/null @@ -1,68 +0,0 @@ -# -# -# The Nim Compiler -# (c) Copyright 2015 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -## Implements the "compiler as a service" feature. - -import - times, commands, options, msgs, nimconf, - extccomp, strutils, os, platform, parseopt, idents, lineinfos - -when useCaas: - import net - -# We cache modules and the dependency graph. However, we don't check for -# file changes but expect the client to tell us about them, otherwise the -# repeated hash calculations may turn out to be too slow. - -var - curCaasCmd* = "" - lastCaasCmd* = "" - # in caas mode, the list of defines and options will be given at start-up? - # it's enough to check that the previous compilation command is the same? - -proc serve*(cache: IdentCache; action: proc (cache: IdentCache){.nimcall.}; config: ConfigRef) = - template execute(cmd) = - curCaasCmd = cmd - processCmdLine(passCmd2, cmd, config) - action(cache) - config.errorCounter = 0 - - let typ = getConfigVar(config, "server.type") - case typ - of "stdin": - while true: - var line = stdin.readLine.string - if line == "quit": quit() - execute line - echo "" - flushFile(stdout) - - of "tcp", "": - when useCaas: - var server = newSocket() - let p = getConfigVar(config, "server.port") - let port = if p.len > 0: parseInt(p).Port else: 6000.Port - server.bindAddr(port, getConfigVar(config, "server.address")) - var inp = "".TaintedString - server.listen() - var stdoutSocket = newSocket() - config.writelnHook = proc (line: string) = - stdoutSocket.send(line & "\c\L") - - while true: - accept(server, stdoutSocket) - stdoutSocket.readLine(inp) - execute inp.string - stdoutSocket.send("\c\L") - stdoutSocket.close() - else: - msgQuit "server.type not supported; compiler built without caas support" - else: - echo "Invalid server.type:", typ - msgQuit 1 |