Example #1
0
        internal static MemberInfo get_member(AST left, AST right)
        {
            bool right_is_identifier = false;

            if (left != null && right != null)
            {
                right_is_identifier = right is Identifier;

                Type   target_type = null;
                string prop_name   = string.Empty;
                string obj         = string.Empty;

                if (left is Identifier && right_is_identifier)
                {
                    obj         = ((Identifier)left).name.Value;
                    prop_name   = ((Identifier)right).name.Value;
                    target_type = SemanticAnalyser.map_to_ctr(obj);
                }
                else if (left is ICanLookupPrototype && right_is_identifier)
                {
                    prop_name   = ((Identifier)right).name.Value;
                    target_type = SemanticAnalyser.map_to_prototype(left);
                }
                if (target_type != null && prop_name != string.Empty)
                {
                    return(Find(target_type, prop_name));
                }
            }
            return(null);
        }
Example #2
0
        internal static bool IsDeletable(Identifier left, Identifier right, out bool isCtr)
        {
            Type ctr = SemanticAnalyser.map_to_ctr(left.name.Value);

            isCtr = ctr != null ? true : false;

            if (isCtr)
            {
                return(SemanticAnalyser.get_member(left, right) == null);
            }

            Console.WriteLine("ctr = {0}, left = {1} ({2}); right = {3} ({4})",
                              ctr, left, left.GetType(), right, right.GetType());
            return(false);
        }