Changeset 13532


Ignore:
Timestamp:
Sep 18, 2019 7:14:25 PM (3 months ago)
Author:
amartensen
Message:

#5840 performing cast using a method Root.asSourceRoot() instead of at each callsite

Location:
trunk/Compiler/ModelicaFrontEnd/src/jastadd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/ModelicaFrontEnd/src/jastadd/flattening/Flattening.jrag

    r13531 r13532  
    21622162    syn boolean InstBuiltInClassDecl.isBuiltIn() = true;
    21632163    syn boolean SrcBuiltInClassDecl.isBuiltIn()  = true;
    2164     syn boolean SrcClassDecl.isBuiltIn()         = ((SourceRoot) root()).getProgram().getBuiltInTypes().hasChild(this)
    2165             || ((SourceRoot) root()).getProgram().getBuiltInFunctions().hasChild(this);
     2164    syn boolean SrcClassDecl.isBuiltIn()         = root().asSourceRoot().getProgram().getBuiltInTypes().hasChild(this)
     2165            || root().asSourceRoot().getProgram().getBuiltInFunctions().hasChild(this);
     2166   
     2167    syn SourceRoot Root.asSourceRoot() {
     2168        throw new UnsupportedOperationException("Method not implemented for class " + getClass().getSimpleName() + "!");
     2169    }
     2170    eq SourceRoot.asSourceRoot() = this;
    21662171   
    21672172    public boolean List.hasChild(ASTNode node) {
  • trunk/Compiler/ModelicaFrontEnd/src/jastadd/instance/InstLookupClasses.jrag

    r13317 r13532  
    258258
    259259    syn lazy HashMap<String,SrcLibNode> InstProgramRoot.libraryMap() {
    260         Program prog = ((SourceRoot) root()).getProgram();
     260        Program prog = root().asSourceRoot().getProgram();
    261261        HashMap<String,SrcLibNode> map = new HashMap<String,SrcLibNode>(prog.getNumSrcLibNode() * 4 / 3 + 1);
    262262        for (SrcLibNode ln : prog.getSrcLibNodes()) {
  • trunk/Compiler/ModelicaFrontEnd/src/jastadd/source/SourceTraversal.jrag

    r13294 r13532  
    9090    syn Iterable<SrcComponentDecl> SrcEnumClassDecl.componentsIterable() = super.components();
    9191    syn SrcEnumClassDecl SrcEnumClassDecl.enumBase() =
    92         ((SourceRoot) root()).getProgram().getEnumBaseDecl();
     92        root().asSourceRoot().getProgram().getEnumBaseDecl();
    9393   
    9494    syn Iterable<SrcModificationOrRedeclareElement> SrcClassDecl.elementModifications();
Note: See TracChangeset for help on using the changeset viewer.