• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zorbathut / dec / 11670896818

04 Nov 2024 07:02PM UTC coverage: 90.556%. Remained the same
11670896818

push

github

zorbathut
Removed redundant namespaces

4564 of 5040 relevant lines covered (90.56%)

191694.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.67
/src/Reader.cs
1
using System;
2
using System.Collections;
3
using System.Collections.Generic;
4

5
namespace Dec
6
{
7
    internal abstract class ReaderFileDec
8
    {
9
        public struct ReaderDec
10
        {
11
            public Type type;
12
            public string name;
13

14
            public ReaderNodeParseable node;
15
            public InputContext inputContext;
16

17
            public bool? abstrct;
18
            public string parent;
19
        }
20

21
        // this is a little awkward because it mutates state and should not be called twice. we should fix that
22
        public abstract List<ReaderDec> ParseDecs();
23
    }
24

25
    internal abstract class ReaderFileRecorder
26
    {
27
        public struct ReaderRef
28
        {
29
            public Type type;
30
            public string id;
31

32
            public ReaderNodeParseable node;
33
        }
34

35
        // this is a little awkward because it mutates state and should not be called twice. we should fix that
36
        public abstract List<ReaderRef> ParseRefs();
37
        public abstract ReaderNodeParseable ParseNode();
38
    }
39

40
    internal abstract class ReaderNode
41
    {
42
        public virtual bool AllowAsThis { get => true; }
195✔
43
        public abstract Recorder.IUserSettings UserSettings { get; }
44

45
        public abstract InputContext GetInputContext(); // note: this function must be really fast!
46

47
        public abstract ReaderNode GetChildNamed(string name);
48
        public abstract string[] GetAllChildren();
49

50
        public abstract int[] GetArrayDimensions(int rank);
51

52
        public abstract object ParseElement(Type type, object model, ReaderContext readerContext, Recorder.Context recorderContext);
53
    }
54

55
    internal abstract class ReaderNodeParseable : ReaderNode
56
    {
57
        public enum Metadata
58
        {
59
            Null,
60
            Ref,
61
            Class,
62
            Mode,
63
        }
64

65
        public override object ParseElement(Type type, object model, ReaderContext readerContext, Recorder.Context recorderContext)
66
        {
772,180✔
67
            return Serialization.ParseElement(new List<ReaderNodeParseable>() { this }, type, model, readerContext, recorderContext);
772,180✔
68
        }
772,180✔
69

70
        public abstract string GetMetadata(Metadata metadata);
71
        public abstract string GetMetadataUnrecognized();
72
        public abstract string GetText();
73

74
        public abstract bool HasChildren();
75

76
        public abstract void ParseList(IList list, Type referencedType, ReaderContext readerContext, Recorder.Context recorderContext);
77
        public abstract void ParseArray(Array array, Type referencedType, ReaderContext readerContext, Recorder.Context recorderContext, int startOffset);
78
        public abstract void ParseDictionary(IDictionary dict, Type referencedKeyType, Type referencedValueType, ReaderContext readerContext, Recorder.Context recorderContext, bool permitPatch);
79
        public abstract void ParseHashset(object hashset, Type referencedType, ReaderContext readerContext, Recorder.Context recorderContext, bool permitPatch);
80
        public abstract void ParseStack(object hashset, Type referencedType, ReaderContext readerContext, Recorder.Context recorderContext);
81
        public abstract void ParseQueue(object hashset, Type referencedType, ReaderContext readerContext, Recorder.Context recorderContext);
82
        public abstract void ParseTuple(object[] parameters, Type referencedType, IList<string> parameterNames, ReaderContext readerContext, Recorder.Context recorderContext);
83
        public abstract void ParseReflection(object obj, ReaderContext readerContext, Recorder.Context recorderContext);
84
    }
85

86
    internal static class ReaderNodeExtension
87
    {
88
        public static string ToLowerString(this ReaderNodeParseable.Metadata metadata)
89
        {
20,249,067✔
90
            // Hardcode lowercase versions of all the enum names for performance.
91
            switch (metadata)
20,249,067✔
92
            {
93
                case ReaderNodeParseable.Metadata.Null: return "null";
4,672,762✔
94
                case ReaderNodeParseable.Metadata.Ref: return "ref";
4,672,957✔
95
                case ReaderNodeParseable.Metadata.Class: return "class";
4,672,762✔
96
                case ReaderNodeParseable.Metadata.Mode: return "mode";
6,230,586✔
97
                default: Dbg.Err($"Unknown attribute type {metadata}"); return "UNKNOWN";
×
98
            }
99
        }
20,249,067✔
100
    }
101
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc