opencv_js: fix a bug in handling enums using the new parser

This commit is contained in:
Hamdi Sahloul 2018-09-08 18:23:22 +09:00
parent 40b1dc12de
commit c6ed2bf9aa

View File

@ -369,7 +369,7 @@ class JSWrapperGenerator(object):
return namespace, classes, chunks[-1]
def add_enum(self, decl):
name = decl[1]
name = decl[0].rsplit(" ", 1)[1]
namespace, classes, val = self.split_decl_name(name)
namespace = '.'.join(namespace)
val = '_'.join(classes + [name])
@ -384,6 +384,12 @@ class JSWrapperGenerator(object):
for item in decl[3]:
ns.enums[name].append(item)
const_decls = decl[3]
for decl in const_decls:
name = decl[0]
self.add_const(name.replace("const ", "").strip(), decl)
def add_const(self, name, decl):
cname = name.replace('.','::')
namespace, classes, name = self.split_decl_name(name)