Skip to content

Commit b6fce00

Browse files
committed
line_start and line_end
expose op_array.line_start and line_end, per https://github.com/php/php-src/blob/master/Zend/zend_compile.h#L548
1 parent 7282cc7 commit b6fce00

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

phper/src/functions.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,9 @@ impl ZFunc {
670670
}
671671
}
672672

673-
/// Gets the line number of the declaration of the currently
673+
/// Gets the start line number of the declaration of the currently
674674
/// executing function.
675-
pub fn get_lineno(&self) -> Option<u32> {
675+
pub fn get_line_start(&self) -> Option<u32> {
676676
unsafe {
677677
match u32::from(self.inner.type_) {
678678
ZEND_USER_FUNCTION | ZEND_EVAL_CODE => Some(self.inner.op_array.line_start),
@@ -681,6 +681,17 @@ impl ZFunc {
681681
}
682682
}
683683

684+
/// Gets the end line number of the declaration of the currently
685+
/// executing function.
686+
pub fn get_line_end(&self) -> Option<u32> {
687+
unsafe {
688+
match u32::from(self.inner.type_) {
689+
ZEND_USER_FUNCTION | ZEND_EVAL_CODE => Some(self.inner.op_array.line_end),
690+
_ => None,
691+
}
692+
}
693+
}
694+
684695
/// Get the function or method fully-qualified name.
685696
pub fn get_function_or_method_name(&self) -> ZString {
686697
unsafe {

0 commit comments

Comments
 (0)