Functions being ignored

Hello, I made this script but for some reason some functions are being ignored or something. This is the script :

    #pragma strict
    
    public var rocketPrefab : Transform;
    public var barrelEnd : Transform;
    var canShoot : boolean = true;
    var shootRate : float;
    var gun : Transform;
    var soundEffect : AudioClip;
    var player : Transform;
    var enemy : Transform;
    var minShoot : float = 2;
    var maxShoot : float = 4;
    var rayLength = 1000;

function Start ()
{
//	e();
}

function Update ()
{
	transform.LookAt(player);
	var hit : RaycastHit;
	var forward = transform.TransformDirection(Vector3.forward);
	if(Physics.Raycast(transform.position, forward, hit, rayLength))
	{
		if(hit.collider.gameObject.tag != "Player")
		{
			canShoot = false;
		}
		
		if(hit.collider.gameObject.tag == "Player")
		{
			canShoot = true;
		}
	}
	if (canShoot == true)
	{
		Shoot();
	}
}

function e()
{
	canShoot=false;
	yield WaitForSeconds(Random.Range(1, 2));
	canShoot=true;
}

function w()
{
	canShoot=false;
	yield WaitForSeconds(Random.Range(minShoot,maxShoot));
	canShoot=true;
}

function Shoot()
{
	    var rocketInstance : Transform;
        rocketInstance = Instantiate(rocketPrefab, barrelEnd.position, barrelEnd.rotation);
        audio.PlayOneShot(soundEffect);
        w();
}

The problem here is that the ai ignores(I think) the function “w”. Some help would be really appreciated. Thank you for your time.

[Sorry for my english]
To make sure that the unity ignoring the function … Debug.Log(“w”)
After that it is easier to know which way the program is being run

function w()
    {
        canShoot=false;
        yield WaitForSeconds(Random.Range(minShoot,maxShoot));
        canShoot=true;
    Debug.Log("w");
    
    }
     
    function Shoot()
    {
    Debug.Log("Shoot");
            var rocketInstance : Transform;
            rocketInstance = Instantiate(rocketPrefab, barrelEnd.position, barrelEnd.rotation);
            audio.PlayOneShot(soundEffect);
            w();
    }

I was wrong,ignoring wasn’t the case.All the functions are being called correctly,it’s just that my script is wrongly written ,Im still trying to figure out how to fix it.