Search in sources :

Example 26 with CompilationUnit

use of abs.frontend.ast.CompilationUnit in project abstools by abstools.

the class IncrementalModelBuilder method removeCompilationUnit.

public synchronized void removeCompilationUnit(CompilationUnit cu) throws NoModelException {
    if (model == null)
        throw new NoModelException();
    String filename = cu.getFileName();
    assert filename != null;
    CompilationUnit cuold = getCompilationUnit(filename);
    List<CompilationUnit> culist = model.getCompilationUnitList();
    int cindex = culist.getIndexOfChild(cuold);
    if (cindex > 0) {
        culist.removeChild(cindex);
    }
    // model.flushCache();
    flushAll(model);
}
Also used : CompilationUnit(abs.frontend.ast.CompilationUnit)

Example 27 with CompilationUnit

use of abs.frontend.ast.CompilationUnit in project abstools by abstools.

the class IncrementalModelBuilder method addCompilationUnits.

public synchronized void addCompilationUnits(Iterable<CompilationUnit> units) throws IOException, NoModelException {
    // Initialize the model.
    if (model == null) {
        model = new Model();
        model.addCompilationUnit(getStdLibCompilationUnit());
    }
    for (CompilationUnit u : units) {
        addCompilationUnit(u);
    }
    Assert.isNotNull(model);
}
Also used : CompilationUnit(abs.frontend.ast.CompilationUnit) Model(abs.frontend.ast.Model)

Aggregations

CompilationUnit (abs.frontend.ast.CompilationUnit)27 Model (abs.frontend.ast.Model)7 ModuleDecl (abs.frontend.ast.ModuleDecl)6 File (java.io.File)5 Test (org.junit.Test)5 ClassDecl (abs.frontend.ast.ClassDecl)4 DeltaDecl (abs.frontend.ast.DeltaDecl)4 MethodSig (abs.frontend.ast.MethodSig)4 Main (abs.frontend.parser.Main)4 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 AbsNature (org.absmodels.abs.plugin.builder.AbsNature)4 DeltaAccess (abs.frontend.ast.DeltaAccess)3 List (abs.frontend.ast.List)3 ModifyClassModifier (abs.frontend.ast.ModifyClassModifier)3 SemanticConditionList (abs.frontend.analyser.SemanticConditionList)2 Block (abs.frontend.ast.Block)2 MethodImpl (abs.frontend.ast.MethodImpl)2 SkipStmt (abs.frontend.ast.SkipStmt)2 StringReader (java.io.StringReader)2