{
newDef = new FunctionDefinition(name);
newDef.setReturnTypeReference(defaultFunc.getReturnTypeReference());
}
ASScope newScope = new FunctionScope(scope);
newDef.setContainedScope(newScope);
newDef.setNamespaceReference(defaultDef.getNamespaceReference());
if (info != null)
{
if (info.returnIsTypeOfCollection())
newDef.setReturnTypeReference(ReferenceFactory.resolvedReference(elementType));
else if (info.returnIsVector())
newDef.setReturnTypeReference(ReferenceFactory.resolvedReference(this));
}
ParameterDefinition[] params = defaultFunc.getParameters();
if (params != null)
{
VectorInformation.ArgumentInfo[] args = info != null ? info.getArgumentInfo() : null;
ParameterDefinition[] newParams = new ParameterDefinition[params.length];
for (int i = 0, l = params.length; i < l; ++i)
{
if (args != null && i < args.length)
{
newParams[i] = copyParameter(project, params[i], args[i]);
if (args[i].returnIsVector())
newParams[i].setTypeReference(ReferenceFactory.resolvedReference(this));
else if (args[i].returnIsTypeOfCollection())
newParams[i].setTypeReference(ReferenceFactory.resolvedReference(elementType));
}
else
{
newParams[i] = copyParameter(project, params[i], null);
}
newScope.addDefinition(newParams[i]);
}
newDef.setParameters(newParams);
}
scope.addDefinition(newDef);