Ejemplo n.º 1
0
        public override AstNode Visit(MemberAccess node)
        {
            // Get the node type.
            IChelaType variableType = node.GetNodeType();

            // Ignore type references, namespaces and functions.
            if(variableType.IsMetaType() || variableType.IsNamespace() ||
               variableType.IsFunctionGroup() || variableType.IsFunction())
                return node;

            // The type must be a reference.
            variableType = DeReferenceType(variableType);

            // Now, it can be a constant
            if(variableType.IsConstant())
            {
                // Perform constant expansion.
                FieldVariable field = (FieldVariable)node.GetNodeValue();
                if(!field.IsExternal())
                    return field.GetInitializer().ToAstNode(node.GetPosition());
            }

            return node;
        }