Search in sources :

Example 1 with TypeUsages

use of org.eclipse.xtext.xbase.imports.TypeUsages in project xtext-xtend by eclipse.

the class TypeUsageCollectorTest method hasUnresolvedType.

private void hasUnresolvedType(final Resource resource, final String... typeNames) {
    final TypeUsages typeUsages = this.typeUsageCollector.collectTypeUsages(((XtextResource) resource));
    final Function1<TypeUsage, String> _function = (TypeUsage it) -> {
        return it.getUsedTypeName();
    };
    final Set<String> usedNames = IterableExtensions.<String>toSet(ListExtensions.<TypeUsage, String>map(typeUsages.getUnresolvedTypeUsages(), _function));
    Assert.assertEquals(IterableExtensions.<String>toSet(((Iterable<String>) Conversions.doWrapArray(typeNames))), usedNames);
}
Also used : TypeUsages(org.eclipse.xtext.xbase.imports.TypeUsages) XtextResource(org.eclipse.xtext.resource.XtextResource) TypeUsage(org.eclipse.xtext.xbase.imports.TypeUsage)

Example 2 with TypeUsages

use of org.eclipse.xtext.xbase.imports.TypeUsages in project xtext-xtend by eclipse.

the class TypeUsageCollectorTest method hasUnresolvedTypeSuffix.

private void hasUnresolvedTypeSuffix(final CharSequence xtendFile, final String... suffix) {
    try {
        final Resource resource = this.file(xtendFile.toString()).eResource();
        final TypeUsages typeUsages = this.typeUsageCollector.collectTypeUsages(((XtextResource) resource));
        final Function1<TypeUsage, String> _function = (TypeUsage it) -> {
            return it.getSuffix();
        };
        final Set<String> foundSuffix = IterableExtensions.<String>toSet(ListExtensions.<TypeUsage, String>map(typeUsages.getUnresolvedTypeUsages(), _function));
        Assert.assertEquals(IterableExtensions.<String>toSet(((Iterable<String>) Conversions.doWrapArray(suffix))), foundSuffix);
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : TypeUsages(org.eclipse.xtext.xbase.imports.TypeUsages) XtextResource(org.eclipse.xtext.resource.XtextResource) Resource(org.eclipse.emf.ecore.resource.Resource) XtextResource(org.eclipse.xtext.resource.XtextResource) TypeUsage(org.eclipse.xtext.xbase.imports.TypeUsage)

Aggregations

XtextResource (org.eclipse.xtext.resource.XtextResource)2 TypeUsage (org.eclipse.xtext.xbase.imports.TypeUsage)2 TypeUsages (org.eclipse.xtext.xbase.imports.TypeUsages)2 Resource (org.eclipse.emf.ecore.resource.Resource)1