Skip to content

Commit 7bd4401

Browse files
vrabaudshyama7004
authored andcommitted
Merge pull request opencv#26640 from vrabaud:opencv_js3
js: fix generation of "const const" in code opencv#26640 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
1 parent 6f3fafc commit 7bd4401

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

modules/js/generator/embindgen.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,17 @@ def __init__(self, arg_tuple):
248248
self.const = True
249249
elif m == "/Ref":
250250
self.reference = True
251-
if self.tp == "Mat":
252-
if self.outputarg:
253-
self.tp = "cv::Mat&"
254-
elif self.inputarg:
255-
self.tp = "const cv::Mat&"
256-
if self.tp == "vector_Mat":
257-
if self.outputarg:
258-
self.tp = "std::vector<cv::Mat>&"
259-
elif self.inputarg:
260-
self.tp = "const std::vector<cv::Mat>&"
251+
if self.tp == "Mat" and (self.inputarg or self.outputarg):
252+
self.tp = "cv::Mat&"
253+
if self.inputarg and not self.outputarg:
254+
self.const = True
255+
if self.tp == "vector_Mat" and (self.inputarg or self.outputarg):
256+
self.tp = "std::vector<cv::Mat>&"
257+
if self.reference and not self.const:
258+
self.inputarg = False
259+
self.outputarg = True
260+
elif self.inputarg and not self.outputarg:
261+
self.const = True
261262
self.tp = handle_vector(self.tp).strip()
262263
if self.const:
263264
self.tp = "const " + self.tp

0 commit comments

Comments
 (0)