diff options
author | Juan M Gómez <info@jmgomez.me> | 2023-08-10 13:15:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-10 14:15:23 +0200 |
commit | 8625e712503bb36e29ed24a28d484fe7d5af05fa (patch) | |
tree | 381deff8f67846dff74552d9d86affb0f2df9286 /compiler | |
parent | 05f7c4f79db096581352cbe20666f82300d21580 (diff) | |
download | Nim-8625e712503bb36e29ed24a28d484fe7d5af05fa.tar.gz |
adds support for functor in member (#22433)
* adds support for functor in member * improves functor test
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ccgtypes.nim | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 6bac84e95..0b8cca77e 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -1149,14 +1149,19 @@ proc isReloadable(m: BModule; prc: PSym): bool = proc isNonReloadable(m: BModule; prc: PSym): bool = return m.hcrOn and sfNonReloadable in prc.flags -proc parseVFunctionDecl(val: string; name, params, retType, superCall: var string; isFnConst, isOverride, isMemberVirtual: var bool; isCtor: bool) = +proc parseVFunctionDecl(val: string; name, params, retType, superCall: var string; isFnConst, isOverride, isMemberVirtual: var bool; isCtor: bool, isFunctor=false) = var afterParams: string = "" if scanf(val, "$*($*)$s$*", name, params, afterParams): + if name.strip() == "operator" and params == "": #isFunctor? + parseVFunctionDecl(afterParams, name, params, retType, superCall, isFnConst, isOverride, isMemberVirtual, isCtor, true) + return isFnConst = afterParams.find("const") > -1 isOverride = afterParams.find("override") > -1 isMemberVirtual = name.find("virtual ") > -1 if isMemberVirtual: name = name.replace("virtual ", "") + if isFunctor: + name = "operator ()" if isCtor: discard scanf(afterParams, ":$s$*", superCall) else: |