/// <inheritdoc /> public override void Visit(Alias alias) { var aliasDef = ((DOM.Mapped.Alias)alias).AliasDefinition; if (aliasDef.IsValueNode) { CheckBlockStartForValueAlias(); OnValue(ResolveValueAlias((DOM.Mapped.Alias)alias, out var valueType), valueType); } AliasContext.Push(new AliasContextInfo((DOM.Mapped.Alias)alias, CurrentModuleMember)); if (!EnterChoiceContainer((DOM.Mapped.Alias)alias, aliasDef.Entities, aliasDef)) { if (BlockState.Count > 0 && BlockState.Peek() == BlockStateEnum.Array && aliasDef.BlockType == BlockType.JsonObject) { if (BlockIsStarting) { JsonWriter.WriteStartArray(); } BlockState.Push(BlockStateEnum.Object); JsonWriter.WriteStartObject(); Visit(aliasDef.Entities.Where(e => !(e is Attribute))); JsonWriter.WriteEndObject(); BlockState.Pop(); } else { Visit(aliasDef.Entities.Where(e => !(e is Attribute))); } } AliasContext.Pop(); }
public override void OnAlias(DOM.Alias alias) { var aliasDef = ((Alias)alias).AliasDefinition; //Do not resolve alias without AliasDef or having circular reference if (aliasDef == null || aliasDef.HasCircularReference) { return; } AliasContext.Push(new AliasContext { AliasDefinition = aliasDef, Alias = (Alias)alias, AliasNsInfo = GetContextNsInfo() }); Visit(aliasDef.Entities.Where(e => !(e is DOM.Attribute))); AliasContext.Pop(); }
protected void ResolveAttributesInAlias(Alias alias) { var aliasDef = alias.AliasDefinition; //Do not resolve alias without AliasDef or having circular reference if (aliasDef == null || aliasDef.HasCircularReference) { return; } AliasContext.Push(new AliasContext() { AliasDefinition = aliasDef, Alias = alias, AliasNsInfo = GetContextNsInfo() }); ResolveAttributes(aliasDef.Entities); AliasContext.Pop(); }
/// <inheritdoc /> public override void Visit(Alias alias) { var aliasDef = ((DOM.Mapped.Alias)alias).AliasDefinition; AliasContext.Push(new AliasContextInfo((DOM.Mapped.Alias)alias, CurrentModuleMember)); CurrentModuleMember = aliasDef; if (aliasDef.IsValueNode) { OnValue(ResolveValueAlias((DOM.Mapped.Alias)alias, out var valueType), valueType); } if (!EnterChoiceContainer((DOM.Mapped.Alias)alias, aliasDef.Entities, aliasDef)) { Visit(aliasDef.Entities.Where(e => !(e is DOM.Attribute))); } CurrentModuleMember = AliasContext.Pop().ModuleMember; }
public override void OnAlias(Alias alias) { var aliasDef = ((DOM.Mapped.Alias)alias).AliasDefinition; if (aliasDef.IsValueNode) { CheckBlockStartForAlias(); ValueType valueType; OnValue(ResolveValueAlias((DOM.Mapped.Alias)alias, out valueType), valueType); } AliasContext.Push(new AliasContext() { AliasDefinition = aliasDef, Alias = (DOM.Mapped.Alias)alias, AliasNsInfo = GetContextNsInfo() }); if (!EnterChoiceContainer((DOM.Mapped.Alias)alias, aliasDef.Entities)) { Visit(aliasDef.Entities.Where(e => !(e is DOM.Attribute))); } AliasContext.Pop(); }
public override void OnAlias(Alias alias) { var aliasDef = ((DOM.Mapped.Alias)alias).AliasDefinition; var prevCurrentModuleMember = _currentModuleMember; _currentModuleMember = aliasDef; if (aliasDef.IsValueNode) { ValueType valueType; OnValue(ResolveValueAlias((DOM.Mapped.Alias)alias, out valueType), valueType); } AliasContext.Push(new AliasContext() { AliasDefinition = aliasDef, Alias = (DOM.Mapped.Alias)alias, AliasNsInfo = GetContextNsInfo() }); if (!EnterChoiceContainer((DOM.Mapped.Alias)alias, aliasDef.Entities, aliasDef)) { Visit(aliasDef.Entities.Where(e => !(e is DOM.Attribute))); } AliasContext.Pop(); _currentModuleMember = prevCurrentModuleMember; }
protected string ResolveValueAlias(Alias alias, out ValueType valueType) { var aliasDef = NamespaceResolver.GetAliasDefinition(alias.Name); AliasContext.Push(new AliasContext { AliasDefinition = aliasDef, Alias = alias, AliasNsInfo = GetContextNsInfo() }); string result; if (aliasDef.ValueType == ValueType.LiteralChoice) { result = ResolveChoiceValue(alias, out valueType); } else { result = aliasDef.PairValue == null?ResolveNodeValue(aliasDef, out valueType) : ResolvePairValue(aliasDef.PairValue, out valueType); } AliasContext.Pop(); return(result); }