Interpreter.CompileLine C# (CSharp) Method

CompileLine() private method

private CompileLine ( string codeStr, CHash type, string assemblyName, string className ) : CompilerResults
codeStr string
type CHash
assemblyName string
className string
return CompilerResults
    CompilerResults CompileLine(string codeStr,CHash type,string assemblyName, string className) {
        CompilerParameters cp = new CompilerParameters();
        if (type == CHash.Function)
            cp.OutputAssembly = assemblyName;
        else
            cp.GenerateInMemory = true;        
        
        foreach(string r in referenceList) {
            //Utils.Print(r); //zos
            cp.ReferencedAssemblies.Add(r);
        }

		string exprStr = codeStr;
		returnsValue = false;
		if (type == CHash.Expression) {
			if (codeStr[0] != '{' && ! word_within(firstToken(codeStr),keywords)) {
				returnsValue = true;
				exprStr =  "V[\"_\"] = " + codeStr;
			}
		}		
		CompilerResults cr = CompileTemplate(cp,exprStr,type,className);
		if (cr.Errors.HasErrors) {			
			if (returnsValue) {
				// we assumed that this expression did return a value; we were wrong.
				// Try it again, without assignment to $_
				returnsValue = false;
				cr = CompileTemplate(cp,codeStr,CHash.Expression,"");
				if (! cr.Errors.HasErrors)
					return cr;
			}
			ShowErrors(cr,codeStr);			
			return null;
		}
        else
            return cr;
    }