minor cleanups

This commit is contained in:
Araq 2015-01-07 02:41:50 +01:00
commit b907fac5f9
3 changed files with 3 additions and 25 deletions

View file

@ -19,12 +19,6 @@ import
from magicsys import systemModule, resetSysTypes from magicsys import systemModule, resetSysTypes
const
hasLLVM_Backend = false
when hasLLVM_Backend:
import llvmgen
proc rodPass = proc rodPass =
if optSymbolFiles in gGlobalOptions: if optSymbolFiles in gGlobalOptions:
registerPass(rodwritePass) registerPass(rodwritePass)
@ -111,14 +105,6 @@ proc commandCompileToC =
ccgutils.resetCaches() ccgutils.resetCaches()
GC_fullCollect() GC_fullCollect()
when hasLLVM_Backend:
proc commandCompileToLLVM =
semanticPasses()
registerPass(llvmgen.llvmgenPass())
rodPass()
#registerPass(cleanupPass())
compileProject()
proc commandCompileToJS = proc commandCompileToJS =
#incl(gGlobalOptions, optSafeCode) #incl(gGlobalOptions, optSafeCode)
setTarget(osJS, cpuJS) setTarget(osJS, cpuJS)
@ -290,12 +276,6 @@ proc mainCommand* =
of "js", "compiletojs": of "js", "compiletojs":
gCmd = cmdCompileToJS gCmd = cmdCompileToJS
commandCompileToJS() commandCompileToJS()
of "compiletollvm":
gCmd = cmdCompileToLLVM
when hasLLVM_Backend:
CommandCompileToLLVM()
else:
rawMessage(errInvalidCommandX, command)
of "doc": of "doc":
wantMainModule() wantMainModule()
gCmd = cmdDoc gCmd = cmdDoc

View file

@ -926,8 +926,7 @@ const
proc readTypeParameter(c: PContext, typ: PType, proc readTypeParameter(c: PContext, typ: PType,
paramName: PIdent, info: TLineInfo): PNode = paramName: PIdent, info: TLineInfo): PNode =
let ty = if typ.kind == tyGenericInst: typ.skipGenericAlias let ty = if typ.kind == tyGenericInst: typ.skipGenericAlias
else: (internalAssert(typ.kind == tyCompositeTypeClass); else: (internalAssert(typ.kind == tyCompositeTypeClass); typ.sons[1])
typ.sons[1].skipGenericAlias)
#debug ty #debug ty
let tbody = ty.sons[0] let tbody = ty.sons[0]
for s in countup(0, tbody.len-2): for s in countup(0, tbody.len-2):
@ -966,7 +965,6 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
var ty = n.sons[0].typ var ty = n.sons[0].typ
var f: PSym = nil var f: PSym = nil
result = nil result = nil
if isTypeExpr(n.sons[0]) or (ty.kind == tyTypeDesc and ty.base.kind != tyNone): if isTypeExpr(n.sons[0]) or (ty.kind == tyTypeDesc and ty.base.kind != tyNone):
if ty.kind == tyTypeDesc: ty = ty.base if ty.kind == tyTypeDesc: ty = ty.base
ty = ty.skipTypes(tyDotOpTransparent) ty = ty.skipTypes(tyDotOpTransparent)
@ -1055,7 +1053,7 @@ proc dotTransformation(c: PContext, n: PNode): PNode =
proc semFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode = proc semFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
# this is difficult, because the '.' is used in many different contexts # this is difficult, because the '.' is used in many different contexts
# in Nimrod. We first allow types in the semantic checking. # in Nim. We first allow types in the semantic checking.
result = builtinFieldAccess(c, n, flags) result = builtinFieldAccess(c, n, flags)
if result == nil: if result == nil:
result = dotTransformation(c, n) result = dotTransformation(c, n)

View file

@ -119,7 +119,7 @@ proc newSocket*(domain, typ, protocol: cint, buffered = true): Socket =
result = newSocket(fd, buffered) result = newSocket(fd, buffered)
proc newSocket*(domain: Domain = AF_INET, typ: SockType = SOCK_STREAM, proc newSocket*(domain: Domain = AF_INET, typ: SockType = SOCK_STREAM,
protocol: Protocol = IPPROTO_TCP, buffered = true): Socket = protocol: Protocol = IPPROTO_TCP, buffered = true): Socket =
## Creates a new socket. ## Creates a new socket.
## ##
## If an error occurs EOS will be raised. ## If an error occurs EOS will be raised.