|
14 | 14 | ********************************************************************************/ |
15 | 15 | package org.prorefactor.core.nodetypes; |
16 | 16 |
|
17 | | -import java.util.List; |
18 | 17 | import java.util.function.Function; |
19 | 18 |
|
20 | 19 | import org.prorefactor.core.ABLNodeType; |
@@ -742,15 +741,34 @@ static DataType getStandardMethodDataType(String id) { |
742 | 741 | } |
743 | 742 | } |
744 | 743 |
|
745 | | - static Pair<ITypeInfo, IMethodElement> getObjectMethod(Function<String, ITypeInfo> provider, JPNode node, ITypeInfo info, |
746 | | - String methodName) { |
| 744 | + static Pair<ITypeInfo, IMethodElement> getObjectConstructor(Function<String, ITypeInfo> provider, JPNode node, |
| 745 | + ITypeInfo info) { |
747 | 746 | // Create array of dataTypes |
748 | | - List<JPNode> paramItems = node.getDirectChildren(ABLNodeType.PARAMETER_ITEM); |
749 | | - DataType[] params = new DataType[paramItems.size()]; |
| 747 | + var paramItems = node.getDirectChildren(ABLNodeType.PARAMETER_ITEM); |
| 748 | + var params = new DataType[paramItems.size()]; |
750 | 749 | int zz = 0; |
751 | | - for (JPNode ch : paramItems) { |
752 | | - DataType dt = DataType.UNKNOWN; |
753 | | - for (JPNode ch2 : ch.getDirectChildren()) { |
| 750 | + for (var ch : paramItems) { |
| 751 | + var dt = DataType.UNKNOWN; |
| 752 | + for (var ch2 : ch.getDirectChildren()) { |
| 753 | + if ((dt == DataType.UNKNOWN) && ch2.isIExpression()) { |
| 754 | + dt = ch2.asIExpression().getDataType(); |
| 755 | + } |
| 756 | + } |
| 757 | + params[zz++] = dt; |
| 758 | + } |
| 759 | + |
| 760 | + return info == null ? null : info.getConstructor(provider, params); |
| 761 | + } |
| 762 | + |
| 763 | + static Pair<ITypeInfo, IMethodElement> getObjectMethod(Function<String, ITypeInfo> provider, JPNode node, |
| 764 | + ITypeInfo info, String methodName) { |
| 765 | + // Create array of dataTypes |
| 766 | + var paramItems = node.getDirectChildren(ABLNodeType.PARAMETER_ITEM); |
| 767 | + var params = new DataType[paramItems.size()]; |
| 768 | + int zz = 0; |
| 769 | + for (var ch : paramItems) { |
| 770 | + var dt = DataType.UNKNOWN; |
| 771 | + for (var ch2 : ch.getDirectChildren()) { |
754 | 772 | if ((dt == DataType.UNKNOWN) && ch2.isIExpression()) { |
755 | 773 | dt = ch2.asIExpression().getDataType(); |
756 | 774 | } |
|
0 commit comments