예제 #1
0
        public override object Visit(TypedefStatement node)
        {
            LanguageType declaredType = null;

            if (node.DeclarationExpression.TypeDeclarationExpression != null)
            {
                declaredType = ( LanguageType )node.DeclarationExpression.TypeDeclarationExpression.AcceptVisitor(this);
            }

            foreach (var declaration in node.DeclarationExpression.Declarations)
            {
                TypeAliases.Peek()[declaration.Name] = Convert(declaration.TypeReference, declaredType);
            }

            if (declaredType != null && declaredType.Name == null)
            {
                foreach (var declarationWithoutModifiers in node.DeclarationExpression.Declarations.Where(x => x.TypeReference == node.DeclarationExpression.TypeReference))
                {
                    declaredType.Name = declarationWithoutModifiers.Name;
                    break;
                }
            }

            return(null);
        }
예제 #2
0
        public void LeafListTypeOverflowError()
        {
            var typedef = new TypedefStatement("testerType");

            typedef.AddStatement(new Decimal64TypeStatement("23,6"));
            Assert.Throws <ArgumentOutOfRangeException>(() => typedef.AddStatement(new BooleanTypeStatement("true")));
            Assert.Throws <ArgumentOutOfRangeException>(() => typedef.AddStatement(new EmptyTypeStatement()));
            Assert.Throws <ArgumentOutOfRangeException>(() => typedef.AddStatement(new IdentityrefTypeStatement("arg")));
        }