public static GLSLPresentation createFieldPresentation(GLSLDeclarator declarator) { String result = ""; GLSLQualifiedType type = declarator.getQualifiedType(); GLSLQualifier[] qualifiers = type.getQualifiers(); if (qualifiers.length > 0) { result += prettyPrint( stringify( qualifiers, new Stringifyer<GLSLQualifier>() { public String stringify(GLSLQualifier glslQualifier) { return glslQualifier == null ? "null" : glslQualifier.getText(); } })); result += " "; } result += declarator.getName(); result += " : "; result += type.getType().getTypename(); GLSLPresentation presentation = new GLSLPresentation(result); presentation.setIcon(FIELD); return presentation; }
@Override public void annotate(GLSLVariableDeclaration expr, AnnotationHolder holder) { for (final GLSLDeclarator declarator : expr.getDeclarators()) { final GLSLType variableType = declarator.getType(); final GLSLExpression initializer = declarator.getInitializerExpression(); if (variableType.isValidType() && initializer != null) { final GLSLType assignedType = initializer.getType(); if (!assignedType.isValidType()) continue; if (GLSLTypeCompatibilityLevel.getCompatibilityLevel(assignedType, variableType) == GLSLTypeCompatibilityLevel.INCOMPATIBLE) { holder.createErrorAnnotation( initializer, "Can't assign '" + assignedType.getTypename() + "' to '" + variableType.getTypename() + "'"); } } } }