Esempio n. 1
0
 //------------------------------------------------------------
 // CController.ReportErrors
 //
 /// <summary>
 /// <para>(In sscli, CompilerHost::ReportErrors
 /// and CController::ReportErrorsToHost)</para>
 /// </summary>
 /// <param name="errorContainer"></param>
 //------------------------------------------------------------
 internal void ReportErrors(CErrorContainer errorContainer)
 {
     for (int i = 0; i < errorContainer.Count; i++)
     {
         ReportError(errorContainer.GetErrorAt(i));
     }
 }
Esempio n. 2
0
 //------------------------------------------------------------
 // CInteriorNode.CreateErrorContainer
 //
 /// <summary>
 /// Create an CErrorContainer instance
 /// and set it to this.errorContainer.
 /// </summary>
 /// <returns></returns>
 //------------------------------------------------------------
 internal CErrorContainer CreateErrorContainer()
 {
     this.errorContainer = CErrorContainer.CreateInstance(
         ERRORCATEGORY.METHODPARSE,
         (uint)0);
     return(this.errorContainer);
 }
Esempio n. 3
0
 //------------------------------------------------------------
 // CController.Cleanup
 //------------------------------------------------------------
 internal void Cleanup()
 {
     // If we still have an error container, get rid of it
     if (compilerErrors != null)
     {
         // The container will have already been sent back to the host
         compilerErrors.ReleaseAllErrors();
         compilerErrors = null;
     }
 }
Esempio n. 4
0
        //------------------------------------------------------------
        // CController.SubmitError
        //
        /// <summary>
        /// <para>This function places a fully-constructed CError object into an error container
        /// and sends it to the compiler host (this would be the place to batch these guys
        /// up if we decide to.</para>
        /// </summary>
        /// <param name="error"></param>
        /// <remarks>
        /// Note that if the error can't be put into a container (if, for example, we
        /// can't create a container) the error is destroyed and the host is notified via
        /// OnCatastrophicError.
        /// </remarks>
        //------------------------------------------------------------
        internal void SubmitError(CError error)
        {
            // Allow NULL --
            // this is often called with a function that returns an error as an argument;
            // it may not actually be an error.
            if (error == null)
            {
                return;
            }

            // Remember that we had an error (if this isn't a warning)
            CountErrorObject(error);

            if (this.SuppressErrors && error.Kind != ERRORKIND.FATAL)
            {
                return;
            }

            // Make sure we have an error container we can use.  Note that we (somewhat hackily)
            // check the ref count on any existing container, and if 1, re-use it.  (If it's
            // 1, it means we have the only ref on it, so nobody will be hurt by re-using it).
            if (this.compilerErrors != null)
            {
                // This one can be re-used -- just empty it.
                this.compilerErrors.ReleaseAllErrors();
            }

            // Create a new container for the errors
            if (this.compilerErrors == null)
            {
                this.compilerErrors = CErrorContainer.CreateInstance(ERRORCATEGORY.COMPILATION, 0);
            }

            // We must have a container by now!  Add the error and push it to the host.
            DebugUtil.Assert(compilerErrors != null);
            if (this.compilerErrors.AddError(error))
            {
                this.ReportErrors(this.compilerErrors);
            }
        }