]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/NameExistenceChecks.java
migrated to svn revision 33108
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / compilation / NameExistenceChecks.java
index 8204b5f604bea380e30625f97d8d77af70ebf47a..1f45c5f41a9d88c8345686e70fcd8b4834dd37ff 100644 (file)
@@ -5,22 +5,27 @@ import org.simantics.scl.compiler.elaboration.modules.TypeConstructor;
 import org.simantics.scl.compiler.environment.AmbiguousNameException;\r
 import org.simantics.scl.compiler.environment.Environment;\r
 import org.simantics.scl.compiler.errors.ErrorLog;\r
+import org.simantics.scl.compiler.top.SCLCompilerConfiguration;\r
 \r
 public class NameExistenceChecks {\r
     public static void checkIfValueExists(ErrorLog errorLog, long location,\r
             Environment environment, String name) {\r
-        try {\r
-            SCLValue value = environment.getLocalNamespace().getValue(name);\r
-            if(value != null)\r
+        if(SCLCompilerConfiguration.ALLOW_OVERLOADING)\r
+            return;\r
+        else {\r
+            try {\r
+                SCLValue value = environment.getLocalNamespace().getValue(name);\r
+                if(value != null)\r
+                    errorLog.log(location,\r
+                            "Value " + name + " is already defined in the module " + \r
+                                    value.getName().module + \r
+                            " that is imported to the default namespace.");\r
+            } catch(AmbiguousNameException e) {\r
                 errorLog.log(location,\r
-                        "Value " + name + " is already defined in the module " + \r
-                                value.getName().module + \r
-                        " that is imported to the default namespace.");\r
-        } catch(AmbiguousNameException e) {\r
-            errorLog.log(location,\r
-                    "Value " + name + " is already defined in the modules " + \r
-                            e.conflictingModules[0] + " and  " + e.conflictingModules[1] +  \r
-                    " that are imported to the default namespace.");\r
+                        "Value " + name + " is already defined in the modules " + \r
+                                e.conflictingModules[0] + " and  " + e.conflictingModules[1] +  \r
+                        " that are imported to the default namespace.");\r
+            }\r
         }\r
     }\r
     \r