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

            foreach (var member in structAST.Variables)
            {
                var variableDec = member as VariableDecAST;

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

            AddType(typeInfo);

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

            GlobalTypes.Add(structAST.Name);
        }
Example #2
0
        public override void Visit(StructAST structAST)
        {
            foreach (var variable in structAST.Variables)
            {
                var decAssign = variable as VariableDecAssignAST;

                if (decAssign == null)
                {
                    continue;
                }

                var exprType = _exprTypeVisitor.GetAstNodeType(_currentFileName, _currentScopeId,
                                                               _currentNodePosition, decAssign.ExpressionValue);

                if (!IsSameTypeOrNullPtr(decAssign.Type, exprType))
                {
                    throw new Exception(string.Format("Type mismatch : struct variable '{0}' have type '{1}' but assigned '{2}' type",
                                                      decAssign.Name, decAssign.Type, exprType));
                }
            }
        }
Example #3
0
 public override void Visit(StructAST structAST)
 {
 }
Example #4
0
 public static LLVMTypeRef GetStructType(StructAST structAST, bool packed = false)
 {
     return(new LLVMTypeRef());
 }
Example #5
0
 public virtual void Visit(StructAST structAST)
 {
 }