Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows subroutine calls in return statments #384

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Nov 15, 2024

  1. Allows subroutine calls in return statments

    Not sure why this check was added, but Fastly, as of writing, _does_
    allow subroutine calls in returns. For example, see these subroutines
    defined in `init`:
    
    	sub return_test_str STRING {
    		return std.toupper("test");
    	}
    
    	sub return_test_bool BOOL {
    		return randombool(1, 2);
    	}
    
    These can be called from `vcl_recv` successfully like so:
    
    	declare local var.strret STRING;
    	declare local var.boolret BOOL;
    
    	set var.strret = return_test_str();
    	set var.boolret = return_test_bool();
    
    	log "testing returns: " var.strret ", " var.boolret;
    
    Here's an example Fiddle: https://fiddle.fastly.dev/fiddle/b872e5de
    gabrielg committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    5823e68 View commit details
    Browse the repository at this point in the history