@Override public final String toString() { return getSimpleName(); }
@Override public String getSimpleName() { return component.getSimpleName() + "[]"; }
@Override protected void doVisitTypeReference(LightweightTypeReference reference, StringBuilder param) { param.append(reference.getSimpleName()); }
@Override public String apply(/* @Nullable */ LightweightTypeReference reference) { if (reference == null) throw new NullPointerException("reference"); return reference.getSimpleName(); } }
@Override public String getSimpleName() { return this.getDelegate().getSimpleName(); }
@Override public String getSimpleSignature() { JvmExecutable declaration = getDeclaration(); List<LightweightTypeReference> parameterTypes = getResolvedParameterTypes(); StringBuilder result = new StringBuilder(declaration.getSimpleName().length() + 2 + 10 * parameterTypes.size()); result.append(declaration.getSimpleName()); result.append('('); for(int i = 0; i < parameterTypes.size(); i++) { if (i != 0) { result.append(", "); } result.append(parameterTypes.get(i).getSimpleName()); } result.append(')'); return result.toString(); }
@Override public String getSimpleName() { if (internalIsResolved()) { return resolvedTo.getSimpleName(); } return "Unbound[" + typeParameter.getSimpleName() + "]"; }
@Override public String toString() { return String.format("%s in context of %s", getDeclaration().getIdentifier(), getContextType().getSimpleName()); } }
protected String getDefaultValueLiteral(XExpression expr) { LightweightTypeReference type = getTypeForVariableDeclaration(expr); if (type.isPrimitive()) { if (type.getPrimitiveKind() == Primitives.Primitive.Boolean) { return "false"; } else { return "(" + type.getSimpleName() + ") 0"; } } return "null"; }
protected AbstractDiagnostic createTypeDiagnostic(XExpression expression, LightweightTypeReference actualType, LightweightTypeReference expectedType) { if (!expectedType.isAny()) { String actualName = actualType.getSimpleName(); String expectedName = expectedType.getSimpleName(); if (actualName.equals(expectedName)) { if (expectedType.isAssignableFrom(actualType)) { return null; } } if (expression.eContainingFeature() == XbasePackage.Literals.XABSTRACT_FEATURE_CALL__IMPLICIT_FIRST_ARGUMENT) { return new EObjectDiagnosticImpl(Severity.ERROR, IssueCodes.INCOMPATIBLE_TYPES, String.format( "Type mismatch: cannot convert implicit first argument from %s to %s", actualType.getHumanReadableName(), expectedType.getHumanReadableName()), expression, null, -1, null); } else { return new EObjectDiagnosticImpl(Severity.ERROR, IssueCodes.INCOMPATIBLE_TYPES, String.format( "Type mismatch: cannot convert from %s to %s", actualType.getHumanReadableName(), expectedType.getHumanReadableName()), expression, null, -1, null); } } else { return new EObjectDiagnosticImpl(Severity.ERROR, IssueCodes.INCOMPATIBLE_TYPES, String.format( "Type mismatch: type %s is not applicable at this location", actualType.getHumanReadableName()), expression, null, -1, null); } }
@Check public void checkReturnTypeOfCheckConstraints(CheckConstraint checkConstraint) { XExpression xExpression = checkConstraint.getExpression(); if (xExpression != null) { final IResolvedTypes resolvedType = typeResolver.resolveTypes(xExpression); LightweightTypeReference type = resolvedType.getReturnType(xExpression); if (type.getPrimitiveIfWrapperType().getPrimitiveKind() != Primitive.Boolean) { error("Check expressions must return boolean instead of " + type.getSimpleName(), checkConstraint, PatternLanguagePackage.Literals.CHECK_CONSTRAINT__EXPRESSION, IssueCodes.CHECK_MUST_BE_BOOLEAN); } } }
@Check public void checkReturnTypeOfCheckConstraints(CheckConstraint checkConstraint) { XExpression xExpression = checkConstraint.getExpression(); if (xExpression != null) { final IResolvedTypes resolvedType = typeResolver.resolveTypes(xExpression); LightweightTypeReference type = resolvedType.getReturnType(xExpression); if (type.getPrimitiveIfWrapperType().getPrimitiveKind() != Primitive.Boolean) { error("Check expressions must return boolean instead of " + type.getSimpleName(), checkConstraint, PatternLanguagePackage.Literals.CHECK_CONSTRAINT__EXPRESSION, IssueCodes.CHECK_MUST_BE_BOOLEAN); } } }
@Override public Type getType() { Type _switchResult = null; LightweightTypeReference _delegate = this.getDelegate(); final LightweightTypeReference it = _delegate; boolean _matched = false; boolean _isUnknown = it.isUnknown(); if (_isUnknown) { _matched=true; CompilationUnitImpl _compilationUnit = this.getCompilationUnit(); String _packageName = this.getCompilationUnit().getPackageName(); String _plus = (_packageName + "."); String _simpleName = it.getSimpleName(); String _plus_1 = (_plus + _simpleName); _switchResult = new UnknownType(_compilationUnit, _plus_1); } if (!_matched) { _switchResult = this.getCompilationUnit().toType(it.getType()); } return _switchResult; }
if (!it.hasName(anonClass) && it instanceof PyAppendable) { final LightweightTypeReference jvmAnonType = getExpectedType(anonClass); final String anonName = it.declareSyntheticVariable(anonClass, jvmAnonType.getSimpleName()); QualifiedName anonQualifiedName = QualifiedName.create( jvmAnonType.getType().getQualifiedName().split(Pattern.quote("."))); //$NON-NLS-1$
if (type != null) { dataType = EcoreFactory.eINSTANCE.createEDataType(); dataType.setName(type.getSimpleName()); dataType.setInstanceClassName(type.getJavaIdentifier());
+ closureType.getSimpleName()); final JvmDeclaredType rawType = (JvmDeclaredType) closureType.getType(); final JvmOperation function = rawType.getDeclaredOperations().iterator().next();
appendable.decreaseIndentation().newLine().append("}.apply()"); if (expectedType.isPrimitive()) { appendable.append(".").append(expectedType.getSimpleName()).append("Value()");