Skip to content
Utility module for computing CFML function names from source paths and line numbers.
ColdFusion
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests
.gitattributes
.gitignore
LICENSE
ModuleConfig.cfc
README.md
box.json
functionLineNums.cfc
server-2016.json
server-2018.json
server.json

README.md

function-linenums

function-linenums is a utility module for use with CFML exception TagContext arrays. Given a template and a line number it computes CFML function names - as tag context items do not include original CFML function names in them.

Installation

Install this module via CommandBox:

$ install funclinenums

Alternatively the git repository can be cloned into the desired directory.

ColdBox Module

You can leverage the module via the injection DSL: functionLineNums@funclinenums:

property name="functionLineNums" inject="functionLineNums@funclinenums";

Standalone Usage

Alternatively, the functionLineNumbers component can be instantiated directly:

functionLineNums = new funclinenums.functionLineNums();

Available methods

The following methods are available:

// pass in a TagContext item directly
functionName = functionLineNums.findTagContextFunction( tagContextItem );
// pass in a full path to a CFML source file and a line number
functionName = functionLineNums.findFunction( fullPath, lineNum );
// pass in a full path to a CFML source file
functionArray = functionLineNums.getFunctionRanges( fullPath );
/*
returns an array of structs:
[
    {
        "name": "funcName", 
        "start": 1, 
        "end": 104, 
        "startline": 1,
        "endline": 9
    }
]
*/
// pass in source code directly
functionArray = functionLineNums.walk( srcCode );
/*
returns an array of structs:
[
    {
        "name": "funcName", 
        "start": 1, 
        "end": 104, 
        "startline": 1,
        "endline": 9
    }
]
*/
You can’t perform that action at this time.