[Vala] Adding comments during code generation



So that the code generator can annotate generated code with it's own
comments, I think that CCodeNode needs to have a comment field (clearly
not a CCodeComment).

The writer methods of *Declaration classes will write out the comment
field with each declarator.

When a declarator is created, e.g.
  var cv=new CCodeVariableDeclarator.with_initializer ("self", cself)

it can have a comment attached, like:
  cv.prefix_comment("create field to store delegate target");

or maybe a default construction parameter:
  cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer
("self", cself, "create field to store delegate target"));

It will greatly aid the understanding of the vala compiler, by making it
easy to track down the generator of bad code.

Is there a better way to have generator comments in the generated code?

Sam



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]