Search in sources :

Example 1 with IImportContext

use of dyvilx.tools.compiler.ast.imports.IImportContext in project Dyvil by Dyvil.

the class HeaderContext method getImplicitMatches.

@Override
public void getImplicitMatches(MatchList<IMethod> list, IValue value, IType targetType) {
    // See comment in getMethodMatches for rationale
    this.header.getImplicitMatches(list, value, targetType);
    if (list.hasCandidate()) {
        return;
    }
    final ImportDeclaration[] imports = this.header.importDeclarations;
    for (int i = 0; i < this.header.importCount; i++) {
        final IImportContext importContext = imports[i].getContext();
        final MatchList<IMethod> subList = list.emptyCopy();
        importContext.getImplicitMatches(subList, value, targetType);
        list.addAll(subList);
    }
}
Also used : IImportContext(dyvilx.tools.compiler.ast.imports.IImportContext) ImportDeclaration(dyvilx.tools.compiler.ast.imports.ImportDeclaration) IMethod(dyvilx.tools.compiler.ast.method.IMethod)

Example 2 with IImportContext

use of dyvilx.tools.compiler.ast.imports.IImportContext in project Dyvil by Dyvil.

the class HeaderContext method getMethodMatches.

@Override
public void getMethodMatches(MatchList<IMethod> list, IValue receiver, Name name, ArgumentList arguments) {
    // For ordinary headers, this is a no-op, since they (currently) cannot host any free-standing functions
    // The REPL however can, so we need this call
    this.header.getMethodMatches(list, receiver, name, arguments);
    if (list.hasCandidate()) {
        return;
    }
    final ImportDeclaration[] imports = this.header.importDeclarations;
    for (int i = 0; i < this.header.importCount; i++) {
        final IImportContext importContext = imports[i].getContext();
        final MatchList<IMethod> subList = list.emptyCopy();
        importContext.getMethodMatches(subList, receiver, name, arguments);
        list.addAll(subList);
    }
}
Also used : IImportContext(dyvilx.tools.compiler.ast.imports.IImportContext) ImportDeclaration(dyvilx.tools.compiler.ast.imports.ImportDeclaration) IMethod(dyvilx.tools.compiler.ast.method.IMethod)

Example 3 with IImportContext

use of dyvilx.tools.compiler.ast.imports.IImportContext in project Dyvil by Dyvil.

the class HeaderContext method resolveTypeAlias.

@Override
public void resolveTypeAlias(MatchList<ITypeAlias> matches, IType receiver, Name name, TypeList arguments) {
    this.header.resolveTypeAlias(matches, receiver, name, arguments);
    if (matches.hasCandidate()) {
        return;
    }
    final ImportDeclaration[] importDeclarations = this.header.importDeclarations;
    for (int i = 0; i < this.header.importCount; i++) {
        final IImportContext importContext = importDeclarations[i].getContext();
        final MatchList<ITypeAlias> subList = matches.emptyCopy();
        importContext.resolveTypeAlias(subList, receiver, name, arguments);
        matches.addAll(subList);
    }
}
Also used : ITypeAlias(dyvilx.tools.compiler.ast.type.alias.ITypeAlias) IImportContext(dyvilx.tools.compiler.ast.imports.IImportContext) ImportDeclaration(dyvilx.tools.compiler.ast.imports.ImportDeclaration)

Aggregations

IImportContext (dyvilx.tools.compiler.ast.imports.IImportContext)3 ImportDeclaration (dyvilx.tools.compiler.ast.imports.ImportDeclaration)3 IMethod (dyvilx.tools.compiler.ast.method.IMethod)2 ITypeAlias (dyvilx.tools.compiler.ast.type.alias.ITypeAlias)1