Skip to content

test disabling copy for orig node in calls #24990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: devel
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions compiler/semexprs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType
if n.len == 1: return semObjConstr(c, n, flags, expectedType)
return semConv(c, n, flags)

let nOrig = n.copyTree
let nOrig = n#.copyTree
semOpAux(c, n)
if t != nil and t.kind == tyProc:
# This is a proc variable, apply normal overload resolution
Expand Down Expand Up @@ -1179,7 +1179,7 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType

proc semDirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType = nil): PNode =
# this seems to be a hotspot in the compiler!
let nOrig = n.copyTree
let nOrig = n#.copyTree
#semLazyOpAux(c, n)
result = semOverloadedCallAnalyseEffects(c, n, nOrig, flags, expectedType)
if result != nil: result = afterCallActions(c, result, nOrig, flags, expectedType)
Expand Down Expand Up @@ -1947,7 +1947,9 @@ proc semAsgn(c: PContext, n: PNode; mode=asgnNormal): PNode =
of nkDotExpr:
# r.f = x
# --> `f=` (r, x)
let nOrig = n.copyTree
#let nOrig = #n.copyTree
let nOrig = shallowCopy(n)
for i in 0 ..< n.len: nOrig[i] = n[i]
var flags = {efLValue}
let initialDerefDepth = hiddenDerefDepth(a[0])
a = builtinFieldAccess(c, a, flags)
Expand Down Expand Up @@ -1981,10 +1983,10 @@ proc semAsgn(c: PContext, n: PNode; mode=asgnNormal): PNode =
# a{i} = x --> `{}=`(a, i, x)
# no builtin behavior/magic overloads for curly subscript,
# try `{}=` overloads first then try `{}` overloads for LHS:
let nOrig = n.copyTree
let nOrig = n#.copyTree
result = buildOverloadedSubscripts(n[0], getIdent(c.cache, "{}="))
result.add(n[1])
result = semOverloadedCallAnalyseEffects(c, result, result.copyTree, {efNoUndeclared})
result = semOverloadedCallAnalyseEffects(c, result, result#[.copyTree]#, {efNoUndeclared})
if result != nil:
result = afterCallActions(c, result, nOrig, {})
return
Expand Down
Loading