* adding the original this pointer type to the beginning of the
* argument type list and replacing the this pointer type with
* NO_TYPE.
*/
private void fixFunctionType(Node functionNode) {
FunctionType type = JSType.toMaybeFunctionType(functionNode.getJSType());
if (type != null) {
JSTypeRegistry typeRegistry = compiler.getTypeRegistry();
List<JSType> parameterTypes = Lists.newArrayList();
parameterTypes.add(type.getTypeOfThis());
for (Node param : type.getParameters()) {
parameterTypes.add(param.getJSType());
}
ObjectType thisType =
typeRegistry.getNativeObjectType(JSTypeNative.UNKNOWN_TYPE);
JSType returnType = type.getReturnType();
JSType newType = typeRegistry.createFunctionType(
thisType, returnType, parameterTypes);
functionNode.setJSType(newType);
}