Changeset 13608


Ignore:
Timestamp:
Sep 26, 2019 5:57:14 PM (2 months ago)
Author:
amartensen
Message:

#5840 defined a mapping from UtilInterface to ModelicaCompiler and moved the inverse mapping to be below it.

Location:
branches/dev-2468-2/Compiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-2468-2/Compiler/ModelicaCompiler/src/jastadd/UtilInterface.jrag

    r13396 r13608  
    7474        private File compilationOutputPath;
    7575       
    76         protected UtilInterface(ModelicaCompiler mc, OptionRegistry options, IErrorHandler eh, ExternalFunctionCache efc, File compilationOutputPath) {
    77             this.mc = mc;
    78             this.options = options;
    79             this.eh = eh;
    80             this.efc = efc;
    81             this.compilationOutputPath = compilationOutputPath;
    82             guidManager = new GUIDManager(ASTNode.vendorName(), options.getStringOption("compiler_version"));
    83            
    84             interfacers = new LinkedList<>();
    85             for (UtilInterface.Registrant registrant : registrants) {
    86                 if (registrant.enabled(this)) {
    87                     interfacers.add(registrant.getInterfacer(this));
    88                 }
    89             }
    90         }
    91        
    9276        public ModelicaCompiler getModelicaCompiler() {
    9377            return mc;
     
    123107    }
    124108   
     109    public static ModelicaCompiler ModelicaCompiler.create(UtilInterface uif) {
     110        return new ModelicaCompiler(uif);
     111    }
     112    public ModelicaCompiler.ModelicaCompiler(UtilInterface uif) {
     113        this.options = uif.getOptionRegistry();
     114        this.errorHandler = uif.getErrorHandler();
     115        this.externalFunctionCache = uif.getExternalFunctionCache();
     116    }
    125117    public static UtilInterface UtilInterface.create(ModelicaCompiler mc) {
    126118        return new UtilInterface(mc, mc.getOptions(), mc.getErrorHandler(), mc.getExternalFunctionCache(), null);
    127119    }
    128120   
     121    protected UtilInterface.UtilInterface(ModelicaCompiler mc, OptionRegistry options, IErrorHandler eh, ExternalFunctionCache efc, File compilationOutputPath) {
     122        this.mc = mc;
     123        this.options = options;
     124        this.eh = eh;
     125        this.efc = efc;
     126        this.compilationOutputPath = compilationOutputPath;
     127        guidManager = new GUIDManager(ASTNode.vendorName(), options.getStringOption("compiler_version"));
     128       
     129        interfacers = new LinkedList<>();
     130        for (UtilInterface.Registrant registrant : registrants) {
     131            if (registrant.enabled(this)) {
     132                interfacers.add(registrant.getInterfacer(this));
     133            }
     134        }
     135    }
     136       
    129137    public static UtilInterface UtilInterface.create(OptionRegistry options) {
    130138        return new UtilInterface(null, options, new DefaultErrorHandler(), null, null);
  • branches/dev-2468-2/Compiler/TestFramework/src/jastadd/TestCase.jrag

    r13396 r13608  
    573573
    574574        // Create a mock compiler to notify compilation listeners.
    575         ModelicaCompiler.notifyCompilationStart(new ModelicaCompiler(uif.getOptionRegistry()));
     575        ModelicaCompiler mc = ModelicaCompiler.create(uif);
     576        uif = uif.create(mc);
     577        ModelicaCompiler.notifyCompilationStart(mc);
    576578
    577579        // Parse
Note: See TracChangeset for help on using the changeset viewer.