From 445a2c883e319a94348751cfa4f10d4c5b93eb52 Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 11 Feb 2020 14:48:20 +0800 Subject: [PATCH] fix compiling error (#2113) id is a keyword in objective-c --- native/cocos/renderer/core/gfx/GFXShader.h | 3 ++- native/tools/tojs/gfx.ini | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/native/cocos/renderer/core/gfx/GFXShader.h b/native/cocos/renderer/core/gfx/GFXShader.h index 20743200b3..9084f1219b 100755 --- a/native/cocos/renderer/core/gfx/GFXShader.h +++ b/native/cocos/renderer/core/gfx/GFXShader.h @@ -15,7 +15,8 @@ class CC_CORE_API GFXShader : public Object { virtual void destroy() = 0; CC_INLINE GFXDevice* device() const { return _device; } - CC_INLINE uint id() const { return _hash; } + // Can not rename to `id` as JS code, because `id` is a keyword in objective-c. + CC_INLINE uint hash() const { return _hash; } CC_INLINE const String& name() const { return _name; } CC_INLINE const GFXShaderStageList& stages() const { return _stages; } CC_INLINE const GFXUniformBlockList& blocks() const { return _blocks; } diff --git a/native/tools/tojs/gfx.ini b/native/tools/tojs/gfx.ini index a36cb997ca..05ba2f4077 100644 --- a/native/tools/tojs/gfx.ini +++ b/native/tools/tojs/gfx.ini @@ -60,7 +60,7 @@ skip = GFXBindingLayout::[GFXBindingLayout device bindingUnits], GFXCommandAllocator::[device], CCMTLCommandAllocator::[clearCommands] -rename_functions = +rename_functions = GFXShader::[hash=id] rename_classes =