• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env ruby
2# Copyright (c) 2025 Huawei Device Co., Ltd.
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15require 'ostruct'
16require 'set'
17require 'delegate'
18
19module Diagnostic
20  module_function
21
22  @diagnostics = []
23
24  def diagnostics
25    @diagnostics
26  end
27
28  def wrap_data(data)
29    data.each_pair do |diagnostic_type, diagnostics|
30      diagnostics.each.with_index(1) do |diagnostic, index|
31        diagnostic.type = diagnostic_type
32        @diagnostics.append(diagnostic)
33      end
34    end
35  end
36end
37
38def Gen.on_require(data)
39  Diagnostic.wrap_data(data)
40end
41
42