ICSharpCode.NRefactory.MonoCSharp.ModuleContainer.SetDeclaringAssembly C# (CSharp) Method

SetDeclaringAssembly() public method

public SetDeclaringAssembly ( AssemblyDefinition assembly ) : void
assembly AssemblyDefinition
return void
		public void SetDeclaringAssembly (AssemblyDefinition assembly)
		{
			// TODO: This setter is quite ugly but I have not found a way around it yet
			this.assembly = assembly;
		}
	}

Usage Example

Example #1
0
        public string [] GetCompletions(string input, out string prefix)
        {
            prefix = "";
            if (input == null || input.Length == 0)
            {
                return(null);
            }

            lock (evaluator_lock){
                if (!inited)
                {
                    Init();
                }

                bool         partial_input;
                CSharpParser parser = ParseString(ParseMode.GetCompletions, input, out partial_input);
                if (parser == null)
                {
                    return(null);
                }

                Class host = parser.InteractiveResult;

                var base_class_imported = importer.ImportType(base_class);
                var baseclass_list      = new List <FullNamedExpression> (1)
                {
                    new TypeExpression(base_class_imported, host.Location)
                };
                host.SetBaseTypes(baseclass_list);

#if NET_4_0
                var access = AssemblyBuilderAccess.RunAndCollect;
#else
                var access = AssemblyBuilderAccess.Run;
#endif
                var a = new AssemblyDefinitionDynamic(module, "completions");
                a.Create(AppDomain.CurrentDomain, access);
                module.SetDeclaringAssembly(a);

                // Need to setup MemberCache
                host.CreateContainer();
                // Need to setup base type
                host.DefineContainer();

                var          method = host.Members[0] as Method;
                BlockContext bc     = new BlockContext(method, method.Block, ctx.BuiltinTypes.Void);

                try {
                    method.Block.Resolve(bc, method);
                } catch (CompletionResult cr) {
                    prefix = cr.BaseText;
                    return(cr.Result);
                }
            }
            return(null);
        }
All Usage Examples Of ICSharpCode.NRefactory.MonoCSharp.ModuleContainer::SetDeclaringAssembly