Search in sources :

Example 1 with IOutputProvider

use of sharpen.xobotos.output.IOutputProvider in project XobotOS by xamarin.

the class SharpenGenerator method getOutputType.

private OutputType getOutputType() {
    for (int i = _outputProviderStack.size() - 1; i >= 0; i--) {
        IOutputProvider provider = _outputProviderStack.get(i);
        if (provider == null)
            continue;
        OutputType type = provider.getOutputType();
        if (type != null)
            return type;
    }
    return OutputType.NAKED_STUB;
}
Also used : IOutputProvider(sharpen.xobotos.output.IOutputProvider) OutputType(sharpen.xobotos.output.OutputType)

Example 2 with IOutputProvider

use of sharpen.xobotos.output.IOutputProvider in project XobotOS by xamarin.

the class APIDefinition method preprocess.

public CompilationUnitBuilder preprocess(CompilationUnitPair pair) {
    final String fullName = getUnitName(pair.source);
    final ByRef<IOutputProvider> defaultOutput = new ByRef<IOutputProvider>(null);
    final ByRef<CompilationUnitTemplate> unitTemplate = new ByRef<CompilationUnitTemplate>(CompilationUnitTemplate.DEFAULT);
    TemplateVisitor visitor = new TemplateVisitor() {

        @Override
        public void accept(NamespaceTemplate template) {
            if (defaultOutput.value != null)
                return;
            if (template.getOutputType() != null)
                defaultOutput.value = template;
        }

        @Override
        public void accept(CompilationUnitTemplate template) {
            unitTemplate.value = template;
        }
    };
    for (final NamespaceTemplate def : getNamespaces()) {
        if (def.visit(visitor, fullName, VisitMode.FirstMatch))
            break;
    }
    return my(BindingManager.class).preprocess(pair, unitTemplate.value, fullName, defaultOutput.value);
}
Also used : BindingManager(sharpen.xobotos.api.bindings.BindingManager) CompilationUnitTemplate(sharpen.xobotos.api.templates.CompilationUnitTemplate) ByRef(sharpen.core.framework.ByRef) IOutputProvider(sharpen.xobotos.output.IOutputProvider) NamespaceTemplate(sharpen.xobotos.api.templates.NamespaceTemplate)

Aggregations

IOutputProvider (sharpen.xobotos.output.IOutputProvider)2 ByRef (sharpen.core.framework.ByRef)1 BindingManager (sharpen.xobotos.api.bindings.BindingManager)1 CompilationUnitTemplate (sharpen.xobotos.api.templates.CompilationUnitTemplate)1 NamespaceTemplate (sharpen.xobotos.api.templates.NamespaceTemplate)1 OutputType (sharpen.xobotos.output.OutputType)1