public DefaultResolvedAssembly(ICompilation compilation, DefaultUnresolvedAssembly unresolved) { this.compilation = compilation; this.unresolvedAssembly = unresolved; this.unresolvedTypeDict = unresolved.GetTypeDictionary(compilation.NameComparer); this.rootNamespace = new NS(this, unresolved.GetUnresolvedRootNamespace(compilation.NameComparer), null); this.context = new SimpleTypeResolveContext(this); this.AssemblyAttributes = unresolved.AssemblyAttributes.CreateResolvedAttributes(context); this.ModuleAttributes = unresolved.ModuleAttributes.CreateResolvedAttributes(context); }
/// <summary> /// Gets an assembly that contains BVE5's primitive and builtin types. /// </summary> /// <returns></returns> public static IUnresolvedAssembly GetBuiltinAssembly() { if(builtin_assembly == null){ var builtin_asm = new DefaultUnresolvedAssembly("BVE5Builtin"); foreach(var primitive_type in GetPrimitiveTypeDefs()) builtin_asm.AddTypeDefinition(primitive_type); var semantic_info = BVE5ResourceManager.RouteFileSemanticInfos; foreach(var type_name in semantic_info.Keys){ var cur_type_def = new DefaultUnresolvedTypeDefinition("global", type_name); InitTypeDefinition(semantic_info[type_name], cur_type_def); builtin_asm.AddTypeDefinition(cur_type_def); } builtin_assembly = builtin_asm; } return builtin_assembly; }
internal static Task<IUnresolvedAssembly> LoadModuleAsync(Module module, ICorDebugModule corModule) { string name = corModule.GetName(); if (corModule.IsDynamic() == 1 || corModule.IsInMemory() == 1) { var defaultUnresolvedAssembly = new DefaultUnresolvedAssembly(name); var defaultUnresolvedTypeDefinition = new DefaultUnresolvedTypeDefinition("UnknownDynamicType"); var defaultUnresolvedMethod = new DefaultUnresolvedMethod(defaultUnresolvedTypeDefinition, "UnknownMethod"); var defaultUnresolvedField = new DefaultUnresolvedField(defaultUnresolvedTypeDefinition, "UnknownField"); defaultUnresolvedTypeDefinition.Members.Add(defaultUnresolvedMethod); defaultUnresolvedTypeDefinition.Members.Add(defaultUnresolvedField); defaultUnresolvedAssembly.AddTypeDefinition(defaultUnresolvedTypeDefinition); weakTable.Add(defaultUnresolvedAssembly, new ModuleMetadataInfo(module, null)); return Task.FromResult<IUnresolvedAssembly>(defaultUnresolvedAssembly); } //return Task.FromResult(LoadModule(module, name)); return Task.Run(() => LoadModule(module, name)); }
void UpdateCompilation () { const string dummyAsmName = "CompiledAspNetPage"; IUnresolvedAssembly asm = new DefaultUnresolvedAssembly (dummyAsmName); compilation = new SimpleCompilation (asm, GetReferencedAssemblies ()); }
internal static Task<IUnresolvedAssembly> LoadModuleAsync(Module module, ICorDebugModule corModule) { string name = corModule.GetName(); if (corModule.IsDynamic() == 1 || corModule.IsInMemory() == 1) { var defaultUnresolvedAssembly = new DefaultUnresolvedAssembly(name); weakTable.Add(defaultUnresolvedAssembly, new ModuleMetadataInfo(module, null)); return Task.FromResult<IUnresolvedAssembly>(defaultUnresolvedAssembly); } //return Task.FromResult(LoadModule(module, name)); return Task.Run(() => LoadModule(module, name)); }