]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/environment/LocalEnvironment.java
(refs #7386) Minor SCL tools improvements
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / environment / LocalEnvironment.java
1 package org.simantics.scl.compiler.environment;
2
3 import org.simantics.scl.compiler.elaboration.expressions.Expression;
4 import org.simantics.scl.compiler.types.Type;
5 import org.simantics.scl.compiler.types.util.ProcedureType;
6
7 import gnu.trove.procedure.TObjectProcedure;
8
9 /**
10  * Provides local variable names for expressions
11  * that do not need to defined in any module.
12  * 
13  * @author Hannu Niemistö
14  */
15 public interface LocalEnvironment {
16     /**
17      * Resolves the variable name to an expression evaluating it.
18      * Returns null if the local environment does not provide the variable.
19      */
20     Expression resolve(Environment environment, String localName);
21     
22     /**
23      * Lists all names of variables provided by this environment.
24      * The method is used only for error reporting, so its efficiently
25      * or completion is not absolutely necessary.
26      */
27     void forNames(TObjectProcedure<String> proc);
28     
29     /**
30      * Modifies the expression before type checking.
31      */
32     Expression preDecorateExpression(Expression expression);
33     
34     /**
35      * Modifies the expression after type checking.
36      */
37     Expression postDecorateExpression(Expression expression);
38     
39     /**
40      * Modifies expected type and effect before type checking.
41      */
42     ProcedureType decorateExpectedType(Type expectedType, Type expectedEffect);
43 }