⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sharpassemblyparameter.cs

📁 全功能c#编译器
💻 CS
字号:
// <file>
//     <copyright see="prj:///doc/copyright.txt"/>
//     <license see="prj:///doc/license.txt"/>
//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
//     <version value="$version"/>
// </file>
using System;
using System.Collections;
using System.Text;
using System.Reflection;
using System.Xml;

using ICSharpCode.SharpAssembly.Metadata.Rows;
using ICSharpCode.SharpAssembly.Metadata;
using ICSharpCode.SharpAssembly.PE;
using ICSharpCode.SharpAssembly.Assembly;

namespace SharpDevelop.Internal.Parser {
	
	[Serializable]
	public class SharpAssemblyParameter : AbstractParameter
	{
		public SharpAssemblyParameter(SharpAssembly asm, Param[] paramTable, uint index, IReturnType type)
		{
			if (asm == null) {
				throw new System.ArgumentNullException("asm");
			}
			if (paramTable == null) {
				throw new System.ArgumentNullException("paramTable");
			}
			if (index > paramTable.GetUpperBound(0) || index < 1) {
				throw new System.ArgumentOutOfRangeException("index", index, String.Format("must be between 1 and {0}!", paramTable.GetUpperBound(0)));
			}
			AssemblyReader assembly = asm.Reader;
			
			Param param = asm.Tables.Param[index];
			
			Name = assembly.GetStringFromHeap(param.Name);
			if (param.IsFlagSet(Param.FLAG_OUT)) {
				modifier |= ParameterModifier.Out;
			}
			
			
			// Attributes
			ArrayList attrib = asm.Attributes.Param[index] as ArrayList;
			if (attrib == null) goto noatt;
			
			foreach(SharpCustomAttribute customattribute in attrib) {
				SharpAssemblyAttribute newatt = new SharpAssemblyAttribute(asm, customattribute);
				if (newatt.Name == "System.ParamArrayAttribute") modifier |= ParameterModifier.Params;
				AttributeCollection.Add(newatt);
			}
		
		noatt:
			
			if (type == null) {
				returnType = new SharpAssemblyReturnType("PARAMETER_UNKNOWN");
			} else {
				if (type.Name.EndsWith("&")) {
					modifier |= ParameterModifier.Ref;
				}
				returnType = type;
			}
			
		}
		
		public SharpAssemblyParameter(SharpAssembly asm, string paramName, IReturnType type)
		{
			Name = paramName;
			if (type.Name.EndsWith("&")) {
				modifier |= ParameterModifier.Ref;
			}
			returnType = type;
		}
		
		public override string ToString()
		{
			return "Parameter : " + returnType.FullyQualifiedName;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -