Exemplo n.º 1
0
 /// <summary>
 /// Constructor for CallGraphEdge objects.
 /// Strips position info from the given type parameter resolutions.
 /// </summary>
 internal CallGraphEdge(TypeParameterResolutions paramResolutions, Range referenceRange)
     : base(referenceRange)
 {
     // Remove position info from type parameter resolutions
     this.ParamResolutions = paramResolutions.ToImmutableDictionary(
         kvp => kvp.Key,
         kvp => StripPositionInfo.Apply(kvp.Value));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Given the body of an operation, auto-generates the (content of the) adjoint specialization,
 /// under the assumption that operation calls may only ever occur within expression statements,
 /// and while-loops cannot occur within operations.
 /// Throws an ArgumentNullException if the given scope is null.
 /// </summary>
 public static QsScope GenerateAdjoint(this QsScope scope)
 {
     // Since we are pulling purely classical statements up, we are potentially changing the order of declarations.
     // We therefore need to generate unique variable names before reordering the statements.
     scope = new UniqueVariableNames().Transform(scope);
     scope = ApplyFunctorToOperationCalls.ApplyAdjoint(scope);
     scope = new ReverseOrderOfOperationCalls().Transform(scope);
     return(StripPositionInfo.Apply(scope));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Constructor for ConcreteCallGraphNode objects.
        /// Strips position info from the given type parameter resolutions.
        /// </summary>
        public ConcreteCallGraphNode(QsQualifiedName callableName, QsSpecializationKind kind, TypeParameterResolutions paramResolutions) : base(callableName)
        {
            this.Kind = kind;

            // Remove position info from type parameter resolutions
            this.ParamResolutions = paramResolutions.ToImmutableDictionary(
                kvp => kvp.Key,
                kvp => StripPositionInfo.Apply(kvp.Value));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Given the body of an operation, auto-generates the (content of the) controlled specialization
 /// using the default name for control qubits.
 /// Throws an ArgumentNullException if the given scope is null.
 /// </summary>
 public static QsScope GenerateControlled(this QsScope scope)
 {
     scope = ApplyFunctorToOperationCalls.ApplyControlled(scope);
     return(StripPositionInfo.Apply(scope));
 }