Java Code Examples for org.eclipse.xtext.xbase.typesystem.references.UnboundTypeReference#copyInto()
The following examples show how to use
org.eclipse.xtext.xbase.typesystem.references.UnboundTypeReference#copyInto() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StackedResolvedTypes.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override protected UnboundTypeReference getUnboundTypeReference(Object handle) { UnboundTypeReference result = basicGetTypeParameters().get(handle); if (result == null) { result = parent.getUnboundTypeReference(handle); if (result.internalIsResolved()) throw new IllegalStateException("Cannot query unbound reference that was already resolved"); return (UnboundTypeReference) result.copyInto(getReferenceOwner()); } return result; }
Example 2
Source File: StackedResolvedTypes.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
protected void mergeTypeParametersIntoParent(ResolvedTypes parent) { for(UnboundTypeReference unbound: basicGetTypeParameters().values()) { LightweightTypeReference resolvedTo = unbound.getResolvedTo(); if (resolvedTo == null) { List<JvmTypeParameter> typeParameters = basicGetDeclardTypeParameters(); if (typeParameters != null && typeParameters.contains(unbound.getTypeParameter())) { unbound.tryResolve(); if (!unbound.internalIsResolved()) { if (unbound.getExpression() instanceof XConstructorCall) { unbound.resolve(); // resolve against constraints } else { unbound.acceptHint(unbound.getOwner().newParameterizedTypeReference(unbound.getTypeParameter()), BoundTypeArgumentSource.RESOLVED, unbound, VarianceInfo.INVARIANT, VarianceInfo.INVARIANT); } } } else { LightweightTypeReference reference = unbound.copyInto(parent.getReferenceOwner()); if (reference instanceof UnboundTypeReference) { parent.acceptUnboundTypeReference(unbound.getHandle(), (UnboundTypeReference) reference); } } } } Map<Object, List<LightweightBoundTypeArgument>> typeParameterHints = basicGetTypeParameterHints(); for(Map.Entry<Object, List<LightweightBoundTypeArgument>> hint: typeParameterHints.entrySet()) { if (!parent.isResolved(hint.getKey())) { List<LightweightBoundTypeArgument> boundTypeArguments = hint.getValue(); for(LightweightBoundTypeArgument boundTypeArgument: boundTypeArguments) { if (boundTypeArgument.getOrigin() instanceof VarianceInfo) { parent.acceptHint(hint.getKey(), boundTypeArgument); } else { LightweightBoundTypeArgument copy = new LightweightBoundTypeArgument( boundTypeArgument.getTypeReference().copyInto(parent.getReferenceOwner()), boundTypeArgument.getSource(), boundTypeArgument.getOrigin(), boundTypeArgument.getDeclaredVariance(), boundTypeArgument.getActualVariance()); parent.acceptHint(hint.getKey(), copy); } } } } }
Example 3
Source File: DeferredTypeParameterHintCollector.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
protected LightweightTypeReference copy(UnboundTypeReference reference) { return reference.copyInto(getOwner()); }
Example 4
Source File: UnboundTypeParameterPreservingSubstitutor.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
@Override protected LightweightTypeReference doVisitUnboundTypeReference(UnboundTypeReference reference, Set<JvmTypeParameter> visiting) { return reference.copyInto(getOwner()); }
Example 5
Source File: MockTypeParameterSubstitutor.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Override public LightweightTypeReference doVisitUnboundTypeReference(final UnboundTypeReference reference, final Set<JvmTypeParameter> param) { return reference.copyInto(this.getOwner()); }