Search in sources :

Example 1 with TypesmartTermFactory

use of org.spoofax.terms.typesmart.TypesmartTermFactory in project spoofax by metaborg.

the class TermFactoryService method get.

@Override
public ITermFactory get(ILanguageComponent component, @Nullable IProject project, boolean supportsTypesmart) {
    if (!supportsTypesmart || project == null) {
        return genericFactory;
    }
    ISpoofaxProjectConfig config = configService.get(project);
    if (config == null || !config.typesmart()) {
        return genericFactory;
    }
    TypesmartContext context = getTypesmartContext(component);
    if (!context.isEmpty()) {
        return new TypesmartTermFactory(genericFactory, typesmartLogger, context);
    } else {
        return genericFactory;
    }
}
Also used : TypesmartTermFactory(org.spoofax.terms.typesmart.TypesmartTermFactory) ISpoofaxProjectConfig(org.metaborg.spoofax.core.config.ISpoofaxProjectConfig) TypesmartContext(org.spoofax.terms.typesmart.TypesmartContext)

Example 2 with TypesmartTermFactory

use of org.spoofax.terms.typesmart.TypesmartTermFactory in project spoofax by metaborg.

the class TermFactoryService method get.

@Override
public ITermFactory get(ILanguageImpl impl, @Nullable IProject project, boolean supportsTypesmart) {
    if (!supportsTypesmart || project == null) {
        return genericFactory;
    }
    ISpoofaxProjectConfig config = configService.get(project);
    if (config == null || !config.typesmart()) {
        return genericFactory;
    }
    TypesmartContext context = getTypesmartContext(impl);
    if (!context.isEmpty()) {
        return new TypesmartTermFactory(genericFactory, typesmartLogger, context);
    } else {
        return genericFactory;
    }
}
Also used : TypesmartTermFactory(org.spoofax.terms.typesmart.TypesmartTermFactory) ISpoofaxProjectConfig(org.metaborg.spoofax.core.config.ISpoofaxProjectConfig) TypesmartContext(org.spoofax.terms.typesmart.TypesmartContext)

Aggregations

ISpoofaxProjectConfig (org.metaborg.spoofax.core.config.ISpoofaxProjectConfig)2 TypesmartContext (org.spoofax.terms.typesmart.TypesmartContext)2 TypesmartTermFactory (org.spoofax.terms.typesmart.TypesmartTermFactory)2