Rhino.Optimizer.Codegen.Compile C# (CSharp) Method

Compile() public method

public Compile ( CompilerEnvirons compilerEnv, ScriptNode tree, string encodedSource, bool returnFunction ) : object
compilerEnv Rhino.CompilerEnvirons
tree Rhino.Ast.ScriptNode
encodedSource string
returnFunction bool
return object
		public virtual object Compile(CompilerEnvirons compilerEnv, ScriptNode tree, string encodedSource, bool returnFunction)
		{
			int serial;
			lock (globalLock)
			{
				serial = ++globalSerialClassCounter;
			}
			string baseName = "c";
			if (tree.GetSourceName().Length > 0)
			{
				baseName = tree.GetSourceName().ReplaceAll("\\W", "_");
				if (!char.IsJavaIdentifierStart(baseName[0]))
				{
					baseName = "_" + baseName;
				}
			}
			string mainClassName = "org.mozilla.javascript.gen." + baseName + "_" + serial;
			byte[] mainClassBytes = CompileToClassFile(compilerEnv, mainClassName, tree, encodedSource, returnFunction);
			return new object[] { mainClassName, mainClassBytes };
		}