Пример #1
0
        public override dynamic Visit(SizeNode node)
        {
            var id           = node.LValue.Id.Accept(this);
            var variableType = node.LValue.Accept(this); // node.Identifier.Accept(this);
            var variable     = (Variable)GetVariable(id);

            if (variable.PrimitiveType != PrimitiveType.Array)
            {
                Context.ErrorService.Add(
                    ErrorType.Unknown,
                    node.LValue.Id.Token,
                    $"syntax error: tried to get size from non-array {id}"
                    );
                return(PrimitiveType.Error);
            }

            //throw new Exception($"syntax error: tried to get size from non-array {id}");
            if (node.LValue is ArrayDereferenceNode)
            {
                Context.ErrorService.Add(
                    ErrorType.Unknown,
                    node.LValue.Id.Token,
                    $"syntax error: tried to get size from a non-array element of array {id}"
                    );
                return(PrimitiveType.Error);
            }
            // throw new Exception($"syntax error: tried to get size from a non-array element of array {id}");

            return(PrimitiveType.Integer);
        }
Пример #2
0
        /// <summary>
        /// Update logic
        /// </summary>
        public override void update()
        {
            CswNbtMetaDataObjectClass SizeOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.SizeClass );

            // moved to RunBeforeEveryExecutionOfUpdater_01OC
            //CswNbtMetaDataObjectClassProp UnitCountOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( SizeOc )
            //{
            //    PropName = CswNbtObjClassSize.PropertyName.UnitCount,
            //    FieldType = CswNbtMetaDataFieldType.NbtFieldType.Number,
            //    IsRequired = true,
            //    SetValOnAdd = true,
            //    NumberMinValue = 1,
            //    NumberPrecision = 0
            //} );

            CswNbtMetaDataNodeType SizeNt = SizeOc.FirstNodeType;
            if( null != SizeNt )
            {
                CswNbtMetaDataNodeTypeProp UnitCountNtp = SizeNt.getNodeTypePropByObjectClassProp( CswNbtObjClassSize.PropertyName.UnitCount );
                UnitCountNtp.DefaultValue.AsNumber.Value = 1;
            }

            foreach( CswNbtObjClassSize SizeNode in SizeOc.getNodes( false, false ) )
            {
                SizeNode.UnitCount.Value = 1;
                SizeNode.postChanges( false );
            }
        }
Пример #3
0
        public override void update()
        {
            CswNbtMetaDataObjectClass SizeOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.SizeClass );
            foreach( CswNbtMetaDataNodeType SizeNT in SizeOC.getNodeTypes() )
            {
                CswNbtMetaDataNodeTypeProp UPCNTP = SizeNT.getNodeTypePropByObjectClassProp( CswNbtObjClassSize.PropertyName.UPC );
                UPCNTP.removeFromAllLayouts();
            }
            CswNbtMetaDataObjectClassProp UPCBarcodeOCP = SizeOC.getObjectClassProp( "UPC Barcode" );
            if( null != UPCBarcodeOCP )
            {
                foreach( CswNbtObjClassSize SizeNode in SizeOC.getNodes( false, false, false ) )
                {
                    if( null != SizeNode.Node.Properties["UPC Barcode"] )
                    {
                        SizeNode.UPC.Text = SizeNode.Node.Properties["UPC Barcode"].AsBarcode.Barcode;
                        SizeNode.postChanges(false);
                    }
                }
                _CswNbtSchemaModTrnsctn.MetaData.DeleteObjectClassProp( UPCBarcodeOCP, true );
            }

        } // update()
Пример #4
0
 public abstract dynamic Visit(SizeNode node);
Пример #5
0
 public override dynamic Visit(SizeNode node)
 {
     node.LValue.Accept(this);
     return(null);
 }
Пример #6
0
 public override dynamic Visit(SizeNode node)
 {
     return(null);
 }