c++ - How to show an error in the Xtext IDE if a type is referenced before it is declared -


we have custom xtext-based dsl , generate c++ code document written in dsl via xtend. here simple example of dsl:

component cmp {     type     {        b member_1;     }      type b     {         string member_1;     } } 

eventually, header file containing c++ structs (based on type elements) generated every component element. following problem occurs: in dsl a , b can correctly resolved (even though b declared later a). when generate c++ code , resource.contents.filter(typeelement) iterate through type elements, delivered in same order declared in document. leads compiler errors resulting c++ header, because b declared later a , cannot resolved compiler without forward declaration.

what want show error in ide in such case (i.e. if reference exists type occurs later in document). there kind of standard validator such scenarios? if not, proper way deal issue?

thank in advance!

there no standard validator forward references. you'd need define 1 one own based on values of cross reference targets. inject ilocationinfileprovider validator obtain region of referenced instance , compare region of reference owner. trick detect forward references.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -