Exemple #1
0
 public ValuePort(FlowNode node, string name, Type type, IDefaultValue defaultValue)
 {
     this.node         = node;
     this.name         = name;
     this.valueType    = type;
     this.defaultValue = defaultValue;
 }
        public SqlSvr2012SchemaBuilder()
        {
            _c = new SqlSvr2012ColumnType();

            _n = new SqlSvr2012NullabilityType();

            _d = new SqlSvr2012DefaultValue();
        }
 public override void Visit(IDefaultValue defaultValue)
 {
     if (Process(defaultValue))
     {
         visitor.Visit(defaultValue);
     }
     base.Visit(defaultValue);
 }
Exemple #4
0
        protected ValuePort <T> AddValueInput <T>(string name, IDefaultValue defaultValue = null)
        {
            ValuePort <T> port = new ValuePort <T>(this, name, defaultValue);

            if (valueInputs == null)
            {
                valueInputs = new List <ValuePort>();
            }
            valueInputs.Add(port);
            return(port);
        }
Exemple #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Property{T}"/> class.
        /// Constructor for copying.
        /// </summary>
        /// <param name="name">Property name.</param>
        /// <param name="description">Property description.</param>
        /// <param name="alias">Property alias.</param>
        /// <param name="defaultValue">Default value function.</param>
        /// <param name="examples">Examples.</param>
        /// <param name="calculator">Calculate property value function.</param>
        internal Property(
            string name,
            string?description,
            string?alias,
            IDefaultValue <T> defaultValue,
            IReadOnlyList <T> examples,
            IPropertyCalculator <T>?calculator)
        {
            Name = name;

            Description  = description;
            Alias        = alias;
            DefaultValue = defaultValue.AssertArgumentNotNull(nameof(defaultValue));
            Examples     = examples.AssertArgumentNotNull(nameof(examples));
            Calculator   = calculator;
        }
Exemple #6
0
        protected ValuePort AddValueInput(string name, Type type, IDefaultValue defaultValue = null)
        {
            if (cachedAddValueInputGenericMethod == null)
            {
                foreach (var mInfo in typeof(FlowNode).GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance))
                {
                    if (mInfo.Name == "AddValueInput" && mInfo.IsGenericMethod && mInfo.GetParameters().Length == 2)
                    {
                        cachedAddValueInputGenericMethod = mInfo;
                        break;
                    }
                }
            }
            var m = cachedAddValueInputGenericMethod.MakeGenericMethod(type);

            return((ValuePort)m.Invoke(this, new object[] { name, defaultValue }));
        }
Exemple #7
0
 public void Visit(IDefaultValue defaultValue)
 {
     this.result = this.rewriter.Rewrite(defaultValue);
 }
Exemple #8
0
 public virtual void onASTElement(IDefaultValue defaultValue)
 {
 }
 public IFixedLengthComplexPropertyMapping DefaultValue(IDefaultValue defaultValue)
 {
     this.defaultValue = defaultValue;
     return(this);
 }
Exemple #10
0
 public void Visit(IDefaultValue defaultValue)
 {
     this.result = this.copier.Copy(defaultValue);
 }
    private void translateStructDefaultValue(IDefaultValue defaultValue, ITypeReference typ) {
      // then it is a struct and gets special treatment
      // translate it as if it were a call to the nullary ctor for the struct type
      // (which doesn't actually exist, but gets generated for each struct type
      // encountered during translation)

      var tok = defaultValue.Token();

      var loc = this.sink.CreateFreshLocal(typ);
      var locExpr = Bpl.Expr.Ident(loc);

      // First generate an Alloc() call
      this.StmtTraverser.StmtBuilder.Add(new Bpl.CallCmd(tok, this.sink.AllocationMethodName, new List<Bpl.Expr>(), new List<Bpl.IdentifierExpr>(new Bpl.IdentifierExpr[] {locExpr})));

      // Second, generate the call to the appropriate ctor
      var proc = this.sink.FindOrCreateProcedureForDefaultStructCtor(typ);
      var invars = new List<Bpl.Expr>();
      invars.Add(locExpr);
      this.StmtTraverser.StmtBuilder.Add(new Bpl.CallCmd(tok, proc.Name, invars, new List<Bpl.IdentifierExpr>()));

      // Generate an assumption about the dynamic type of the just allocated object
      this.sink.GenerateDynamicTypeAssume(this.StmtTraverser.StmtBuilder, tok, locExpr, typ);

      this.TranslatedExpressions.Push(locExpr);
    }
 public ICharPropertyMapping DefaultValue(IDefaultValue defaultValue)
 {
     column.DefaultValue = defaultValue;
     return(this);
 }
Exemple #13
0
 /// <summary>
 /// Rewrites the given defalut value expression.
 /// </summary>
 /// <param name="defaultValue"></param>
 public virtual IExpression Rewrite(IDefaultValue defaultValue)
 {
     var mutableDefaultValue = defaultValue as DefaultValue;
       if (mutableDefaultValue == null) return defaultValue;
       this.RewriteChildren(mutableDefaultValue);
       return mutableDefaultValue;
 }
Exemple #14
0
 private HLLocation ProcessDefaultValueExpression(IDefaultValue pExpression)
 {
     return HLDefaultLocation.Create(HLDomain.GetOrCreateType(pExpression.DefaultValueType));
 }
Exemple #15
0
 public override void TraverseChildren(IDefaultValue defaultValue)
 {
     base.TraverseChildren(defaultValue);
     ((DefaultValue)defaultValue).Type = defaultValue.DefaultValueType;
 }
Exemple #16
0
 /// <summary>
 /// Sets default value and returns this.
 /// </summary>
 /// <param name="defaultValue">Default value.</param>
 /// <returns>The same instance.</returns>
 public PropertyParser <T> SetDefaultValue(T defaultValue)
 {
     DefaultValue = new DefaultValue <T>(defaultValue);
     return(this);
 }
Exemple #17
0
 /// <summary>
 /// Generates IL for the specified default value.
 /// </summary>
 /// <param name="defaultValue">The default value.</param>
 public override void TraverseChildren(IDefaultValue defaultValue)
 {
     ILocalDefinition temp = new TemporaryVariable(defaultValue.Type, this.method);
       this.LoadAddressOf(temp, null);
       this.generator.Emit(OperationCode.Initobj, defaultValue.Type);
       this.StackSize--;
       this.LoadLocal(temp);
 }
 public override void TraverseChildren(IDefaultValue defaultValue) {
   this.PrintToken(VBToken.Null);
 }
 public RealizedParameter(IBlockContext context, FunctionParameter parameter)
 {
     name         = parameter.name;
     type         = parameter.type.UnderlyingType(context.ModuleContext);
     defaultValue = DefaultValue.ForParameter(context, parameter);
 }
 public RealizedParameter(string name, RealizedType type, IDefaultValue defaultValue = null)
 {
     this.name         = name;
     this.type         = type;
     this.defaultValue = defaultValue;
 }
Exemple #21
0
 private HLLocation ProcessDefaultValueExpression(IDefaultValue pExpression)
 {
     return(HLDefaultLocation.Create(HLDomain.GetOrCreateType(pExpression.DefaultValueType)));
 }
Exemple #22
0
 public override void Visit(IDefaultValue defaultValue)
 {
     allElements.Add(new InvokInfo(Traverser, "IDefaultValue", defaultValue));
 }
Exemple #23
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="defaultValue"></param>
 public DefaultValue(IDefaultValue defaultValue)
     : base(defaultValue)
 {
     this.defaultValueType = defaultValue.DefaultValueType;
 }
Exemple #24
0
 public IDateTimeOffsetPropertyMapping DefaultValue(IDefaultValue defaultValue)
 {
     column.DefaultValue = defaultValue;
     return(this);
 }
 public virtual void onASTElement(IDefaultValue defaultValue) { }
 /// <summary>
 /// Rewrites the given defalut value expression.
 /// </summary>
 /// <param name="defaultValue"></param>
 public virtual IExpression Rewrite(IDefaultValue defaultValue)
 {
     return defaultValue;
 }
Exemple #27
0
 /// <summary>
 /// Returns a shallow copy of the given defalut value expression.
 /// </summary>
 /// <param name="defaultValue"></param>
 public DefaultValue Copy(IDefaultValue defaultValue)
 {
     return new DefaultValue(defaultValue);
 }
 public override void TraverseChildren(IDefaultValue defaultValue) {
   base.TraverseChildren(defaultValue);
   ((DefaultValue)defaultValue).Type = defaultValue.DefaultValueType;
 }
    public override void TraverseChildren(IDefaultValue defaultValue) {
      var typ = defaultValue.Type;

      if (TranslationHelper.IsStruct(typ)) {
        translateStructDefaultValue(defaultValue, typ);
        return;
      }

      Bpl.Expr e;
      var bplType = this.sink.CciTypeToBoogie(typ);
      if (bplType == Bpl.Type.Int) {
        var lit = Bpl.Expr.Literal(0);
        lit.Type = Bpl.Type.Int;
        e = lit;
      } else if (bplType == Bpl.Type.Bool) {
        var lit = Bpl.Expr.False;
        lit.Type = Bpl.Type.Bool;
        e = lit;
      } else if (bplType == this.sink.Heap.RefType) {
        e = Bpl.Expr.Ident(this.sink.Heap.NullRef);
      } else if (bplType == this.sink.Heap.UnionType) {
        e = Bpl.Expr.Ident(this.sink.Heap.DefaultHeapValue);
      } else if (bplType == this.sink.Heap.RealType) {
        e = Bpl.Expr.Ident(this.sink.Heap.DefaultReal);
      } else {
        throw new NotImplementedException(String.Format("Don't know how to translate type: '{0}'", TypeHelper.GetTypeName(typ)));
      }

      TranslatedExpressions.Push(e);
      return;
    }
Exemple #30
0
 //^ ensures this.path.Count == old(this.path.Count);
 /// <summary>
 /// Traverses the given defalut value expression.
 /// </summary>
 /// <param name="defaultValue"></param>
 public virtual void Visit(IDefaultValue defaultValue)
 {
     if (this.stopTraversal) return;
       //^ int oldCount = this.path.Count;
       this.path.Push(defaultValue);
       this.Visit(defaultValue.DefaultValueType);
       //^ assume this.path.Count == oldCount+1; //True because all of the virtual methods of this class promise not to decrease this.path.Count.
       this.path.Pop();
 }
 public ISeparatedValueComplexPropertyMapping DefaultValue(IDefaultValue defaultValue)
 {
     this.defaultValue = defaultValue;
     return(this);
 }
Exemple #32
0
 /// <summary>
 /// Traverses the defalut value expression.
 /// </summary>
 public void Traverse(IDefaultValue defaultValue)
 {
     Contract.Requires(defaultValue != null);
       if (this.preorderVisitor != null) this.preorderVisitor.Visit(defaultValue);
       if (this.StopTraversal) return;
       this.TraverseChildren(defaultValue);
       if (this.StopTraversal) return;
       if (this.postorderVisitor != null) this.postorderVisitor.Visit(defaultValue);
 }
        public override void TraverseChildren(IDefaultValue defaultValue)
{ MethodEnter(defaultValue);
            base.TraverseChildren(defaultValue);
     MethodExit();   }
Exemple #34
0
 public void Visit(IDefaultValue defaultValue)
 {
     this.traverser.Traverse(defaultValue);
 }
Exemple #35
0
 public IEnumPropertyMapping <TEnum> DefaultValue(IDefaultValue defaultValue)
 {
     column.DefaultValue = defaultValue;
     return(this);
 }
Exemple #36
0
 public void Visit(IDefaultValue defaultValue)
 {
     Contract.Requires(defaultValue != null);
       throw new NotImplementedException();
 }
Exemple #37
0
    /// <summary>
    /// Returns a deep copy of the given defalut value expression.
    /// </summary>
    /// <param name="defaultValue"></param>
    public DefaultValue Copy(IDefaultValue defaultValue) {
      Contract.Requires(defaultValue != null);
      Contract.Ensures(Contract.Result<DefaultValue>() != null);

      var mutableCopy = this.shallowCopier.Copy(defaultValue);
      this.CopyChildren((Expression)mutableCopy);
      mutableCopy.DefaultValueType = this.Copy(mutableCopy.DefaultValueType);
      return mutableCopy;
    }
 public override void Visit(IDefaultValue defaultValue)
 {
     if(Process(defaultValue)){visitor.Visit(defaultValue);}
     base.Visit(defaultValue);
 }
Exemple #39
0
 /// <summary>
 /// Performs some computation with the given defalut value expression.
 /// </summary>
 /// <param name="defaultValue"></param>
 public virtual void Visit(IDefaultValue defaultValue)
 {
 }
Exemple #40
0
    /// <summary>
    /// Returns a shallow copy of the given defalut value expression.
    /// </summary>
    /// <param name="defaultValue"></param>
    public DefaultValue Copy(IDefaultValue defaultValue) {
      Contract.Requires(defaultValue != null);
      Contract.Ensures(Contract.Result<DefaultValue>() != null);

      return new DefaultValue(defaultValue);
    }
Exemple #41
0
 /// <summary>
 /// Traverses the children of the defalut value expression.
 /// </summary>
 public virtual void TraverseChildren(IDefaultValue defaultValue)
 {
     Contract.Requires(defaultValue != null);
       this.TraverseChildren((IExpression)defaultValue);
       if (this.StopTraversal) return;
       this.Traverse(defaultValue.DefaultValueType);
 }
Exemple #42
0
 public void SetDefaultValue <T>(IDefaultValue <T> defaultValue)
 {
 }
Exemple #43
0
 /// <summary>
 /// Performs some computation with the given defalut value expression.
 /// </summary>
 /// <param name="defaultValue"></param>
 public virtual void Visit(IDefaultValue defaultValue)
 {
     this.Visit((IExpression)defaultValue);
 }
 /// <summary>
 /// Performs some computation with the given defalut value expression.
 /// </summary>
 /// <param name="defaultValue"></param>
 public virtual void Visit(IDefaultValue defaultValue)
 {
 }
Exemple #45
0
 public void Visit(IDefaultValue defaultValue)
 {
     throw new NotImplementedException();
 }
Exemple #46
0
 public IByteArrayPropertyMapping DefaultValue(IDefaultValue defaultValue)
 {
     column.DefaultValue = defaultValue;
     return(this);
 }
Exemple #47
0
 public ISBytePropertyMapping DefaultValue(IDefaultValue defaultValue)
 {
     column.DefaultValue = defaultValue;
     return this;
 }
Exemple #48
0
 /// <summary>
 /// Visits the specified default value.
 /// </summary>
 /// <param name="defaultValue">The default value.</param>
 public override void Visit(IDefaultValue defaultValue)
 {
     DefaultValue mutableDefaultValue = new DefaultValue(defaultValue);
     this.resultExpression = this.myCodeCopier.DeepCopy(mutableDefaultValue);
 }
 public override void TraverseChildren(IDefaultValue defaultValue) {
   this.sourceEmitterOutput.Write("default(");
   this.PrintTypeReference(defaultValue.DefaultValueType);
   this.sourceEmitterOutput.Write(")");
 }
Exemple #50
0
 /// <summary>
 /// Returns a deep copy of the given defalut value expression.
 /// </summary>
 /// <param name="defaultValue"></param>
 public DefaultValue Copy(IDefaultValue defaultValue)
 {
     var mutableCopy = this.shallowCopier.Copy(defaultValue);
       this.CopyChildren((Expression)mutableCopy);
       mutableCopy.DefaultValueType = this.Copy(mutableCopy.DefaultValueType);
       return mutableCopy;
 }
Exemple #51
0
 public override void TraverseChildren(IDefaultValue defaultValue)
 {
     MethodEnter(defaultValue);
     base.TraverseChildren(defaultValue);
     MethodExit();
 }
Exemple #52
0
 /// <summary>
 /// Visits the specified default value.
 /// </summary>
 /// <param name="defaultValue">The default value.</param>
 public override void Visit(IDefaultValue defaultValue)
 {
     DefaultValue mutableDefaultValue = defaultValue as DefaultValue;
     if (alwaysMakeACopy || mutableDefaultValue == null) mutableDefaultValue = new DefaultValue(defaultValue);
     this.resultExpression = this.myCodeMutator.Visit(mutableDefaultValue);
 }