Exemple #1
0
        private bool CompileCode(ref string error)
        {
            bool compileSuccess = true;
            var  model          = InteractiveManager.GetCurrentDocumentSymbol();

            if (model != null)
            {
                Diagnostic[] dg = model.GetDiagnostics().ToArray();

                if (dg.Length > 0)
                {
                    error = "The following compile error occured:\r\n";
                    foreach (Diagnostic d in dg)
                    {
                        var loc = d.Location;
                        error += string.Format("Info:{0},Location:{1} \n Error Line number:{2}\n",
                                               d.Info, loc.ToString(), loc.GetLineSpan(false).StartLinePosition.Line);
                    }
                    compileSuccess = false;
                }
            }
            return(compileSuccess);
        }