From 77a8cf7815ea39f51a4148ede50ce597ce727178 Mon Sep 17 00:00:00 2001 From: Ruslan Mustakov Date: Thu, 14 Sep 2017 11:04:34 +0700 Subject: [PATCH] Replace ~ with of --- godot/nim/godotnim.nim | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/godot/nim/godotnim.nim b/godot/nim/godotnim.nim index b4420c0..26ee4be 100644 --- a/godot/nim/godotnim.nim +++ b/godot/nim/godotnim.nim @@ -287,17 +287,12 @@ proc `as`*[T: NimGodotObject](obj: NimGodotObject, t: typedesc[T]): T = T.name & "\n" & getStackTrace()) result = nil -proc `~`*[T: NimGodotObject](obj: NimGodotObject, - t: typedesc[T]): bool {.inline.} = - ## Godot-specific inheritance check. You must use this over Nim's standard - ## ``of`` operator, because Nim does not know which object your script is - ## attached to in runtime. For example, if you create a - ## ``gdobj Bullet of Spatial`` and the ``Bullet`` is attached to a - ## ``MeshInstance``, ``myBullet of MeshInstance`` will return ``false``, but - ## ``myBullet ~ MeshInstance`` will return ``true``. - ## This is going to be changed to ``of`` in later versions, when Nim starts - ## supporting overloading ``of`` operator. - not obj.isNil and (obj of T or obj.linkedObject of T) +proc `of`*[T: NimGodotObject](obj: NimGodotObject, + t: typedesc[T]): bool {.inline.} = + ## Godot-specific inheritance check. + not obj.isNil and (system.`of`(obj, T) or system.`of`(obj.linkedObject, T)) + +{.deprecated: [`~`: `of`].} proc newRStrLit(s: string): NimNode {.compileTime.} = result = newNimNode(nnkRStrLit)