GetSourceName() public method

Returns the URI, path or descriptive text indicating the origin of this script's source code.
Returns the URI, path or descriptive text indicating the origin of this script's source code.
public GetSourceName ( ) : string
return string
Exemplo n.º 1
0
		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 };
		}
Exemplo n.º 2
0
		private Exception ReportClassFileFormatException(ScriptNode scriptOrFn, string message)
		{
			string msg = scriptOrFn is FunctionNode ? ScriptRuntime.GetMessage2("msg.while.compiling.fn", ((FunctionNode)scriptOrFn).GetFunctionName(), message) : ScriptRuntime.GetMessage1("msg.while.compiling.script", message);
			return Context.ReportRuntimeError(msg, scriptOrFn.GetSourceName(), scriptOrFn.GetLineno(), null, 0);
		}