Example #1
0
        public bool AddTypedef(DcTypedef dtypedef)
        {
            if (!_typedefsByName.TryAdd(dtypedef.Name, dtypedef))
            {
                return(false);
            }

            dtypedef.Number = NumTypedefs;
            _typedefs.Add(dtypedef);

            if (dtypedef.IsBogus)
            {
                _allObjectsValid = false;
            }

            if (!dtypedef.IsBogus && !dtypedef.IsImplicit)
            {
                _declarations.Add(dtypedef);
            }
            else
            {
                _thingsToDelete.Add(dtypedef);
            }

            return(true);
        }
Example #2
0
        public override void EnterTypedef_declaration(DcParser.Typedef_declarationContext context)
        {
            var parameter = BuildDcParameterFromContext(context.p);
            var typedef   = new DcTypedef(parameter);

            if (!_dcFile.AddTypedef(typedef))
            {
                throw new Exception($"Failed to add typedef: {typedef.Name}");
            }
        }
Example #3
0
 public bool TryGetTypedef(string name, out DcTypedef typedef)
 {
     return(_typedefsByName.TryGetValue(name, out typedef));
 }