/// <summary> /// Extracts metadata information associtated with the CLR assembly. /// </summary> /// <exception cref="InvalidScriptAssemblyException">The assembly is invalid.</exception> private static ScriptAssemblyAttribute /*!*/ GetAttribute(Assembly /*!*/ realAssembly) { ScriptAssemblyAttribute result = ScriptAssemblyAttribute.Reflect(realAssembly); if (result == null) { throw new InvalidScriptAssemblyException(realAssembly); } return(result); }
internal static ScriptAssembly /*!*/ Create(ApplicationContext /*!*/ applicationContext, Assembly /*!*/ realAssembly, ScriptAssemblyAttribute /*!*/ scriptAttribute, string libraryRoot) { if (scriptAttribute.IsMultiScript) { return(new MultiScriptAssembly(applicationContext, realAssembly, libraryRoot)); } else { return(new SingleScriptAssembly(applicationContext, realAssembly, libraryRoot)); } }
/// <summary> /// Gets a script type stored in a specified single-script assembly. /// </summary> internal Type /*!*/ GetScriptType() { if (this.scriptType == null) { var attr = ScriptAssemblyAttribute.Reflect(RealModule.Assembly); Debug.Assert(attr != null); Debug.Assert(!attr.IsMultiScript); Debug.Assert(attr.SSAScriptType != null); this.scriptType = attr.SSAScriptType; Debug.Assert(this.scriptType != null); } return(this.scriptType); }
/// <summary> /// Loads a script assembly using a specified CLR assembly. /// </summary> /// <param name="assembly">The assembly to be reflected.</param> /// <returns>The script assembly.</returns> /// <exception cref="InvalidScriptAssemblyException">The assembly is invalid.</exception> public static ScriptAssembly LoadFromAssembly(Assembly /*!*/ assembly) { Debug.Assert(assembly != null); ScriptAssembly result; ScriptAssemblyAttribute attr = GetAttribute(assembly); if (attr.IsMultiScript) { result = new MultiScriptAssembly(); } else { result = new SingleScriptAssembly(); } result.namespacing = attr.Namespacing; result.module = GetModule(assembly); result.LoadedFromAssembly(assembly); return(result); }
internal static ScriptAssembly/*!*/ Create(ApplicationContext/*!*/ applicationContext, Assembly/*!*/ realAssembly, ScriptAssemblyAttribute/*!*/ scriptAttribute, string libraryRoot) { if (scriptAttribute.IsMultiScript) return new MultiScriptAssembly(applicationContext, realAssembly, libraryRoot); else return new SingleScriptAssembly(applicationContext, realAssembly, libraryRoot); }
internal static ScriptAssembly/*!*/ Create(ApplicationContext/*!*/ applicationContext, Assembly/*!*/ realAssembly, ScriptAssemblyAttribute/*!*/ scriptAttribute) { return Create(applicationContext, realAssembly, scriptAttribute, null); }
internal static ScriptAssembly /*!*/ Create(ApplicationContext /*!*/ applicationContext, Assembly /*!*/ realAssembly, ScriptAssemblyAttribute /*!*/ scriptAttribute) { return(Create(applicationContext, realAssembly, scriptAttribute, null)); }