mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 08:48:55 +00:00
[xbase][typesystem] Make the serializer tests pass with the new type system
Introduced @SerializerScopeProvider similar to @LinkingScopeProvider to allow for optimized implementations Change-Id: Iec84687cd30b7326aac77db66cd9436542f54f39
This commit is contained in:
parent
29a9dcf61a
commit
96fb0e81ed
3 changed files with 27 additions and 0 deletions
|
@ -17,6 +17,7 @@ import org.eclipse.xtext.CrossReference;
|
|||
import org.eclipse.xtext.GrammarUtil;
|
||||
import org.eclipse.xtext.conversion.IValueConverterService;
|
||||
import org.eclipse.xtext.conversion.ValueConverterException;
|
||||
import org.eclipse.xtext.linking.LinkingScopeProviderBinding;
|
||||
import org.eclipse.xtext.linking.impl.LinkingHelper;
|
||||
import org.eclipse.xtext.naming.IQualifiedNameConverter;
|
||||
import org.eclipse.xtext.naming.QualifiedName;
|
||||
|
@ -50,6 +51,7 @@ public class CrossReferenceSerializer implements ICrossReferenceSerializer {
|
|||
private IQualifiedNameConverter qualifiedNameConverter;
|
||||
|
||||
@Inject
|
||||
@SerializerScopeProviderBinding
|
||||
private IScopeProvider scopeProvider;
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package org.eclipse.xtext.serializer.tokens;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import com.google.inject.BindingAnnotation;
|
||||
|
||||
/**
|
||||
* Indicates that a scope provider is requested that is used
|
||||
* to serialize existing cross references.
|
||||
*
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
* @since 2.4
|
||||
*/
|
||||
@BindingAnnotation
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface SerializerScopeProviderBinding {}
|
|
@ -54,11 +54,13 @@ import org.eclipse.xtext.serializer.ISerializer;
|
|||
import org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer;
|
||||
import org.eclipse.xtext.serializer.sequencer.GenericSequencer;
|
||||
import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer;
|
||||
import org.eclipse.xtext.serializer.tokens.SerializerScopeProviderBinding;
|
||||
import org.eclipse.xtext.validation.CancelableDiagnostician;
|
||||
import org.eclipse.xtext.validation.IConcreteSyntaxValidator;
|
||||
import org.eclipse.xtext.validation.impl.ConcreteSyntaxValidator;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Key;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.name.Names;
|
||||
|
||||
|
@ -138,6 +140,13 @@ public abstract class DefaultRuntimeModule extends AbstractGenericModule {
|
|||
return SimpleLocalScopeProvider.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.4
|
||||
*/
|
||||
public void configureSerializerIScopeProvider(Binder binder) {
|
||||
binder.bind(IScopeProvider.class).annotatedWith(SerializerScopeProviderBinding.class).to(Key.get(IScopeProvider.class, LinkingScopeProviderBinding.class));
|
||||
}
|
||||
|
||||
public void configureLinkingIScopeProvider(Binder binder) {
|
||||
binder.bind(IScopeProvider.class).annotatedWith(LinkingScopeProviderBinding.class).to(IScopeProvider.class);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue