public override QsTypeKind onTypeParameter(QsTypeParameter tp) { this.CodeOutput.onTypeParameter(tp); var tpName = NonNullable <string> .New(this.CodeOutput.Output ?? ""); this.OnIdentifier?.Invoke(Identifier.NewLocalVariable(tpName), tp.Range); return(QsTypeKind.NewTypeParameter(tp)); }
public override ResolvedTypeKind OnTypeParameter(QsTypeParameter tp) { if (this.SharedState.TypeParams.TryGetValue(Tuple.Create(tp.Origin, tp.TypeName), out var typeParam)) { return(typeParam.Resolution); } return(ResolvedTypeKind.NewTypeParameter(tp)); }
public override ResolvedTypeKind OnTypeParameter(QsTypeParameter tp) { // Reroute a type parameter's origin to the newly generated operation if (!this.SharedState.IsRecursiveIdentifier && this.SharedState.OldName.Equals(tp.Origin)) { tp = new QsTypeParameter(this.SharedState.NewName, tp.TypeName, tp.Range); } return(base.OnTypeParameter(tp)); }
public override ResolvedTypeKind OnTypeParameter(QsTypeParameter tp) { // If the type parameter is from the same callable, // then the type resolution is constrictive. if (tp.Origin.Equals(this.SharedState.Origin)) { this.SharedState.IsConstrictive = true; } return(base.OnTypeParameter(tp)); }
public override QsTypeKind <ResolvedType, UserDefinedType, QsTypeParameter, CallableInformation> OnTypeParameter(QsTypeParameter tp) { if (this.SharedState.CurrentParamTypes.TryGetValue(Tuple.Create(tp.Origin, tp.TypeName), out var typeParam)) { return(typeParam.Resolution); } return(QsTypeKind <ResolvedType, UserDefinedType, QsTypeParameter, CallableInformation> .NewTypeParameter(tp)); }
// If an intrinsic callable is generic, then its type parameters can occur within expressions; // when generic intrinsics are called, the type of that call contains type parameter types. public override QsTypeKind <ResolvedType, UserDefinedType, QsTypeParameter, CallableInformation> OnTypeParameter(QsTypeParameter tp) => this.SharedState.IntrinsicCallableSet.Contains(tp.Origin) ? QsTypeKind <ResolvedType, UserDefinedType, QsTypeParameter, CallableInformation> .NewTypeParameter(tp) : throw new Exception("Type Parameter types must be resolved");
public override QsTypeKind <ResolvedType, UserDefinedType, QsTypeParameter, CallableInformation> onTypeParameter(QsTypeParameter tp) { throw new Exception("Type Parameter types must be resolved"); }
public override QsResolvedTypeKind OnTypeParameter(QsTypeParameter tp) { this.SharedState.BuiltType = this.SharedState.Context.Int8Type.CreatePointerType(); return(base.OnTypeParameter(tp)); }
public override ResolvedTypeKind OnTypeParameter(QsTypeParameter tp) { this.SharedState.TypeParams.Add(AsTypeResolutionKey(tp)); return(base.OnTypeParameter(tp)); }
private static TypeParameterName AsTypeResolutionKey(QsTypeParameter tp) => Tuple.Create(tp.Origin, tp.TypeName);
public override ResolvedTypeKind OnTypeParameter(QsTypeParameter tp) => // Reroute a type parameter's origin to the newly generated operation !this.SharedState.IsRecursiveIdentifier && this.SharedState.OldName.Equals(tp.Origin) ? base.OnTypeParameter(tp.With(this.SharedState.NewName)) : base.OnTypeParameter(tp);