added iterToProc plugin
This commit is contained in:
parent
6361f6b76d
commit
5de900b456
3 changed files with 27 additions and 7 deletions
|
|
@ -7,7 +7,7 @@
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
#
|
#
|
||||||
|
|
||||||
## Plugin support for the Nim compiler. Right now there are no plugins and they
|
## Plugin support for the Nim compiler. Right now they
|
||||||
## need to be build with the compiler, no DLL support.
|
## need to be build with the compiler, no DLL support.
|
||||||
|
|
||||||
import ast, semdata, idents
|
import ast, semdata, idents
|
||||||
|
|
@ -20,13 +20,16 @@ type
|
||||||
next: Plugin
|
next: Plugin
|
||||||
|
|
||||||
proc pluginMatches(p: Plugin; s: PSym): bool =
|
proc pluginMatches(p: Plugin; s: PSym): bool =
|
||||||
if s.name.id != p.fn.id: return false
|
if s.name.id != p.fn.id:
|
||||||
let module = s.owner
|
return false
|
||||||
|
let module = s.owner.skipGenericOwner
|
||||||
if module == nil or module.kind != skModule or
|
if module == nil or module.kind != skModule or
|
||||||
module.name.id != p.module.id: return false
|
module.name.id != p.module.id:
|
||||||
|
return false
|
||||||
let package = module.owner
|
let package = module.owner
|
||||||
if package == nil or package.kind != skPackage or
|
if package == nil or package.kind != skPackage or
|
||||||
package.name.id != p.package.id: return false
|
package.name.id != p.package.id:
|
||||||
|
return false
|
||||||
return true
|
return true
|
||||||
|
|
||||||
var head: Plugin
|
var head: Plugin
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,4 @@
|
||||||
## Include file that imports all plugins that are active.
|
## Include file that imports all plugins that are active.
|
||||||
|
|
||||||
import
|
import
|
||||||
locals.locals
|
locals.locals, itersgen
|
||||||
|
|
|
||||||
|
|
@ -1780,7 +1780,24 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
|
||||||
result = setMs(n, s)
|
result = setMs(n, s)
|
||||||
result.sons[1] = semExpr(c, n.sons[1])
|
result.sons[1] = semExpr(c, n.sons[1])
|
||||||
result.typ = n[1].typ
|
result.typ = n[1].typ
|
||||||
else: result = semDirectOp(c, n, flags)
|
of mPlugin:
|
||||||
|
# semDirectOp with conditional 'afterCallActions':
|
||||||
|
let nOrig = n.copyTree
|
||||||
|
#semLazyOpAux(c, n)
|
||||||
|
result = semOverloadedCallAnalyseEffects(c, n, nOrig, flags)
|
||||||
|
if result == nil:
|
||||||
|
result = errorNode(c, n)
|
||||||
|
else:
|
||||||
|
let callee = result.sons[0].sym
|
||||||
|
if callee.magic == mNone:
|
||||||
|
semFinishOperands(c, result)
|
||||||
|
activate(c, result)
|
||||||
|
fixAbstractType(c, result)
|
||||||
|
analyseIfAddressTakenInCall(c, result)
|
||||||
|
if callee.magic != mNone:
|
||||||
|
result = magicsAfterOverloadResolution(c, result, flags)
|
||||||
|
else:
|
||||||
|
result = semDirectOp(c, n, flags)
|
||||||
|
|
||||||
proc semWhen(c: PContext, n: PNode, semCheck = true): PNode =
|
proc semWhen(c: PContext, n: PNode, semCheck = true): PNode =
|
||||||
# If semCheck is set to false, ``when`` will return the verbatim AST of
|
# If semCheck is set to false, ``when`` will return the verbatim AST of
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue