bugfixes
This commit is contained in:
parent
0991706d55
commit
3aa36a8568
4 changed files with 19 additions and 3 deletions
|
|
@ -600,6 +600,7 @@ proc loadDynamicLib(m: BModule, lib: PLib) =
|
||||||
[loadlib, getStrLit(m, lib.path.strVal)])
|
[loadlib, getStrLit(m, lib.path.strVal)])
|
||||||
else:
|
else:
|
||||||
var p = newProc(nil, m)
|
var p = newProc(nil, m)
|
||||||
|
p.options = p.options - {optStackTrace, optEndb}
|
||||||
var dest: TLoc
|
var dest: TLoc
|
||||||
initLocExpr(p, lib.path, dest)
|
initLocExpr(p, lib.path, dest)
|
||||||
app(m.s[cfsVars], p.s(cpsLocals))
|
app(m.s[cfsVars], p.s(cpsLocals))
|
||||||
|
|
|
||||||
|
|
@ -1146,6 +1146,12 @@ proc semProcBody(c: PContext, n: PNode): PNode =
|
||||||
# discard it. This is bad for chaining but nicer for C wrappers.
|
# discard it. This is bad for chaining but nicer for C wrappers.
|
||||||
# ambiguous :-(
|
# ambiguous :-(
|
||||||
result.typ = nil
|
result.typ = nil
|
||||||
|
elif result.kind == nkStmtListExpr and result.typ.kind == tyNil:
|
||||||
|
# to keep backwards compatibility bodies like:
|
||||||
|
# nil
|
||||||
|
# # comment
|
||||||
|
# are not expressions:
|
||||||
|
fixNilType(result)
|
||||||
else:
|
else:
|
||||||
var a = newNodeI(nkAsgn, n.info, 2)
|
var a = newNodeI(nkAsgn, n.info, 2)
|
||||||
a.sons[0] = newSymNode(c.p.resultSym)
|
a.sons[0] = newSymNode(c.p.resultSym)
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,16 @@ proc semExprBranchScope(c: PContext, n: PNode): PNode =
|
||||||
result = semExprBranch(c, n)
|
result = semExprBranch(c, n)
|
||||||
closeScope(c.tab)
|
closeScope(c.tab)
|
||||||
|
|
||||||
|
proc meaningfulStmt(n: PNode): PNode =
|
||||||
|
assert n.kind == nkStmtListExpr
|
||||||
|
var last = n.len-1
|
||||||
|
while last > 0 and n.sons[last].kind in {nkPragma, nkCommentStmt, nkEmpty}:
|
||||||
|
dec last
|
||||||
|
result = n.sons[last]
|
||||||
|
|
||||||
proc ImplicitlyDiscardable(n: PNode): bool =
|
proc ImplicitlyDiscardable(n: PNode): bool =
|
||||||
|
var n = n
|
||||||
|
while n.kind == nkStmtListExpr: n = meaningfulStmt(n)
|
||||||
result = isCallExpr(n) and n.sons[0].kind == nkSym and
|
result = isCallExpr(n) and n.sons[0].kind == nkSym and
|
||||||
sfDiscardable in n.sons[0].sym.flags
|
sfDiscardable in n.sons[0].sym.flags
|
||||||
|
|
||||||
|
|
@ -115,6 +124,8 @@ proc fixNilType(n: PNode) =
|
||||||
for it in n: fixNilType(it)
|
for it in n: fixNilType(it)
|
||||||
n.typ = nil
|
n.typ = nil
|
||||||
|
|
||||||
|
var EnforceVoidContext = PType(kind: tyStmt)
|
||||||
|
|
||||||
proc discardCheck(result: PNode) =
|
proc discardCheck(result: PNode) =
|
||||||
if result.typ != nil and result.typ.kind notin {tyStmt, tyEmpty}:
|
if result.typ != nil and result.typ.kind notin {tyStmt, tyEmpty}:
|
||||||
if result.kind == nkNilLit:
|
if result.kind == nkNilLit:
|
||||||
|
|
@ -1060,8 +1071,6 @@ proc semStaticStmt(c: PContext, n: PNode): PNode =
|
||||||
result = newNodeI(nkDiscardStmt, n.info, 1)
|
result = newNodeI(nkDiscardStmt, n.info, 1)
|
||||||
result.sons[0] = emptyNode
|
result.sons[0] = emptyNode
|
||||||
|
|
||||||
var EnforceVoidContext = PType(kind: tyStmt)
|
|
||||||
|
|
||||||
proc semStmtList(c: PContext, n: PNode): PNode =
|
proc semStmtList(c: PContext, n: PNode): PNode =
|
||||||
# these must be last statements in a block:
|
# these must be last statements in a block:
|
||||||
const
|
const
|
||||||
|
|
|
||||||
|
|
@ -264,10 +264,10 @@ proc request*(url: string, httpMethod = httpGET, extraHeaders = "",
|
||||||
if r.scheme == "https":
|
if r.scheme == "https":
|
||||||
when defined(ssl):
|
when defined(ssl):
|
||||||
sslContext.wrapSocket(s)
|
sslContext.wrapSocket(s)
|
||||||
|
port = TPort(443)
|
||||||
else:
|
else:
|
||||||
raise newException(EHttpRequestErr,
|
raise newException(EHttpRequestErr,
|
||||||
"SSL support is not available. Cannot connect over SSL.")
|
"SSL support is not available. Cannot connect over SSL.")
|
||||||
port = TPort(443)
|
|
||||||
if r.port != "":
|
if r.port != "":
|
||||||
port = TPort(r.port.parseInt)
|
port = TPort(r.port.parseInt)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue