本文整理汇总了C#中System.Function.AddAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# Function.AddAttribute方法的具体用法?C# Function.AddAttribute怎么用?C# Function.AddAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Function
的用法示例。
在下文中一共展示了Function.AddAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenSelectStoreFunctions
////////////////////////////////////////////////////////////////////////////
protected override void GenSelectStoreFunctions(MapType abstractedType, TypeCtorDecl synonym, out Function/*!*/ select, out Function/*!*/ store)
{
//Contract.Requires(synonym != null);
//Contract.Requires(abstractedType != null);
Contract.Ensures(Contract.ValueAtReturn(out select) != null);
Contract.Ensures(Contract.ValueAtReturn(out store) != null);
Type/*!*/ mapTypeSynonym;
List<TypeVariable/*!*/>/*!*/ typeParams;
List<Type/*!*/>/*!*/ originalInTypes;
GenTypeAxiomParams(abstractedType, synonym, out mapTypeSynonym,
out typeParams, out originalInTypes);
// select
List<TypeVariable/*!*/>/*!*/ explicitSelectParams, implicitSelectParams;
select = CreateAccessFun(typeParams, originalInTypes,
abstractedType.Result, synonym.Name + "Select",
out implicitSelectParams, out explicitSelectParams);
// store, which gets one further argument: the assigned rhs
originalInTypes.Add(abstractedType.Result);
List<TypeVariable/*!*/>/*!*/ explicitStoreParams, implicitStoreParams;
store = CreateAccessFun(typeParams, originalInTypes,
mapTypeSynonym, synonym.Name + "Store",
out implicitStoreParams, out explicitStoreParams);
// the store function does not have any explicit type parameters
Contract.Assert(explicitStoreParams.Count == 0);
if (CommandLineOptions.Clo.UseArrayTheory) {
select.AddAttribute("builtin", "select");
store.AddAttribute("builtin", "store");
} else {
AxBuilder.AddTypeAxiom(GenMapAxiom0(select, store,
abstractedType.Result,
implicitSelectParams, explicitSelectParams,
originalInTypes));
AxBuilder.AddTypeAxiom(GenMapAxiom1(select, store,
abstractedType.Result,
explicitSelectParams));
}
}
示例2: GenSelectStoreFunctions
////////////////////////////////////////////////////////////////////////////
protected override void GenSelectStoreFunctions(MapType abstractedType, TypeCtorDecl synonym, out Function/*!*/ select, out Function/*!*/ store) {
//Contract.Requires(synonym != null);
//Contract.Requires(abstractedType != null);
Contract.Ensures(Contract.ValueAtReturn(out select) != null);
Contract.Ensures(Contract.ValueAtReturn(out store) != null);
Contract.Assert(synonym.Name != null);
string/*!*/ baseName = synonym.Name;
int typeParamNum = abstractedType.FreeVariables.Count +
abstractedType.TypeParameters.Count;
int arity = typeParamNum + abstractedType.Arguments.Count;
Type/*!*/[]/*!*/ selectTypes = new Type/*!*/ [arity + 2];
Type/*!*/[]/*!*/ storeTypes = new Type/*!*/ [arity + 3];
int i = 0;
// Fill in the free variables and type parameters
for (; i < typeParamNum; i++) {
selectTypes[i] = AxBuilder.T;
storeTypes[i] = AxBuilder.T;
}
// Fill in the map type
if (CommandLineOptions.Clo.MonomorphicArrays) {
selectTypes[i] = abstractedType;
storeTypes[i] = abstractedType;
} else {
selectTypes[i] = AxBuilder.U;
storeTypes[i] = AxBuilder.U;
}
i++;
// Fill in the index types
foreach (Type/*!*/ type in abstractedType.Arguments) {
Contract.Assert(type != null);
if (CommandLineOptions.Clo.Monomorphize && AxBuilder.UnchangedType(type)) {
selectTypes[i] = type;
storeTypes[i] = type;
} else {
selectTypes[i] = AxBuilder.U;
storeTypes[i] = AxBuilder.U;
}
i++;
}
// Fill in the output type for select function which also happens
// to be the type of the last argument to the store function
if (CommandLineOptions.Clo.Monomorphize && AxBuilder.UnchangedType(abstractedType.Result)) {
selectTypes[i] = abstractedType.Result;
storeTypes[i] = abstractedType.Result;
} else {
selectTypes[i] = AxBuilder.U;
storeTypes[i] = AxBuilder.U;
}
i++;
// Fill in the map type which is the output of the store function
if (CommandLineOptions.Clo.MonomorphicArrays)
storeTypes[i] = abstractedType;
else
storeTypes[i] = AxBuilder.U;
Contract.Assert(cce.NonNullElements<Type>(selectTypes));
Contract.Assert(cce.NonNullElements<Type>(storeTypes));
select = HelperFuns.BoogieFunction(baseName + "Select", selectTypes);
store = HelperFuns.BoogieFunction(baseName + "Store", storeTypes);
if (CommandLineOptions.Clo.UseArrayTheory) {
select.AddAttribute("builtin", "select");
store.AddAttribute("builtin", "store");
} else {
AxBuilder.AddTypeAxiom(GenMapAxiom0(select, store,
abstractedType.TypeParameters.Count, abstractedType.FreeVariables.Count));
AxBuilder.AddTypeAxiom(GenMapAxiom1(select, store,
abstractedType.TypeParameters.Count, abstractedType.FreeVariables.Count));
}
}