本文整理汇总了C#中ConsList.Prepend方法的典型用法代码示例。如果您正苦于以下问题:C# ConsList.Prepend方法的具体用法?C# ConsList.Prepend怎么用?C# ConsList.Prepend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConsList
的用法示例。
在下文中一共展示了ConsList.Prepend方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveBounds
protected override TypeParameterBounds ResolveBounds(ConsList<TypeParameterSymbol> inProgress, DiagnosticBag diagnostics)
{
var typeParameter = this.OverriddenTypeParameter;
if ((object)typeParameter == null)
{
return null;
}
var map = _map.TypeMap;
Debug.Assert(map != null);
var constraintTypes = map.SubstituteTypesWithoutModifiers(typeParameter.ConstraintTypesNoUseSiteDiagnostics);
return this.ResolveBounds(this.ContainingAssembly.CorLibrary, inProgress.Prepend(this), constraintTypes, true, this.DeclaringCompilation, diagnostics);
}
示例2: GetBounds
private TypeParameterBounds GetBounds(ConsList<TypeParameterSymbol> inProgress)
{
Debug.Assert(!inProgress.ContainsReference(this));
Debug.Assert(!inProgress.Any() || ReferenceEquals(inProgress.Head.ContainingSymbol, this.ContainingSymbol));
if (ReferenceEquals(_lazyBounds, TypeParameterBounds.Unset))
{
var constraintTypes = GetDeclaredConstraintTypes();
Debug.Assert(!constraintTypes.IsDefault);
var diagnostics = ArrayBuilder<TypeParameterDiagnosticInfo>.GetInstance();
ArrayBuilder<TypeParameterDiagnosticInfo> useSiteDiagnosticsBuilder = null;
bool inherited = (_containingSymbol.Kind == SymbolKind.Method) && ((MethodSymbol)_containingSymbol).IsOverride;
var bounds = this.ResolveBounds(this.ContainingAssembly.CorLibrary, inProgress.Prepend(this), constraintTypes, inherited, currentCompilation: null,
diagnosticsBuilder: diagnostics, useSiteDiagnosticsBuilder: ref useSiteDiagnosticsBuilder);
DiagnosticInfo errorInfo = null;
if (diagnostics.Count > 0)
{
errorInfo = diagnostics[0].DiagnosticInfo;
}
else if (useSiteDiagnosticsBuilder != null && useSiteDiagnosticsBuilder.Count > 0)
{
foreach (var diag in useSiteDiagnosticsBuilder)
{
if (diag.DiagnosticInfo.Severity == DiagnosticSeverity.Error)
{
errorInfo = diag.DiagnosticInfo;
break;
}
else if ((object)errorInfo == null)
{
errorInfo = diag.DiagnosticInfo;
}
}
}
diagnostics.Free();
Interlocked.CompareExchange(ref _lazyBoundsErrorInfo, errorInfo, CSDiagnosticInfo.EmptyErrorInfo);
Interlocked.CompareExchange(ref _lazyBounds, bounds, TypeParameterBounds.Unset);
}
Debug.Assert(!ReferenceEquals(_lazyBoundsErrorInfo, CSDiagnosticInfo.EmptyErrorInfo));
return _lazyBounds;
}
示例3: MakeDeclaredBases
private Tuple<NamedTypeSymbol, ImmutableArray<NamedTypeSymbol>> MakeDeclaredBases(ConsList<Symbol> basesBeingResolved, DiagnosticBag diagnostics)
{
if (this.TypeKind == TypeKind.Enum)
{
// Handled by GetEnumUnderlyingType().
return new Tuple<NamedTypeSymbol, ImmutableArray<NamedTypeSymbol>>(null, ImmutableArray<NamedTypeSymbol>.Empty);
}
var reportedPartialConflict = false;
Debug.Assert(basesBeingResolved == null || !basesBeingResolved.ContainsReference(this.OriginalDefinition));
var newBasesBeingResolved = basesBeingResolved.Prepend(this.OriginalDefinition);
var baseInterfaces = ArrayBuilder<NamedTypeSymbol>.GetInstance();
NamedTypeSymbol baseType = null;
foreach (var decl in this.declaration.Declarations)
{
Tuple<NamedTypeSymbol, ImmutableArray<NamedTypeSymbol>> one = MakeOneDeclaredBases(newBasesBeingResolved, decl, diagnostics);
if ((object)one == null) continue;
var partBase = one.Item1;
var partInterfaces = one.Item2;
if (!reportedPartialConflict)
{
if ((object)baseType == null)
{
baseType = partBase;
}
else if (baseType.TypeKind == TypeKind.Error && (object)partBase != null)
{
// if the old base was an error symbol, copy it to the interfaces list so it doesn't get lost
partInterfaces = partInterfaces.Add(baseType);
baseType = partBase;
}
else if ((object)partBase != null && partBase != baseType && partBase.TypeKind != TypeKind.Error)
{
// the parts do not agree
var info = diagnostics.Add(ErrorCode.ERR_PartialMultipleBases, Locations[0], this);
baseType = new ExtendedErrorTypeSymbol(baseType, LookupResultKind.Ambiguous, info);
reportedPartialConflict = true;
}
}
int n = baseInterfaces.Count;
foreach (var t in partInterfaces) // this could probably be done more efficiently with a side hash table if it proves necessary
{
for (int i = 0; i < n; i++)
{
if (t == baseInterfaces[i])
{
goto alreadyInInterfaceList;
}
}
baseInterfaces.Add(t);
alreadyInInterfaceList:;
}
}
if ((object)baseType != null && baseType.IsStatic)
{
// '{1}': cannot derive from static class '{0}'
diagnostics.Add(ErrorCode.ERR_StaticBaseClass, Locations[0], baseType, this);
}
HashSet<DiagnosticInfo> useSiteDiagnostics = null;
if ((object)baseType != null && !this.IsNoMoreVisibleThan(baseType, ref useSiteDiagnostics))
{
// Inconsistent accessibility: base class '{1}' is less accessible than class '{0}'
diagnostics.Add(ErrorCode.ERR_BadVisBaseClass, Locations[0], this, baseType);
}
var baseInterfacesRO = baseInterfaces.ToImmutableAndFree();
if (DeclaredAccessibility != Accessibility.Private && IsInterface)
{
foreach (var i in baseInterfacesRO)
{
if (!i.IsAtLeastAsVisibleAs(this, ref useSiteDiagnostics))
{
// Inconsistent accessibility: base interface '{1}' is less accessible than interface '{0}'
diagnostics.Add(ErrorCode.ERR_BadVisBaseInterface, Locations[0], this, i);
}
}
}
diagnostics.Add(Locations[0], useSiteDiagnostics);
return new Tuple<NamedTypeSymbol, ImmutableArray<NamedTypeSymbol>>(baseType, baseInterfacesRO);
}