Commit 19ec8ac4 authored by Xavier Thompson's avatar Xavier Thompson

Remove const qualifiers from generated code for cypclass methods

parent 4cf301a1
...@@ -2680,6 +2680,7 @@ class CFuncDefNode(FuncDefNode): ...@@ -2680,6 +2680,7 @@ class CFuncDefNode(FuncDefNode):
typ.is_const_method = self.is_const_method typ.is_const_method = self.is_const_method
typ.is_static_method = self.is_static_method typ.is_static_method = self.is_static_method
typ.is_cyp_class_method = self.is_cyp_class_method
self.entry = env.declare_cfunction( self.entry = env.declare_cfunction(
name, typ, self.pos, name, typ, self.pos,
......
...@@ -1840,8 +1840,6 @@ class CConstOrVolatileType(BaseType): ...@@ -1840,8 +1840,6 @@ class CConstOrVolatileType(BaseType):
def cv_string(self): def cv_string(self):
cvstring = "" cvstring = ""
if self.is_cyp_class:
return cvstring
if self.is_const: if self.is_const:
cvstring = "const " + cvstring cvstring = "const " + cvstring
if self.is_volatile: if self.is_volatile:
...@@ -1857,6 +1855,8 @@ class CConstOrVolatileType(BaseType): ...@@ -1857,6 +1855,8 @@ class CConstOrVolatileType(BaseType):
def declaration_code(self, entity_code, def declaration_code(self, entity_code,
for_display = 0, dll_linkage = None, pyrex = 0): for_display = 0, dll_linkage = None, pyrex = 0):
cv = self.cv_string() cv = self.cv_string()
if self.is_cyp_class and not for_display:
cv = ""
if for_display or pyrex: if for_display or pyrex:
return cv + self.cv_base_type.declaration_code(entity_code, for_display, dll_linkage, pyrex) return cv + self.cv_base_type.declaration_code(entity_code, for_display, dll_linkage, pyrex)
else: else:
...@@ -2926,12 +2926,14 @@ class CFuncType(CType): ...@@ -2926,12 +2926,14 @@ class CFuncType(CType):
# (used for optimisation overrides) # (used for optimisation overrides)
# is_const_method boolean # is_const_method boolean
# is_static_method boolean # is_static_method boolean
# is_cyp_class_method boolean
is_cfunction = 1 is_cfunction = 1
original_sig = None original_sig = None
cached_specialized_types = None cached_specialized_types = None
from_fused = False from_fused = False
is_const_method = False is_const_method = False
is_cyp_class_method = False
subtypes = ['return_type', 'args'] subtypes = ['return_type', 'args']
...@@ -3282,7 +3284,7 @@ class CFuncType(CType): ...@@ -3282,7 +3284,7 @@ class CFuncType(CType):
if (not entity_code and cc) or entity_code.startswith("*"): if (not entity_code and cc) or entity_code.startswith("*"):
entity_code = "(%s%s)" % (cc, entity_code) entity_code = "(%s%s)" % (cc, entity_code)
cc = "" cc = ""
if self.is_const_method: if self.is_const_method and (not self.is_cyp_class_method or for_display):
trailer += " const" trailer += " const"
return "%s%s(%s)%s" % (cc, entity_code, arg_decl_code, trailer) return "%s%s(%s)%s" % (cc, entity_code, arg_decl_code, trailer)
...@@ -3293,7 +3295,7 @@ class CFuncType(CType): ...@@ -3293,7 +3295,7 @@ class CFuncType(CType):
return self.return_type.declaration_code(declarator_code, for_display, dll_linkage, pyrex) return self.return_type.declaration_code(declarator_code, for_display, dll_linkage, pyrex)
def function_header_code(self, func_name, arg_code): def function_header_code(self, func_name, arg_code):
if self.is_const_method: if self.is_const_method and not self.is_cyp_class_method:
trailer = " const" trailer = " const"
else: else:
trailer = "" trailer = ""
......
...@@ -134,9 +134,9 @@ ...@@ -134,9 +134,9 @@
struct ActhonResultInterface : public CyObject { struct ActhonResultInterface : public CyObject {
virtual void pushVoidStarResult(void* result) = 0; virtual void pushVoidStarResult(void* result) = 0;
virtual void* getVoidStarResult() const = 0; virtual void* getVoidStarResult() = 0;
virtual void pushIntResult(int result) = 0; virtual void pushIntResult(int result) = 0;
virtual int getIntResult() const = 0; virtual int getIntResult() = 0;
operator int() { return this->getIntResult(); } operator int() { return this->getIntResult(); }
operator void*() { return this->getVoidStarResult(); } operator void*() { return this->getVoidStarResult(); }
}; };
...@@ -144,8 +144,8 @@ ...@@ -144,8 +144,8 @@
struct ActhonMessageInterface; struct ActhonMessageInterface;
struct ActhonSyncInterface : public CyObject { struct ActhonSyncInterface : public CyObject {
virtual int isActivable() const = 0; virtual int isActivable() = 0;
virtual int isCompleted() const = 0; virtual int isCompleted() = 0;
virtual void insertActivity(ActhonMessageInterface* msg) = 0; virtual void insertActivity(ActhonMessageInterface* msg) = 0;
virtual void removeActivity(ActhonMessageInterface* msg) = 0; virtual void removeActivity(ActhonMessageInterface* msg) = 0;
}; };
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
struct ActhonQueueInterface : public CyObject { struct ActhonQueueInterface : public CyObject {
virtual void push(ActhonMessageInterface* message) = 0; virtual void push(ActhonMessageInterface* message) = 0;
virtual int activate() = 0; virtual int activate() = 0;
virtual int is_empty() const = 0; virtual int is_empty() = 0;
}; };
struct ActhonActivableClass : public CyObject { struct ActhonActivableClass : public CyObject {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment