private static void checkNewCall(GoBuiltinCallExpression expression, InspectionResult result) { GoExpr[] arguments = expression.getArguments(); GoPsiType type = expression.getTypeArgument(); if (type == null) { if (arguments.length == 0) { result.addProblem(expression, GoBundle.message("error.missing.argument", "type", "new")); } else { result.addProblem( expression, GoBundle.message("error.expression.is.not.a.type", arguments[0].getText())); } return; } if (arguments.length != 0) { result.addProblem(expression, GoBundle.message("error.too.many.arguments.in.call", "new")); } }
private static void checkMakeCall(GoBuiltinCallExpression expression, InspectionResult result) { GoExpr[] arguments = expression.getArguments(); GoPsiType type = expression.getTypeArgument(); if (type == null) { result.addProblem(expression, GoBundle.message("error.incorrect.make.type")); return; } GoPsiType finalType = resolveToFinalType(type); if (finalType instanceof GoPsiTypeSlice) { checkMakeSliceCall(expression, arguments, result); } else if (finalType instanceof GoPsiTypeChannel) { checkMakeChannelCall(arguments, result); } else if (finalType instanceof GoPsiTypeMap) { checkMakeMapCall(arguments, result); } else { result.addProblem(expression, GoBundle.message("error.cannot.make.type", type.getText())); } }