[commit] r2116 - in trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator: . Generator

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Thu Dec 6 12:41:29 CST 2012


Author: lattmann
Date: Thu Dec  6 12:41:29 2012
New Revision: 2116

Log:
Fix: No best type found for implicitly-typed array 
Separate Warning and error messages on the GME console.

Modified:
   trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/CSharpDSMLGenerator.cs
   trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoSrcDstEnd.cs
   trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoStaticFunctions.cs

Modified: trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/CSharpDSMLGenerator.cs
==============================================================================
--- trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/CSharpDSMLGenerator.cs	Thu Dec  6 11:41:04 2012	(r2115)
+++ trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/CSharpDSMLGenerator.cs	Thu Dec  6 12:41:29 2012	(r2116)
@@ -312,8 +312,24 @@
 
                 cr.Errors.Cast<CompilerError>().ToList().
                     ForEach(x => System.Diagnostics.Debug.WriteLine(x.ErrorText));
-                cr.Errors.Cast<CompilerError>().ToList().
-                    ForEach(x => GMEConsole.Error.WriteLine(x.ErrorText));
+                var errors = cr.Errors.Cast<CompilerError>().ToList();
+
+                // errors last on the console
+                errors.Sort((x, y) => y.IsWarning.CompareTo(x.IsWarning));
+
+                errors.
+                    ForEach(x => {
+                        var msg = string.Format("{0} ({1}) {2} ", x.FileName, x.Line, x.ErrorText);
+
+                        if (x.IsWarning)
+                        {
+                            GMEConsole.Warning.WriteLine(msg);
+                        }
+                        else
+                        {
+                            GMEConsole.Error.WriteLine(msg);
+                        }
+                    });
 
                 if (cr.Errors.Count == 0)
                 {

Modified: trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoSrcDstEnd.cs
==============================================================================
--- trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoSrcDstEnd.cs	Thu Dec  6 11:41:04 2012	(r2115)
+++ trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoSrcDstEnd.cs	Thu Dec  6 12:41:29 2012	(r2116)
@@ -147,9 +147,10 @@
 
 					newAllSrcConnections.GetStatements.Add(
 						new CodeMethodReturnStatement(
-							new CodeSnippetExpression("(new[] { " + sb.ToString() +
-								"}).FirstOrDefault(x => x != null) as " +
-								typeof(ISIS.GME.Common.Classes.FCO).FullName)));
+                            new CodeSnippetExpression("(new " +
+                                typeof(ISIS.GME.Common.Interfaces.FCO).FullName +
+                                "[] { " + sb.ToString() +
+								"}).FirstOrDefault(x => x != null)")));
 				}
 				GeneratedClass.Types[0].Members.Add(newAllSrcConnections);
 
@@ -306,9 +307,10 @@
 
 					newAllDstConnections.GetStatements.Add(
 						new CodeMethodReturnStatement(
-							new CodeSnippetExpression("(new[] { " + sb.ToString() +
-								"}).FirstOrDefault(x => x != null) as " +
-								typeof(ISIS.GME.Common.Classes.FCO).FullName)));
+							new CodeSnippetExpression("(new " +
+                                typeof(ISIS.GME.Common.Interfaces.FCO).FullName
+                                + "[] { " + sb.ToString() +
+								"}).FirstOrDefault(x => x != null)")));
 				}
 				GeneratedClass.Types[0].Members.Add(newAllDstConnections);
 

Modified: trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoStaticFunctions.cs
==============================================================================
--- trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoStaticFunctions.cs	Thu Dec  6 11:41:04 2012	(r2115)
+++ trunk/SDK/DotNet/DsmlGenerator/CSharpDsmlGenerator/Generator/FcoStaticFunctions.cs	Thu Dec  6 12:41:29 2012	(r2116)
@@ -53,32 +53,37 @@
 
                 if (Configuration.UseOnlyBaseForFunctions)
                 {
-                    srcEnds = GetSrcEnd(Subject as MgaFCO);
-                    dstEnds = GetDstEnd(Subject as MgaFCO);
-                    parents = GetParents(Subject as MgaFCO);
+                    srcEnds = GetSrcEnd(Subject as MgaFCO).Distinct();
+                    dstEnds = GetDstEnd(Subject as MgaFCO).Distinct();
+                    parents = GetParents(Subject as MgaFCO).Distinct();
                 }
                 else
                 {
-                    srcEnds = GetSrcEnd(Subject as MgaFCO, true).
-                        Where(x => x.BoolAttrByName["IsAbstract"] == false);
-
-                    dstEnds = GetDstEnd(Subject as MgaFCO, true).
-                        Where(x => x.BoolAttrByName["IsAbstract"] == false);
-
-                    parents = GetParents(Subject as MgaFCO, true).Distinct().
-                    Where(x => x.BoolAttrByName["IsAbstract"] == false);
+                    srcEnds = GetSrcEnd(Subject as MgaFCO, true)
+                        .Distinct()
+                        .Where(x => x.BoolAttrByName["IsAbstract"] == false);
+
+                    dstEnds = GetDstEnd(Subject as MgaFCO, true)
+                        .Distinct()
+                        .Where(x => x.BoolAttrByName["IsAbstract"] == false);
+
+                    parents = GetParents(Subject as MgaFCO, true)
+                        .Distinct()
+                        .Where(x => x.BoolAttrByName["IsAbstract"] == false);
                 }
 
                 List<string> srcEndNames = GetSrcEnd(Subject as MgaFCO, true).
                         Where(x => x.BoolAttrByName["IsAbstract"] == false).
-                        Select(x => x.Name).
+                        Select(x => x.Name)
+                        .Distinct().
                         ToList();
 
                 srcEndNames.Sort();
 
                 List<string> dstEndNames = GetDstEnd(Subject as MgaFCO, true).
                         Where(x => x.BoolAttrByName["IsAbstract"] == false).
-                        Select(x => x.Name).
+                        Select(x => x.Name)
+                        .Distinct().
                         ToList();
 
                 dstEndNames.Sort();


More information about the gme-commit mailing list