Search in sources :

Example 11 with ClassBody

use of dyvilx.tools.compiler.ast.classes.ClassBody in project Dyvil by Dyvil.

the class CompleteCommand method findMembers.

private static void findMembers(IType type, Set<IField> fields, Set<IProperty> properties, Set<IMethod> methods, String start, boolean statics) {
    final IClass theClass = type.getTheClass();
    if (theClass == null) {
        return;
    }
    final ClassBody body = theClass.getBody();
    if (body == null) {
        return;
    }
    for (int i = 0, count = body.fieldCount(); i < count; i++) {
        checkMember(fields, body.getField(i), start, statics);
    }
    for (int i = 0, count = body.propertyCount(); i < count; i++) {
        checkMember(properties, body.getProperty(i), start, statics);
    }
    for (int i = 0, count = body.methodCount(); i < count; i++) {
        checkMember(methods, body.getMethod(i), start, statics);
    }
}
Also used : IClass(dyvilx.tools.compiler.ast.classes.IClass) ClassBody(dyvilx.tools.compiler.ast.classes.ClassBody)

Example 12 with ClassBody

use of dyvilx.tools.compiler.ast.classes.ClassBody in project Dyvil by Dyvil.

the class REPLContext method startEvaluation.

// Evaluation
public void startEvaluation(String text) {
    final String className = CLASS_PREFIX + this.classIndex++;
    this.currentClass = new CodeClass(this, Name.fromRaw(className));
    this.currentClass.setBody(new ClassBody(this.currentClass));
    this.currentSource = new TextSource(text);
}
Also used : TextSource(dyvil.source.TextSource) CodeClass(dyvilx.tools.compiler.ast.classes.CodeClass) ClassBody(dyvilx.tools.compiler.ast.classes.ClassBody)

Aggregations

ClassBody (dyvilx.tools.compiler.ast.classes.ClassBody)12 CodeClass (dyvilx.tools.compiler.ast.classes.CodeClass)2 IClass (dyvilx.tools.compiler.ast.classes.IClass)2 IConstructor (dyvilx.tools.compiler.ast.constructor.IConstructor)2 Name (dyvil.lang.Name)1 TextSource (dyvil.source.TextSource)1 Annotation (dyvilx.tools.compiler.ast.attribute.annotation.Annotation)1 CodeAnnotation (dyvilx.tools.compiler.ast.attribute.annotation.CodeAnnotation)1 Modifier (dyvilx.tools.compiler.ast.attribute.modifiers.Modifier)1 ArrayExpr (dyvilx.tools.compiler.ast.expression.ArrayExpr)1 ClassConstructorCall (dyvilx.tools.compiler.ast.expression.access.ClassConstructorCall)1 IField (dyvilx.tools.compiler.ast.field.IField)1 CodeMethod (dyvilx.tools.compiler.ast.method.CodeMethod)1 IMethod (dyvilx.tools.compiler.ast.method.IMethod)1 ArgumentList (dyvilx.tools.compiler.ast.parameter.ArgumentList)1 ParameterList (dyvilx.tools.compiler.ast.parameter.ParameterList)1 StatementList (dyvilx.tools.compiler.ast.statement.StatementList)1 TypeList (dyvilx.tools.compiler.ast.type.TypeList)1 AnnotationParser (dyvilx.tools.compiler.parser.annotation.AnnotationParser)1 ClassBodyParser (dyvilx.tools.compiler.parser.classes.ClassBodyParser)1