New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support definitionOrder with other declarations #1807
Comments
Missed this earlier... Not really sure why we only do it for classes, maybe we can relax that a little bit.
Either way, I think relying on the original declaration order for this might not be the best approach. Seems like it would be better to run some kind of ordering pass in the generator regardless. Something simple that comes to mind is building a directed graph of the declarations, then running topo sort on it to get the proper ordering. |
Actually I am thinking of adding to the public int ColumnNumberStart { get; set; }
public int ColumnNumberEnd { get; set; } At least we can order then the concrete declarations as parsed in the translation unit. Declaration order is important in certain binding libraries, for example with |
We still need 2 important concepts to implement:
|
Why
DefinitionOrder
is exclusive forClass
and 0 for other declarations?CppSharp/src/CppParser/Parser.cpp
Lines 3988 to 4002 in 1211272
This is useful when we need to sort declarations based on definition order.
Because some scripting languages like
pybind11
: wants every base class registered before the child class, so if the base class is inside a namespace in the sameTranslationUnit
and the registration order is wrong, we get errors.Currently, any declaration other than
Class
has its definition order set to 0.Just a quick question:
DefinitionOrder
is the order of definition as parsed or as created in the AST?Otherwise, we can use source location: line, column.
Edit:
There are only methods for line querying, none for columns:
LineNumberStart
/LineNumberEnd
.The text was updated successfully, but these errors were encountered: