+ SCLValue value;
+ try {
+ value = resolveValueIn(location, namespace, name);
+ } catch (AmbiguousNameException e) {
+ if(SCLCompilerConfiguration.ALLOW_OVERLOADING) {
+ EAmbiguous.Alternative[] alternatives = new EAmbiguous.Alternative[e.conflictingModules.length];
+ //System.out.println("Overloading:");
+ for(int i=0;i<e.conflictingModules.length;++i) {
+ Name altName = Name.create(e.conflictingModules[i], e.name);
+ //System.out.println(" " + altName);
+ SCLValue altValue = environment.getValue(altName);
+ alternatives[i] = new EAmbiguous.Alternative() {
+ @Override
+ public Type getType() {
+ return altValue.getType();
+ }
+
+ @Override
+ public Expression realize() {
+ EConstant expression = new EConstant(altValue);
+ expression.location = location;
+ return expression;
+ }
+
+ @Override
+ public String toString() {
+ return altValue.getName().toString().replace('/', '.');
+ }
+ };
+ }
+ EAmbiguous expression = new EAmbiguous(alternatives);
+ expression.location = location;
+ return expression;
+ }
+ else {
+ errorLog.log(location, e.getMessage());
+ value = null;
+ }
+ }