本文整理汇总了C#中IKVM.Internal.ClassFile.IsValidConstant方法的典型用法代码示例。如果您正苦于以下问题:C# ClassFile.IsValidConstant方法的具体用法?C# ClassFile.IsValidConstant怎么用?C# ClassFile.IsValidConstant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKVM.Internal.ClassFile
的用法示例。
在下文中一共展示了ClassFile.IsValidConstant方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadBootstrapMethods
private static BootstrapMethod[] ReadBootstrapMethods(BigEndianBinaryReader br, ClassFile classFile)
{
BigEndianBinaryReader rdr = br.Section(br.ReadUInt32());
ushort count = rdr.ReadUInt16();
BootstrapMethod[] bsm = new BootstrapMethod[count];
for(int i = 0; i < bsm.Length; i++)
{
ushort bsm_index = rdr.ReadUInt16();
if(bsm_index >= classFile.constantpool.Length || !(classFile.constantpool[bsm_index] is ConstantPoolItemMethodHandle))
{
throw new ClassFormatError("bootstrap_method_index {0} has bad constant type in class file {1}", bsm_index, classFile.Name);
}
classFile.MarkLinkRequiredConstantPoolItem(bsm_index);
ushort argument_count = rdr.ReadUInt16();
ushort[] args = new ushort[argument_count];
for(int j = 0; j < args.Length; j++)
{
ushort argument_index = rdr.ReadUInt16();
if(!classFile.IsValidConstant(argument_index))
{
throw new ClassFormatError("argument_index {0} has bad constant type in class file {1}", argument_index, classFile.Name);
}
classFile.MarkLinkRequiredConstantPoolItem(argument_index);
args[j] = argument_index;
}
bsm[i] = new BootstrapMethod(bsm_index, args);
}
if(!rdr.IsAtEnd)
{
throw new ClassFormatError("Bad length on BootstrapMethods in class file {0}", classFile.Name);
}
return bsm;
}