示例#1
0
        private ParameterVar ReplaceParameterVar(
            ParameterVar oldVar,
            Func <TypeUsage, TypeUsage> generateReplacementType)
        {
            ParameterVar parameterVar = new ParameterVar(this.NewVarId(), generateReplacementType(oldVar.Type), oldVar.ParameterName);

            this.m_parameterMap[oldVar.ParameterName] = parameterVar;
            this.m_vars.Add((Var)parameterVar);
            return(parameterVar);
        }
示例#2
0
        internal virtual ParameterVar CreateParameterVar(
            string parameterName,
            TypeUsage parameterType)
        {
            if (this.m_parameterMap.ContainsKey(parameterName))
            {
                throw new ArgumentException(Strings.DuplicateParameterName((object)parameterName));
            }
            ParameterVar parameterVar = new ParameterVar(this.NewVarId(), parameterType, parameterName);

            this.m_vars.Add((Var)parameterVar);
            this.m_parameterMap[parameterName] = parameterVar;
            return(parameterVar);
        }
示例#3
0
 internal virtual ParameterVar ReplaceStrongSpatialParameterVar(ParameterVar oldVar)
 {
     return(this.ReplaceParameterVar(oldVar, (Func <TypeUsage, TypeUsage>)(t => TypeHelpers.CreateSpatialUnionTypeUsage(t))));
 }
示例#4
0
 internal virtual ParameterVar ReplaceEnumParameterVar(ParameterVar oldVar)
 {
     return(this.ReplaceParameterVar(oldVar, (Func <TypeUsage, TypeUsage>)(t => TypeHelpers.CreateEnumUnderlyingTypeUsage(t))));
 }
示例#5
0
 // <summary>
 // Creates a variable for the given spatial parameter variable and replaces it in parameter map.
 // </summary>
 // <param name="oldVar"> Spatial parameter variable that needs to replaced. </param>
 // <returns>
 // A new ParameterVar instance created of <paramref name="oldVar" /> .
 // </returns>
 // <remarks>
 // This method should be used only to replace external strong spatial parameter with a counterpart whose
 // type is the appropriate union type for <paramref name="oldVar" />.
 // The operation invalidates the <paramref name="oldVar" />. After the operation has completed
 // the <paramref name="oldVar" />) is invalidated internally and should no longer be used.
 // </remarks>
 internal virtual ParameterVar ReplaceStrongSpatialParameterVar(ParameterVar oldVar)
 {
     return ReplaceParameterVar(oldVar, t => TypeHelpers.CreateSpatialUnionTypeUsage(t));
 }
示例#6
0
 // <summary>
 // Creates a variable for the given enum parameter variable and replaces it in parameter map.
 // </summary>
 // <param name="oldVar"> Enum parameter variable that needs to replaced. </param>
 // <returns>
 // A new ParameterVar instance created of <paramref name="oldVar" /> .
 // </returns>
 // <remarks>
 // This method should be used only to replace external enum parameter with a counterpart whose
 // type is the underlying type of the enum type of the <paramref name="oldVar" />.
 // The operation invalidates the <paramref name="oldVar" />. After the operation has completed
 // the <paramref name="oldVar" />) is invalidated internally and should no longer be used.
 // </remarks>
 internal virtual ParameterVar ReplaceEnumParameterVar(ParameterVar oldVar)
 {
     return ReplaceParameterVar(oldVar, t => TypeHelpers.CreateEnumUnderlyingTypeUsage(t));
 }
示例#7
0
 // <summary>
 // Creates a variable for the given parameter variable and replaces it in parameter map.
 // </summary>
 // <param name="oldVar"> Parameter variable that needs to replaced. </param>
 // <param name="generateReplacementType"> Delegate that generates the replacement parameter's type. </param>
 // <returns>
 // A new ParameterVar instance created of <paramref name="oldVar" /> .
 // </returns>
 // <remarks>
 // This method should be used only to replace external enum or strong spatial parameters with a counterpart whose
 // type is the underlying type of the enum type, or the union type contating the strong spatial type of the
 // <paramref
 //     name="oldVar" />
 // .
 // The operation invalidates the <paramref name="oldVar" />. After the operation has completed
 // the <paramref name="oldVar" />) is invalidated internally and should no longer be used.
 // </remarks>
 private ParameterVar ReplaceParameterVar(ParameterVar oldVar, Func<TypeUsage, TypeUsage> generateReplacementType)
 {
     DebugCheck.NotNull(oldVar);
     Debug.Assert(m_vars.Contains(oldVar));
     var v = new ParameterVar(NewVarId(), generateReplacementType(oldVar.Type), oldVar.ParameterName);
     m_parameterMap[oldVar.ParameterName] = v;
     m_vars.Add(v);
     return v;
 }
示例#8
0
 // <summary>
 // Creates a variable for a parameter in the query
 // </summary>
 // <param name="parameterName"> The name of the parameter for which to create the var </param>
 // <param name="parameterType"> The type of the parameter, and therefore the new var </param>
 // <returns> A new ParameterVar instance with the specified name and type </returns>
 internal virtual ParameterVar CreateParameterVar(
     string parameterName,
     TypeUsage parameterType)
 {
     if (m_parameterMap.ContainsKey(parameterName))
     {
         throw new ArgumentException(Strings.DuplicateParameterName(parameterName));
     }
     var v = new ParameterVar(NewVarId(), parameterType, parameterName);
     m_vars.Add(v);
     m_parameterMap[parameterName] = v;
     return v;
 }