Search in sources :

Example 6 with ImportDeclaration

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

the class HeaderContext method resolvePackage.

@Override
public Package resolvePackage(Name name) {
    Package result;
    final ImportDeclaration[] importDeclarations = this.header.importDeclarations;
    for (int i = 0, count = this.header.importCount; i < count; i++) {
        result = importDeclarations[i].getContext().resolvePackage(name);
        if (result != null) {
            return result;
        }
    }
    return this.header.resolvePackage(name);
}
Also used : ImportDeclaration(dyvilx.tools.compiler.ast.imports.ImportDeclaration) Package(dyvilx.tools.compiler.ast.structure.Package)

Example 7 with ImportDeclaration

use of dyvilx.tools.compiler.ast.imports.ImportDeclaration 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

ImportDeclaration (dyvilx.tools.compiler.ast.imports.ImportDeclaration)7 IImportContext (dyvilx.tools.compiler.ast.imports.IImportContext)3 IMethod (dyvilx.tools.compiler.ast.method.IMethod)2 ITypeAlias (dyvilx.tools.compiler.ast.type.alias.ITypeAlias)2 IOperator (dyvilx.tools.compiler.ast.expression.operator.IOperator)1 Operator (dyvilx.tools.compiler.ast.expression.operator.Operator)1 Package (dyvilx.tools.compiler.ast.structure.Package)1 TypeAlias (dyvilx.tools.compiler.ast.type.alias.TypeAlias)1 ImportParser (dyvilx.tools.compiler.parser.header.ImportParser)1