mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-07 12:24:19 +00:00
Fixes based on @Araq's feedback.
This commit is contained in:
@@ -1598,7 +1598,7 @@ proc toObject*(typ: PType): PType =
|
||||
## Otherwise ``typ`` is simply returned as-is.
|
||||
result = typ
|
||||
if result.kind == tyRef:
|
||||
result = result.sons[0]
|
||||
result = result.lastSon
|
||||
|
||||
when false:
|
||||
proc containsNil*(n: PNode): bool =
|
||||
|
||||
@@ -286,7 +286,8 @@ proc semTry(c: PContext, n: PNode): PNode =
|
||||
var typeNode = a.sons[j] # e.g. `Exception`
|
||||
var symbolNode: PNode = nil # e.g. `foobar`
|
||||
# Handle the case where the `Exception as foobar` syntax is used.
|
||||
if typeNode.kind == nkInfix:
|
||||
if typeNode.kind == nkInfix and
|
||||
considerQuotedIdent(typeNode[0]).s == "as":
|
||||
typeNode = a.sons[j].sons[1]
|
||||
symbolNode = a.sons[j].sons[2]
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
import
|
||||
intsets, strutils, lists, options, ast, astalgo, trees, treetab, msgs, os,
|
||||
idents, renderer, types, passes, semfold, magicsys, cgmeth, rodread,
|
||||
lambdalifting, sempass2, lowerings
|
||||
lambdalifting, sempass2, lowerings, lookups
|
||||
|
||||
# implementation
|
||||
|
||||
@@ -703,7 +703,7 @@ proc transformCall(c: PTransf, n: PNode): PTransNode =
|
||||
|
||||
proc transformExceptBranch(c: PTransf, n: PNode): PTransNode =
|
||||
result = transformSons(c, n)
|
||||
if n[0].kind == nkInfix:
|
||||
if n[0].kind == nkInfix and considerQuotedIdent(n[0][0]).s == "as":
|
||||
let excTypeNode = n[0][1]
|
||||
let actions = newTransNode(nkStmtList, n[1].info, 2)
|
||||
# Generating `let exc = (excType)(getCurrentException())`
|
||||
|
||||
Reference in New Issue
Block a user