1 package org.simantics.scl.compiler.environment;
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;
7 import gnu.trove.procedure.TObjectProcedure;
10 * Provides local variable names for expressions
11 * that do not need to defined in any module.
13 * @author Hannu Niemistö
15 public interface LocalEnvironment {
17 * Resolves the variable name to an expression evaluating it.
18 * Returns null if the local environment does not provide the variable.
20 Expression resolve(Environment environment, String localName);
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.
27 void forNames(TObjectProcedure<String> proc);
30 * Modifies the expression before type checking.
32 Expression preDecorateExpression(Expression expression);
35 * Modifies the expression after type checking.
37 Expression postDecorateExpression(Expression expression);
40 * Modifies expected type and effect before type checking.
42 ProcedureType decorateExpectedType(Type expectedType, Type expectedEffect);