private void checkValOnAnnotationParameter(JetClass aClass) { for (JetParameter parameter : aClass.getPrimaryConstructorParameters()) { if (!parameter.hasValOrVar()) { trace.report(MISSING_VAL_ON_ANNOTATION_PARAMETER.on(parameter)); } } }
public void checkParameterHasNoValOrVar( @NotNull JetParameter parameter, @NotNull DiagnosticFactory1<PsiElement, JetKeywordToken> diagnosticFactory) { PsiElement valOrVar = parameter.getValOrVarKeyword(); if (valOrVar != null) { trace.report( diagnosticFactory.on( valOrVar, ((JetKeywordToken) valOrVar.getNode().getElementType()))); } }
public void resolveFunctionBody( @NotNull DataFlowInfo outerDataFlowInfo, @NotNull BindingTrace trace, @NotNull JetDeclarationWithBody function, @NotNull FunctionDescriptor functionDescriptor, @NotNull LexicalScope scope, @Nullable Function1<LexicalScope, DataFlowInfo> beforeBlockBody, @NotNull CallChecker callChecker) { LexicalScope innerScope = FunctionDescriptorUtil.getFunctionInnerScope(scope, functionDescriptor, trace); List<JetParameter> valueParameters = function.getValueParameters(); List<ValueParameterDescriptor> valueParameterDescriptors = functionDescriptor.getValueParameters(); valueParameterResolver.resolveValueParameters( valueParameters, valueParameterDescriptors, ExpressionTypingContext.newContext( trace, innerScope, outerDataFlowInfo, NO_EXPECTED_TYPE, callChecker)); // Synthetic "field" creation if (functionDescriptor instanceof PropertyAccessorDescriptor) { PropertyAccessorDescriptor accessorDescriptor = (PropertyAccessorDescriptor) functionDescriptor; JetProperty property = (JetProperty) function.getParent(); final SyntheticFieldDescriptor fieldDescriptor = new SyntheticFieldDescriptor(accessorDescriptor, property); innerScope = new LexicalScopeImpl( innerScope, functionDescriptor, true, functionDescriptor.getExtensionReceiverParameter(), "Accessor inner scope with synthetic field", RedeclarationHandler.DO_NOTHING, new Function1<LexicalScopeImpl.InitializeHandler, Unit>() { @Override public Unit invoke(LexicalScopeImpl.InitializeHandler handler) { handler.addVariableOrClassDescriptor(fieldDescriptor); return Unit.INSTANCE$; } }); // Check parameter name shadowing for (JetParameter parameter : function.getValueParameters()) { if (SyntheticFieldDescriptor.NAME.equals(parameter.getNameAsName())) { trace.report(Errors.ACCESSOR_PARAMETER_NAME_SHADOWING.on(parameter)); } } } DataFlowInfo dataFlowInfo = null; if (beforeBlockBody != null) { dataFlowInfo = beforeBlockBody.invoke(innerScope); } if (function.hasBody()) { expressionTypingServices.checkFunctionReturnType( innerScope, function, functionDescriptor, dataFlowInfo != null ? dataFlowInfo : outerDataFlowInfo, null, trace); } assert functionDescriptor.getReturnType() != null; }