private ImportClass ( |
||
cl | ||
Résultat | void |
private void ImportClass(NativeJavaClass cl)
{
string s = cl.GetClassObject().FullName;
string n = Sharpen.Runtime.Substring(s, s.LastIndexOf('.') + 1);
object val = Get(n, this);
if (val != ScriptableConstants.NOT_FOUND && val != cl)
{
throw Context.ReportRuntimeError1("msg.prop.defined", n);
}
//defineProperty(n, cl, DONTENUM);
Put(n, this, cl);
}
private object Js_construct(Scriptable scope, object[] args) { Rhino.ImporterTopLevel result = new Rhino.ImporterTopLevel(); for (int i = 0; i != args.Length; ++i) { object arg = args[i]; if (arg is NativeJavaClass) { result.ImportClass((NativeJavaClass)arg); } else { if (arg is NativeJavaPackage) { result.ImportPackage((NativeJavaPackage)arg); } else { throw Context.ReportRuntimeError1("msg.not.class.not.pkg", Context.ToString(arg)); } } } // set explicitly prototype and scope // as otherwise in top scope mode BaseFunction.construct // would keep them set to null. It also allow to use // JavaImporter without new and still get properly // initialized object. result.SetParentScope(scope); result.SetPrototype(this); return result; }