1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

js: backport PR18985

original commit: b82700ae41
This commit is contained in:
Steffen Urban
2020-12-18 13:01:48 +01:00
committed by Alexander Alekhin
parent 9b4adc9acb
commit c2bc171ef6
3 changed files with 15 additions and 4 deletions
+4 -2
View File
@@ -634,8 +634,10 @@ class JSWrapperGenerator(object):
ret_type = type_dict[ptr_type]
for key in type_dict:
if key in ret_type:
ret_type = ret_type.replace(key, type_dict[key])
# Replace types. Instead of ret_type.replace we use regular
# expression to exclude false matches.
# See https://github.com/opencv/opencv/issues/15514
ret_type = re.sub('(^|[^\w])' + key + '($|[^\w])', type_dict[key], ret_type)
if variant.constret and ret_type.startswith('const') == False:
ret_type = 'const ' + ret_type
if variant.refret and ret_type.endswith('&') == False: