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); }
/// <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 ); } }
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()
public abstract dynamic Visit(SizeNode node);
public override dynamic Visit(SizeNode node) { node.LValue.Accept(this); return(null); }
public override dynamic Visit(SizeNode node) { return(null); }