示例#1
0
文件: Method.cs 项目: nobled/mono
		/// <summary>
		/// </summary>
		/// <param name="tb"></param>
		public void Emit (Class host)
		{
			TypeBuilder tb = host.TypeBuilder;

			if (IsCtor) {
			} else {
				ILGenerator ilgen = method_builder.GetILGenerator ();

				if (local_list != null) {
					foreach (DictionaryEntry local in local_list) {
						Type local_type = host.CodeGen.TypeManager[(string)local.Key];
						if (local_type == null) {
							Console.WriteLine ("Could not find type: {0}", local.Key);
							return;
						}
						ilgen.DeclareLocal (local_type);
					}
				}

				if (instructions != null) {
					foreach (InstrBase instr in instructions)
						instr.Emit (ilgen, host);
				}
			}
		}
示例#2
0
文件: Method.cs 项目: nobled/mono
		public void Resolve (Class host)
		{
			Type return_type = host.CodeGen.TypeManager[RetType];
			method_builder = host.TypeBuilder.DefineMethod (Name, Attrs, 
				CallConv, return_type, CreateTypeList (host.CodeGen.TypeManager));
		}