Search in sources :

Example 11 with IContext

use of dyvilx.tools.compiler.ast.context.IContext in project Dyvil by Dyvil.

the class ExternalClass method resolveMetadata.

private void resolveMetadata() {
    if ((this.resolved & METADATA) != 0) {
        return;
    }
    this.resolved |= METADATA;
    final IContext context = this.getCombiningContext();
    this.metadata = IClass.getClassMetadata(this, this.attributes.flags());
    this.metadata.resolveTypesHeader(null, context);
    this.metadata.resolveTypesBody(null, context);
}
Also used : IContext(dyvilx.tools.compiler.ast.context.IContext)

Example 12 with IContext

use of dyvilx.tools.compiler.ast.context.IContext in project Dyvil by Dyvil.

the class ExternalConstructor method resolveExceptions.

private void resolveExceptions() {
    if (this.exceptions == null || (this.resolved & EXCEPTIONS) != 0) {
        return;
    }
    this.resolved |= EXCEPTIONS;
    final IContext context = this.getExternalContext();
    this.exceptions.resolveTypes(null, context);
}
Also used : IContext(dyvilx.tools.compiler.ast.context.IContext)

Example 13 with IContext

use of dyvilx.tools.compiler.ast.context.IContext in project Dyvil by Dyvil.

the class ClassUnit method resolveTypes.

@Override
public void resolveTypes() {
    super.resolveTypes();
    final IContext context = this.getContext();
    for (int i = 0; i < this.classCount; i++) {
        this.classes[i].resolveTypes(this.markers, context);
    }
}
Also used : IContext(dyvilx.tools.compiler.ast.context.IContext)

Example 14 with IContext

use of dyvilx.tools.compiler.ast.context.IContext in project Dyvil by Dyvil.

the class ClassUnit method resolve.

@Override
public void resolve() {
    this.resolveImports();
    final IContext context = this.getContext();
    for (int i = 0; i < this.classCount; i++) {
        this.classes[i].resolve(this.markers, context);
    }
}
Also used : IContext(dyvilx.tools.compiler.ast.context.IContext)

Example 15 with IContext

use of dyvilx.tools.compiler.ast.context.IContext in project Dyvil by Dyvil.

the class CompleteCommand method printCompletions.

private void printCompletions(DyvilREPL repl, String memberStart, IValue value) {
    final IType type = value.getType();
    final boolean statics = value.isClassAccess();
    final IContext context = repl.getContext().getContext();
    final Set<IField> fields = new TreeSet<>(MemberSorter.MEMBER_COMPARATOR);
    final Set<IProperty> properties = new TreeSet<>(MemberSorter.MEMBER_COMPARATOR);
    final Set<IMethod> methods = new TreeSet<>(MemberSorter.METHOD_COMPARATOR);
    final Set<IMethod> extensionMethods = new TreeSet<>(MemberSorter.METHOD_COMPARATOR);
    final Set<IMethod> conversionMethods = new TreeSet<>(MemberSorter.METHOD_COMPARATOR);
    final PrintStream output = repl.getOutput();
    if (statics) {
        output.println(I18n.get("command.complete.type", type));
        findMembers(type, fields, properties, methods, memberStart, true);
        findExtensions(context, type, value, extensionMethods, memberStart, true);
    } else {
        output.println(I18n.get("command.complete.expression", value, type));
        findInstanceMembers(type, fields, properties, methods, memberStart, new IdentityHashSet<>());
        findExtensions(context, type, value, extensionMethods, memberStart, false);
        findConversions(context, type, value, conversionMethods);
    }
    boolean hasOutput = false;
    if (!fields.isEmpty()) {
        hasOutput = true;
        output.println(I18n.get("command.complete.fields"));
        printMembers(output, fields, type);
    }
    if (!properties.isEmpty()) {
        hasOutput = true;
        output.println(I18n.get("command.complete.properties"));
        printMembers(output, properties, type);
    }
    if (!methods.isEmpty()) {
        hasOutput = true;
        output.println(I18n.get("command.complete.methods"));
        printMethods(output, methods, type);
    }
    if (!extensionMethods.isEmpty()) {
        hasOutput = true;
        output.println(I18n.get("command.complete.extensions"));
        printMethods(output, extensionMethods, type);
    }
    if (!conversionMethods.isEmpty()) {
        hasOutput = true;
        output.println(I18n.get("command.complete.conversions"));
        printMethods(output, conversionMethods, type);
    }
    if (!hasOutput) {
        output.println(I18n.get("command.complete.none"));
    }
}
Also used : PrintStream(java.io.PrintStream) IContext(dyvilx.tools.compiler.ast.context.IContext) IProperty(dyvilx.tools.compiler.ast.field.IProperty) TreeSet(dyvil.collection.mutable.TreeSet) IMethod(dyvilx.tools.compiler.ast.method.IMethod) IField(dyvilx.tools.compiler.ast.field.IField) IType(dyvilx.tools.compiler.ast.type.IType)

Aggregations

IContext (dyvilx.tools.compiler.ast.context.IContext)16 IValue (dyvilx.tools.compiler.ast.expression.IValue)5 CombiningContext (dyvilx.tools.compiler.ast.context.CombiningContext)3 SourcePosition (dyvil.source.position.SourcePosition)2 IMember (dyvilx.tools.compiler.ast.member.IMember)2 IMethod (dyvilx.tools.compiler.ast.method.IMethod)2 IType (dyvilx.tools.compiler.ast.type.IType)2 TypeChecker (dyvilx.tools.compiler.transform.TypeChecker)2 MarkerList (dyvilx.tools.parsing.marker.MarkerList)2 NonNull (dyvil.annotation.internal.NonNull)1 TreeSet (dyvil.collection.mutable.TreeSet)1 Modifiers (dyvil.reflect.Modifiers)1 LineSource (dyvil.source.LineSource)1 IClass (dyvilx.tools.compiler.ast.classes.IClass)1 IValueConsumer (dyvilx.tools.compiler.ast.consumer.IValueConsumer)1 ThisExpr (dyvilx.tools.compiler.ast.expression.ThisExpr)1 WriteableExpression (dyvilx.tools.compiler.ast.expression.WriteableExpression)1 FieldAccess (dyvilx.tools.compiler.ast.expression.access.FieldAccess)1 FieldAssignment (dyvilx.tools.compiler.ast.expression.access.FieldAssignment)1 VoidValue (dyvilx.tools.compiler.ast.expression.constant.VoidValue)1