|
6 | 6 | import org.fanjr.simplify.el.invoker.*; |
7 | 7 | import org.fanjr.simplify.el.invoker.calculate.*; |
8 | 8 | import org.fanjr.simplify.el.invoker.node.*; |
9 | | -import org.fanjr.simplify.utils.ELMethodInvokeUtils; |
| 9 | +import org.fanjr.simplify.el.reflect.ELFunctionInvokeUtils; |
10 | 10 | import org.fanjr.simplify.utils.ElUtils; |
11 | 11 | import org.fanjr.simplify.utils.Pair; |
12 | 12 |
|
@@ -405,17 +405,16 @@ public static ELInvoker resolve(char[] chars, int start, int end) { |
405 | 405 | start = nextDot + 1; |
406 | 406 | } while (start < end); |
407 | 407 | } else { |
408 | | - |
409 | 408 | // 判断是否包含自定义函数 eg : XX.fun(...) |
410 | 409 | int nextFunctionToken = findNextCharToken(chars, '(', start, end, false); |
411 | 410 | if (nextFunctionToken > 0) { |
412 | 411 | int nextFunctionEnd = findNextCharToken(chars, ')', nextFunctionToken + 1, end, true); |
413 | 412 | // 是方法,需要判断是否为自定义函数 |
414 | | - int[] dots = countCharToken(chars, '.', start, nextFunctionToken); |
| 413 | + int[] dots = findAllCharToken(chars, '.', start, nextFunctionToken); |
415 | 414 | if (dots.length == 1) { |
416 | 415 | // 已判断形式为XX.fun(...)形式,进一步判断是否为注册的function |
417 | 416 | String functionUtilsName = String.valueOf(chars, start, dots[0] - start); |
418 | | - if (ELMethodInvokeUtils.hasUtils(functionUtilsName)){ |
| 417 | + if (ELFunctionInvokeUtils.hasUtils(functionUtilsName)){ |
419 | 418 | String methodName = String.valueOf(chars, dots[0] + 1, nextFunctionToken - dots[0] - 1); |
420 | 419 | parent = FunctionMethodNodeInvoker.newInstance(functionUtilsName, methodName, resolveList(chars, nextFunctionToken, nextFunctionEnd + 1)); |
421 | 420 | // 位移到方法后 |
@@ -663,33 +662,6 @@ private static NodeInvoker doCompileNode(char[] chars, int start, int end) { |
663 | 662 | } |
664 | 663 | } |
665 | 664 |
|
666 | | - private static int findChar(char[] chars, char c, int start, int end) { |
667 | | - for (int i = start; i < end; i++) { |
668 | | - if (c == chars[i]) { |
669 | | - return i; |
670 | | - } |
671 | | - } |
672 | | - return -1; |
673 | | - } |
674 | | - |
675 | | - /** |
676 | | - * 用于寻找 ${ 或者 #{ |
677 | | - * |
678 | | - * @return $ 或者 # 的index |
679 | | - */ |
680 | | - private static int findElStart(char[] chars, int start, int end) { |
681 | | - // 通过下一个花括号位置来判断是否存在 ${ 或者 #{ |
682 | | - int nextCurly = findChar(chars, '{', start, end); |
683 | | - if (nextCurly == -1) { |
684 | | - return -1; |
685 | | - } else { |
686 | | - if (nextCurly > start && nextCurly < end && ('$' == chars[nextCurly - 1] || '#' == chars[nextCurly - 1])) { |
687 | | - return nextCurly - 1; |
688 | | - } else { |
689 | | - return findElStart(chars, nextCurly + 2, end); |
690 | | - } |
691 | | - } |
692 | | - } |
693 | 665 |
|
694 | 666 | private static void pushNotBuild(LinkedList<Supplier<ELInvoker>> builderStack, ELInvoker invoker) { |
695 | 667 | if (null == invoker) { |
|
0 commit comments