this.gir_comment = gir_comment;
this.element = element;
- bool has_instance = false;
- if (element is Api.Method) {
- has_instance = !((Api.Method) element).is_static;
- }
-
// main:
Comment? cmnt = _parse (gir_comment);
Taglets.Param? taglet = _parse_block_taglet (iter.get_value (), "param") as Taglets.Param;
string param_name = iter.get_key ();
- if (taglet != null && !(has_instance && param_name == gir_comment.instance_param_name)) {
- taglet.parameter_name = param_name;
- add_taglet (ref cmnt, taglet);
- }
+ taglet.is_c_self_param = (param_name == gir_comment.instance_param_name);
+ taglet.parameter_name = param_name;
+ add_taglet (ref cmnt, taglet);
}
public bool is_c_self_param { internal set; get; }
+ public bool is_this { private set; get; }
+
+
public Rule? get_parser_rule (Rule run_rule) {
return Rule.seq ({
Rule.option ({ Rule.many ({ TokenType.SPACE }) }),
{
// Check for the existence of such a parameter
unowned string? implicit_return_array_length = null;
+ bool has_instance = has_instance (container);
bool is_implicit = false;
this.parameter = null;
return ;
}
-
- if (parameter_name == "...") {
+ if (is_c_self_param == true && has_instance) {
+ this.parameter_name = "this";
+ this.is_this = true;
+ this.position = 0;
+ } else if (parameter_name == "...") {
Gee.List<Api.Node> params = container.get_children_by_type (Api.NodeType.FORMAL_PARAMETER, false);
foreach (Api.Node param in params) {
if (((Api.FormalParameter) param).ellipsis) {
this.parameter = (Api.Symbol) param;
- this.position = params.size - 1;
+ this.position = (has_instance)? params.size : params.size - 1;
break;
}
}
Gee.List<Api.Node> params = container.get_children_by_types ({Api.NodeType.FORMAL_PARAMETER,
Api.NodeType.TYPE_PARAMETER},
false);
- int pos = 0;
+ int pos = (has_instance)? 1 : 0;
foreach (Api.Node param in params) {
if (param.name == parameter_name) {
base.check (api_root, container, file_path, reporter, settings);
}
+ private bool has_instance (Api.Item element) {
+ if (element is Api.Method) {
+ return !((Api.Method) element).is_static;
+ }
+
+ return false;
+ }
+
public override void accept (ContentVisitor visitor) {
visitor.visit_taglet (this);
}