From a5440d59059e1856de342dc5eb58c79a06254939 Mon Sep 17 00:00:00 2001 From: Annibale Panichella Date: Fri, 26 Mar 2021 21:07:46 +0100 Subject: [PATCH] Fixing a bug for function definition The function defintion should start one posiiton after the end of the modifier. Given a function "function method() onlyOwner {...}', the current version of the return the definition "r{...}" instead of "{...}". I notice the same error happens when a function uses a modifier: the last character of the modifier is added to the parsed definiton. This commit fixes the bug. --- lib/registrar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/registrar.js b/lib/registrar.js index cce5fbef..38e25783 100644 --- a/lib/registrar.js +++ b/lib/registrar.js @@ -115,8 +115,8 @@ class Registrar { // which contains an open curly brace. Skip ahead... if (expression.modifiers && expression.modifiers.length){ for (let modifier of expression.modifiers ){ - if (modifier.range[1] > start){ - start = modifier.range[1]; + if (modifier.range[1]+1 > start){ + start = modifier.range[1]+1; } } } else {