Closed
Description
The following code works on 3.3.0 release but fails from 4.0.0 and later:
import CppHeaderParser
h = """
template <class SomeType> class A {
public:
typedef B <SomeType> C;
A();
protected:
C aCInstance;
};
"""
a = CppHeaderParser.CppHeader(h, "string")
print(a)
The error message is the following:
Traceback (most recent call last):
File "ess.py", line 15, in <module>
a = CppHeaderParser.CppHeader(h, "string")
File "/home/thomas/miniconda3/envs/bindgen/lib/python3.7/site-packages/CppHeaderParser/CppHeaderParser.py", line 2981, in __init__
self.finalize()
File "/home/thomas/miniconda3/envs/bindgen/lib/python3.7/site-packages/CppHeaderParser/CppHeaderParser.py", line 1918, in finalize
self.finalize_vars()
File "/home/thomas/miniconda3/envs/bindgen/lib/python3.7/site-packages/CppHeaderParser/CppHeaderParser.py", line 1664, in finalize_vars
var["raw_type"] = var["method"]["path"] + "::" + tag
KeyError: 'method'
Note that the issue comes from the last line C aCInstance;
. If type is changed to something else but C, string is parse correctly.
ping @rainman110
Metadata
Metadata
Assignees
Labels
No labels