本文整理汇总了C#中ArrayBuilder.Free方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayBuilder.Free方法的具体用法?C# ArrayBuilder.Free怎么用?C# ArrayBuilder.Free使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayBuilder
的用法示例。
在下文中一共展示了ArrayBuilder.Free方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FreeDeconstructionVariables
private static void FreeDeconstructionVariables(ArrayBuilder<DeconstructionVariable> variables)
{
foreach (var v in variables)
{
if (v.HasNestedVariables)
{
FreeDeconstructionVariables(v.NestedVariables);
}
}
variables.Free();
}
示例2: GetCustomAttributesToEmitIterator
private IEnumerable<CSharpAttributeData> GetCustomAttributesToEmitIterator(
ImmutableArray<CSharpAttributeData> userDefined,
ArrayBuilder<SynthesizedAttributeData> synthesized,
bool isReturnType,
bool emittingAssemblyAttributesInNetModule)
{
CheckDefinitionInvariant();
if (synthesized != null)
{
foreach (var attribute in synthesized)
{
// only synthesize attributes that are emitted:
Debug.Assert(attribute.ShouldEmitAttribute(this, isReturnType, emittingAssemblyAttributesInNetModule));
yield return attribute;
}
synthesized.Free();
}
for (int i = 0; i < userDefined.Length; i++)
{
CSharpAttributeData attribute = userDefined[i];
if (this.Kind == SymbolKind.Assembly)
{
// We need to filter out duplicate assembly attributes (i.e. attributes that
// bind to the same constructor and have identical arguments) and invalid
// InternalsVisibleTo attributes.
if (((SourceAssemblySymbol)this).IsIndexOfOmittedAssemblyAttribute(i))
{
continue;
}
}
if (attribute.ShouldEmitAttribute(this, isReturnType, emittingAssemblyAttributesInNetModule))
{
yield return attribute;
}
}
}
示例3: ParseParameterList
private ParameterInfo[] ParseParameterList()
{
// Consume the opening parenthesis or bracket
Debug.Assert(PeekNextChar() == '(' || PeekNextChar() == '[');
++_index;
var nextChar = PeekNextChar();
if (nextChar == ')' || nextChar == ']')
{
// Empty parameter list
++_index;
return s_noParameters;
}
var builder = new ArrayBuilder<ParameterInfo>();
while (true)
{
var parameter = ParseParameter();
if (parameter != null)
{
builder.Add(parameter.Value);
}
else
{
builder.Free();
return null;
}
if (PeekNextChar() == ',')
{
++_index;
}
else
{
break;
}
}
nextChar = PeekNextChar();
if (nextChar == ')' || nextChar == ']')
{
// Consume the closing parenthesis or bracket
++_index;
}
else
{
// Malformed parameter list: missing close parenthesis or bracket
builder.Free();
return null;
}
return builder.ToArrayAndFree();
}
示例4: ParseTypeArgumentList
private TypeInfo[] ParseTypeArgumentList(ISymbol bindingContext)
{
Debug.Assert(PeekNextChar() == '<');
++_index;
var builder = new ArrayBuilder<TypeInfo>();
while (true)
{
var type = ParseType(bindingContext);
if (type == null)
{
builder.Free();
return null;
}
builder.Add(type.Value);
if (PeekNextChar() == ',')
{
++_index;
}
else
{
break;
}
}
if (PeekNextChar() == '>')
{
++_index;
}
else
{
builder.Free();
return null;
}
return builder.ToArrayAndFree();
}
示例5: ToSourceTextAndFree
internal static SourceText ToSourceTextAndFree(ArrayBuilder<SourceText> segments, SourceText original, bool adjustSegments)
{
if (adjustSegments)
{
TrimInaccessibleText(segments);
ReduceSegmentCountIfNecessary(segments);
}
if (segments.Count == 0)
{
segments.Free();
return SourceText.From(string.Empty, original.Encoding, original.ChecksumAlgorithm);
}
else if (segments.Count == 1)
{
SourceText result = segments[0];
segments.Free();
return result;
}
else
{
return new CompositeText(segments.ToImmutableAndFree(), original.Encoding, original.ChecksumAlgorithm);
}
}