Exemple #1
0
        /** Multiple superclass or interface implementations and the like... */
        public IEnumerable <ClassSymbol> GetBaseClassScopes()
        {
            ClassSymbol baseClassScope = GetBaseClassScope();

            if (baseClassScope != null)
            {
                List <ClassSymbol> list = new List <ClassSymbol>();
                list.Add(baseClassScope);
                return(list);
            }
            return(null);
        }
Exemple #2
0
        /** get the total number of methods visible to this class */
        public int GetNumberOfMethods()
        {
            int         n = 0;
            ClassSymbol superClassScope = GetBaseClassScope();

            if (superClassScope != null)
            {
                n += superClassScope.GetNumberOfMethods();
            }
            n += GetNumberOfDefinedMethods();
            return(n);
        }
Exemple #3
0
        public override int GetNumberOfFields()
        {
            int         n = 0;
            ClassSymbol superClassScope = GetBaseClassScope();

            if (superClassScope != null)
            {
                n += superClassScope.GetNumberOfFields();
            }
            n += GetNumberOfDefinedFields();
            return(n);
        }
Exemple #4
0
        public override List <FieldSymbol> GetFields()
        {
            List <FieldSymbol> fields          = new List <FieldSymbol>();
            ClassSymbol        superClassScope = GetBaseClassScope();

            if (superClassScope != null)
            {
                fields.AddRange(superClassScope.GetFields());
            }
            fields.AddRange(GetDefinedFields());
            return(fields);
        }
        /// <summary>
        /// Define class scope and symbol
        /// </summary>
        /// <param name="context"></param>
        public override void EnterClass_definition([NotNull] Class_definitionContext context)
        {
            var         classIdentityContext = context.identifier();
            ClassSymbol classSymbol          = new ClassSymbol(classIdentityContext.GetText());

            classSymbol.SetEnclosingScope(currentScope);
            classSymbol.DefNode = context;

            classIdentityContext.Symbol = classSymbol;
            classIdentityContext.Scope  = classSymbol;

            Define(classSymbol);
            linker[currentFileAnalysis].Add(classSymbol);
            currentScope = classSymbol;
        }