summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-06-25 19:43:07 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-08-16 17:04:59 -0300
commit54a2d24c74d15c255f157a1d86a38df9a397a9dc (patch)
tree909fc6da78afb6a8338c7ee1dd0f763b8d0bf8b5
parent8b7161c077f5eb25037969e5ab01aa58c6c6a1aa (diff)
testgen: Reimplement direction modifier according to C#
Some automated tests were giving different results regarding @cref Slices
-rw-r--r--src/scripts/testgen/ekeys.py43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/scripts/testgen/ekeys.py b/src/scripts/testgen/ekeys.py
index 055db808ff..a37ca27e63 100644
--- a/src/scripts/testgen/ekeys.py
+++ b/src/scripts/testgen/ekeys.py
@@ -169,15 +169,38 @@ class EMonoKeys(EKeys):
169 "efl_constructor", 169 "efl_constructor",
170 ] 170 ]
171 171
172 self.struct_blacklist = [
173 "Efl.Event_Description",
174 "Eina.Binbuf",
175 "Eina.Strbuf",
176 "Eina.Slice",
177 "Eina.Rw_Slice",
178 "Eina.Promise",
179 "Eina.Value",
180 "Eina.Value_Type",
181 "Eina.Future",
182 ]
183
172 def escape_keyword(self, key): 184 def escape_keyword(self, key):
173 key = "kw_{}".format(key) if key in self.keywords else key 185 key = "kw_{}".format(key) if key in self.keywords else key
174 return "{}Add".format(key) if key == "Finalize" else key 186 return "{}Add".format(key) if key == "Finalize" else key
175 187
176 def direction_get(self, direction): 188 def direction_get(self, param):
189 direction = param.direction
190
177 if direction == direction.INOUT: 191 if direction == direction.INOUT:
178 return "ref" 192 return "ref"
179 if direction == direction.OUT: 193 elif direction != direction.IN:
180 return "out" 194 if param.type.name in ("Eina.Slice", "Eina.Rw_Slice"):
195 return "ref"
196 else:
197 return "out"
198 elif (direction == direction.IN) and param.type.is_ptr:
199 if param.type.typedecl and (
200 param.type.typedecl.type == param.type.typedecl.type.STRUCT
201 ):
202 return "ref" if param.type.name not in self.struct_blacklist else None
203
181 return None 204 return None
182 205
183 def klass_name(self, eotype): 206 def klass_name(self, eotype):
@@ -210,19 +233,7 @@ class EMonoKeys(EKeys):
210 233
211 def print_arg(self, eoarg): 234 def print_arg(self, eoarg):
212 r = super().print_arg(eoarg) 235 r = super().print_arg(eoarg)
213 prefix = self.direction_get(eoarg.direction) or None 236 prefix = self.direction_get(eoarg) or None
214
215 if prefix == "out" and (eoarg.type.name in ("Eina.Slice", "Eina.Rw_Slice")):
216 prefix = "ref"
217
218 if (
219 not prefix
220 and eoarg.type.is_ptr
221 and eoarg.type.type == eoarg.type.type.REGULAR
222 and eoarg.type.typedecl
223 and eoarg.type.typedecl.type == eoarg.type.typedecl.type.STRUCT
224 ):
225 prefix = "ref"
226 237
227 return " ".join([prefix, r]) if prefix else r 238 return " ".join([prefix, r]) if prefix else r
228 239