Beispiel #1
0
        public override void Visit(EnumAST enumAST)
        {
            var typeInfo = new CustomTypeInfo
            {
                type           = enumAST,
                kind           = TypeKind.ENUM,
                scopeId        = _currentScope.id,
                position       = _currentNodePosition,
                memberNameType = new Dictionary <string, TypeAST>()
            };

            foreach (var member in enumAST.Values)
            {
                var variableDec = member as VariableDecAST;

                typeInfo.memberNameType.Add(variableDec.Name, variableDec.Type);
            }

            AddType(typeInfo);

            if (_currentScope.id != 0)
            {
                return;
            }

            GlobalTypes.Add(enumAST.Name);
        }
Beispiel #2
0
        public override void Visit(EnumAST enumAST)
        {
            foreach (var enumValue in enumAST.Values)
            {
                var variableDecAssign = enumValue as VariableDecAssignAST;

                if (variableDecAssign == null)
                {
                    continue;
                }

                var enumAssignExprType = _exprTypeVisitor.GetAstNodeType(_currentFileName, _currentScopeId,
                                                                         _currentNodePosition, variableDecAssign.ExpressionValue, true);

                if (!Vocabulary.Ints.Contains(enumAssignExprType.ToString()))
                {
                    throw new Exception("Invalid enum assignment type");
                }
            }
        }
Beispiel #3
0
 public override void Visit(EnumAST enumAST)
 {
 }
Beispiel #4
0
 public virtual void Visit(EnumAST enumAST)
 {
 }