public static StepBoundItem AutoItem(StepSyntax creatingSyntax) { var boundItem = new StepBoundItem(null, creatingSyntax); boundItem.IsAuto = true; return(boundItem); }
public void BindValue(StepSyntax syntax, Action <StepBoundItem> bindAction) { if (syntax is StepSimpleItemSyntax) { var typedParameter = (StepSimpleItemSyntax)syntax; var item = StepRepresentationItem.FromTypedParameterToItem(this, typedParameter, typedParameter.Id); var boundItem = new StepBoundItem(item, syntax); bindAction(boundItem); } else if (syntax is StepEntityInstanceReferenceSyntax) { var itemInstance = (StepEntityInstanceReferenceSyntax)syntax; if (_itemMap.ContainsKey(itemInstance.Id)) { // pointer already defined, bind immediately foreach (var item in _itemMap[itemInstance.Id]) { var boundItem = new StepBoundItem(item, syntax); bindAction(boundItem); } } else { // not already defined, save it for later if (!_unboundPointers.ContainsKey(itemInstance.Id)) { _unboundPointers.Add(itemInstance.Id, new List <Tuple <StepSyntax, Action <StepBoundItem> > >()); } _unboundPointers[itemInstance.Id].Add(Tuple.Create(syntax, bindAction)); } } else if (syntax is StepAutoSyntax) { bindAction(StepBoundItem.AutoItem(syntax)); } else { throw new StepReadException("Unable to bind pointer, this should be unreachable", syntax.Line, syntax.Column); } }
public StepBoundItem(StepRepresentationItem item, StepSyntax creatingSyntax) { CreatingSyntax = creatingSyntax; Item = item; }