Skip to content

Commit

Permalink
Fix null termination, add ddoc
Browse files Browse the repository at this point in the history
  • Loading branch information
ntrel committed Jan 1, 2018
1 parent 244000b commit fb1e928
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/dmd/func.d
Expand Up @@ -3621,6 +3621,12 @@ extern (C++) final class DeleteDeclaration : FuncDeclaration
}
}

/** Show supplemental error message for a function call with mismatched arguments.
* Params:
* loc = line information for error message
* fargs = arguments to function
* tf = function called
* failIndex = index of first argument mismatch */
void showArgMismatch(Loc loc, Expressions* fargs, TypeFunction tf, size_t failIndex)
{
if (failIndex < fargs.dim && failIndex < tf.parameters.dim)
Expand All @@ -3633,7 +3639,7 @@ void showArgMismatch(Loc loc, Expressions* fargs, TypeFunction tf, size_t failIn
auto msg = "cannot pass %sargument `%s` of type `%s` to parameter `%s`";
// don't print parameter type if it's already in the parameter string
if (strcmp(par.type.toChars(), ts[1]) != 0)
msg ~= " of type `%s`";
msg ~= " of type `%s`\0";
errorSupplemental(loc, msg.ptr,
rv.ptr, arg.toChars(), ts[0], pc, ts[1]);
}
Expand Down
10 changes: 10 additions & 0 deletions src/dmd/hdrgen.d
Expand Up @@ -3425,6 +3425,11 @@ extern (C++) void arrayObjectsToBuffer(OutBuffer* buf, Objects* objects)
}
}

/** Pretty print function parameters.
* Params:
* parameters = parameters to print, such as TypeFunction.parameters.
* varargs = Kind of varargs, see TypeFunction.varargs.
* Returns: NT string representing parameters. */
extern (C++) const(char)* parametersTypeToChars(Parameters* parameters, int varargs)
{
OutBuffer buf;
Expand All @@ -3434,6 +3439,11 @@ extern (C++) const(char)* parametersTypeToChars(Parameters* parameters, int vara
return buf.extractString();
}

/** Pretty print function parameters.
* Params:
* parameter = parameter to print.
* varargs = Kind of varargs, see TypeFunction.varargs.
* Returns: NT string representing parameter. */
extern (C++) const(char)* parameterToChars(Parameter parameter, int varargs)
{
OutBuffer buf;
Expand Down

0 comments on commit fb1e928

Please sign in to comment.