id | keywords | name | summary | category | |
---|---|---|---|---|---|
pos-of |
| __POS_OF__ | This is the `__POS_OF__` special value. | specialvalues |
__POS_OF__(expression)
returns a tuple consisting of (position, expression)
, corresponding to the position of the expression you pass as a parameter here. The position
is a tuple consisting of (fileName, lineNumber, columnNumberStart, columnNumberEnd)
.
It basically provides the same information as __LOC_OF__
, but separated into multiple values.
Note: expression
refers to any expression, it does not need to be a function.
<CodeTab labels={["ReScript", "JS Output"]}>
letf= () =>Nonelet (pos, f') =__POS_OF__(f) pos->Console.logf'->Console.log
functionf(param){}varpos=["testmodule.res",2,27,28];console.log(pos);console.log(f);varf$p=f;