本文整理汇总了C#中ISeq.seq方法的典型用法代码示例。如果您正苦于以下问题:C# ISeq.seq方法的具体用法?C# ISeq.seq怎么用?C# ISeq.seq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISeq
的用法示例。
在下文中一共展示了ISeq.seq方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateInterface
public static Type GenerateInterface(string iName, ISeq extends, ISeq methods)
{
GenContext context = new GenContext(iName, CompilerMode.File);
// GenContext context = (GenContext)Compiler.COMPILER_CONTEXT.deref();
// if (context == null)
// {
//#if DEBUG
// context = new GenContext(iName, CompilerMode.File);
//#else
// throw new InvalidOperationException("No compiler context on the stack.");
//#endif
// }
Type[] interfaceTypes = GenClass.CreateTypeArray(extends == null ? null : extends.seq());
TypeBuilder proxyTB = context.ModuleBldr.DefineType(
iName,
TypeAttributes.Interface | TypeAttributes.Public | TypeAttributes.Abstract,
null,
interfaceTypes);
DefineMethods(proxyTB, methods);
Type t = proxyTB.CreateType();
context.AssyBldr.Save(iName + ".dll");
return t;
}
示例2: GenerateInterface
public static Type GenerateInterface(string iName, IPersistentMap attributes, ISeq extends, ISeq methods)
{
iName = iName.Replace('-', '_');
GenContext context;
if (Compiler.IsCompiling)
{
//string path = (string)Compiler.COMPILE_PATH.deref();
//if (path == null)
// throw new Exception("*compile-path* not set");
//context = new GenContext(iName, ".dll", path, CompilerMode.File);
context = (GenContext)Compiler.COMPILER_CONTEXT.deref();
}
else
// TODO: In CLR4, should create a collectible type?
context = GenContext.CreateWithExternalAssembly(iName, ".dll", false);
Type[] interfaceTypes = GenClass.CreateTypeArray(extends == null ? null : extends.seq());
TypeBuilder proxyTB = context.ModuleBuilder.DefineType(
iName,
TypeAttributes.Interface | TypeAttributes.Public | TypeAttributes.Abstract,
null,
interfaceTypes);
SetCustomAttributes(proxyTB, attributes);
DefineMethods(proxyTB, methods);
Type t = proxyTB.CreateType();
//if ( Compiler.IsCompiling )
// context.SaveAssembly();
Compiler.RegisterDuplicateType(t);
return t;
}
示例3: DefineMethods
private static void DefineMethods(TypeBuilder proxyTB, ISeq methods)
{
for (ISeq s = methods == null ? null : methods.seq(); s != null; s = s.next())
DefineMethod(proxyTB, (IPersistentVector)s.first());
}
示例4: CreateTypeArray
internal static Type[] CreateTypeArray(ISeq seq)
{
List<Type> types = new List<Type>();
for (ISeq s = seq == null ? null : seq.seq(); s != null; s = s.next())
{
Object o = s.first();
Type oAsType = o as Type;
if (oAsType != null )
types.Add(oAsType);
else if (o is ISeq)
{
object first = RT.first(o);
Symbol firstAsSymbol = first as Symbol;
if (firstAsSymbol == null || !firstAsSymbol.Equals(HostExpr.ByRefSym))
throw new ArgumentException("First element of parameter definition is not by-ref");
Type secondAsType = RT.second(o) as Type;
if (secondAsType == null)
throw new ArgumentException("by-ref must be paired with a type");
types.Add(secondAsType.MakeByRefType());
}
else
throw new ArgumentException("Bad parameter definition");
}
if ( types.Count == 0 )
return Type.EmptyTypes;
return types.ToArray<Type>();
}
示例5: CreateTypeArray
internal static Type[] CreateTypeArray(ISeq seq)
{
List<Type> types = new List<Type>();
for (ISeq s = seq == null ? null : seq.seq(); s != null; s = s.next())
{
Object o = s.first();
if (o is Type)
types.Add((Type)o);
else if (o is ISeq)
{
object first = RT.first(o);
object second = RT.second(o);
if (!(first is Symbol) || !((Symbol)first).Equals(HostExpr.BY_REF))
throw new ArgumentException("First element of parameter definition is not by-ref");
if (!(second is Type))
throw new ArgumentException("by-ref must be paired with a type");
Type t = (Type)second;
types.Add(t.MakeByRefType());
}
else
throw new ArgumentException("Bad parameter definition");
}
if ( types.Count == 0 )
return Type.EmptyTypes;
return types.ToArray<Type>();
}
示例6: CreateTypeArray
internal static Type[] CreateTypeArray(ISeq seq)
{
List<Type> types = new List<Type>();
for (ISeq s = seq == null ? null :seq.seq(); s != null; s = s.next())
types.Add((Type)s.first());
if ( types.Count == 0 )
return Type.EmptyTypes;
return types.ToArray<Type>();
}