Beispiel #1
0
        /// <exception cref="UserCodeContainsErrors"></exception>
        public Project Parse(System.Collections.Immutable.ImmutableList <UxFileContents> documents, IMarkupErrorLog reporter)
        {
            const string restartSuggestion = "Restarting Fuse might be required for changes in Uno code to take effect";

            try
            {
                var ghostCompiler = _ghostCompilerFactory.CreateGhostCompiler(documents);
                var docs          = Parse(documents, ghostCompiler, reporter);
                return(docs);
            }
            catch (InvalidMarkup e)
            {
                reporter.ReportError(e.File, e.Position.HasValue ? e.Position.Value.Line : 1, e.Message);
                throw;
            }
            catch (CyclicClassHierarchy)
            {
                reporter.ReportError("UX class hierarchy contains cycles");
                throw;
            }
            catch (TypeNotFound e)
            {
                reporter.ReportError(e.File, 1, "Type " + e.TypeName + " not found (" + restartSuggestion + ")");
                throw;
            }
            catch (UnknownBaseClass e)
            {
                reporter.ReportError(e.DeclaringFile, 1, "Unknown base class " + e.BaseClassName + " for class " + e.DeclaredClassName + " (" + restartSuggestion + ")");
                throw;
            }
            catch (UnknownMemberType e)
            {
                reporter.ReportError(e.DeclaringFile, 1, "Unknown type `" + e.TypeName + "` for member `" + e.MemberName + "` in " + e.DeclaringClassName + ".");
                throw;
            }
            catch (TypeNameCollision e)
            {
                reporter.ReportError("Multiple definitions of type `" + e.TypeName + "` in project");
                throw;
            }
            catch (UnknownError e)
            {
                // TODO: this reports an unavidable already reported NRE.. should get rid of that somehow
                reporter.ReportError(e.Message);
                throw;
            }
        }
 public void ReportError(string message)
 {
     HasErrors = true;
     _innerLog.ReportError(message);
 }