function valueOfJsonEvents()

in compiler/src/steps/validate-model.ts [925:958]


  function valueOfJsonEvents (events: Set<JsonEvent>, valueOf: model.ValueOf): void {
    context.push(valueOf.kind)
    switch (valueOf.kind) {
      case 'instance_of':
        typeRefJsonEvents(events, valueOf.type)
        break

      case 'user_defined_value':
        validateEvent(events, JsonEvent.object) // but can be anything
        break

      case 'array_of':
        validateEvent(events, JsonEvent.array)
        validateValueOfJsonEvents(valueOf.value)
        break

      case 'dictionary_of':
        validateEvent(events, JsonEvent.object)
        context.push('key')
        validateValueOfJsonEvents(valueOf.key)
        context.pop()
        context.push('value')
        validateValueOfJsonEvents(valueOf.value)
        context.pop()
        break

      case 'union_of':
        for (const item of valueOf.items) {
          valueOfJsonEvents(events, item)
        }
        break
    }
    context.pop()
  }