Inheritance: NVIdNode
示例#1
0
        public NVTypeNode DoSemanticChecks(ErrorHandler errs, Scope currentScope, NVTypeNode currentType)
        {
            currentType = ResolveNamedTypeNodes(errs, currentScope, currentType);

            // Check to see if the current node is an empty placeholder selector
            if (_id.Name == "")
            {
                return currentType;
            }

            if (currentType == null)
            {
                //TODO: Uncomment this when support for objects passed through the property bag is much better
                //AddSemanticError(errs, "Type of identifier unknown", _pos, ErrorSeverity.Warning);
                return null;
            }

            if (!(currentType is NVClassNode))
            {
                AddSemanticError(errs, string.Format(
                    "Cannot apply identifier selector to type '{0}', the type must be a class type",
                    currentType.Name), _pos, ErrorSeverity.Warning);
                return currentType;
            }

            // Check if the member exists
            _id = ((NVClassNode)currentType).FindMember(errs, _pos, _id.Name);
            if (_id == null)
            {
                return currentType;
            }

            _id.Type = ResolveNamedTypeNodes(errs, currentScope, _id.Type);
            _type = _id.Type;
            return _type;
        }
示例#2
0
        public NVTypeNode DoSemanticChecks(ErrorHandler errs, Scope currentScope, NVTypeNode currentType)
        {
            currentType = ResolveNamedTypeNodes(errs, currentScope, currentType);

            // Check to see if the current node is an empty placeholder selector
            if (_id.Name == "")
            {
                return(currentType);
            }

            if (currentType == null)
            {
                //TODO: Uncomment this when support for objects passed through the property bag is much better
                //AddSemanticError(errs, "Type of identifier unknown", _pos, ErrorSeverity.Warning);
                return(null);
            }

            if (!(currentType is NVClassNode))
            {
                AddSemanticError(errs, string.Format(
                                     "Cannot apply identifier selector to type '{0}', the type must be a class type",
                                     currentType.Name), _pos, ErrorSeverity.Warning);
                return(currentType);
            }

            // Check if the member exists
            _id = ((NVClassNode)currentType).FindMember(errs, _pos, _id.Name);
            if (_id == null)
            {
                return(currentType);
            }

            _id.Type = ResolveNamedTypeNodes(errs, currentScope, _id.Type);
            _type    = _id.Type;
            return(_type);
        }
示例#3
0
        public NVTypeNode ResolveNamedTypeNodes(ErrorHandler errs, Scope currentScope, NVTypeNode type)
        {
            if (type is NVNamedTypeNode)
            {
                NVIdNode newType = currentScope.Find(type.Name);
                if (newType != null)
                {
                    return (NVTypeNode)newType;
                }
                AddSemanticError(errs, string.Format("The type name '{0}' could not be found", type.Name), _pos,
                    ErrorSeverity.Warning);
            }

            return type;
        }
示例#4
0
        public NVTypeNode ResolveNamedTypeNodes(ErrorHandler errs, Scope currentScope, NVTypeNode type)
        {
            if (type is NVNamedTypeNode)
            {
                NVIdNode newType = currentScope.Find(type.Name);
                if (newType != null)
                {
                    return((NVTypeNode)newType);
                }
                AddSemanticError(errs, string.Format("The type name '{0}' could not be found", type.Name), _pos,
                                 ErrorSeverity.Warning);
            }

            return(type);
        }
示例#5
0
 public NVMethodNode(/*Attribute att,*/ string name, NVTypeNode returnType /*, List<ParNode> parameters*/)
     : base(name)
 {
     _type = returnType;
 }
示例#6
0
 public NVMethodNode(/*Attribute att,*/ string name, NVTypeNode returnType/*, List<ParNode> parameters*/)
     : base(name)
 {
     _type = returnType;
 }