Compile() public static method

public static Compile ( string source, bool debugInformation ) : Program
source string
debugInformation bool
return Program
Ejemplo n.º 1
0
 public static bool HasErrors(string script, out string errors)
 {
     try
     {
         errors = (string)null;
         return(JintEngine.Compile(script, false) != null);
     }
     catch (Exception ex)
     {
         errors = ex.Message;
         return(true);
     }
 }
Ejemplo n.º 2
0
        public object Run(string script, bool unwrap)
        {
            if (script == null)
            {
                throw new ArgumentException("Script can't be null", nameof(script));
            }
            Program program;

            try
            {
                program = JintEngine.Compile(script, this.DebugMode);
            }
            catch (Exception ex)
            {
                throw new JintException("An unexpected error occured while parsing the script", ex);
            }
            if (program == null)
            {
                return((object)null);
            }
            return(this.Run(program, unwrap));
        }