Computes the implicit frame of the method currently being parsed (as defined in the given Context) and stores it in the given context. @param context information about the class being parsed.
(final Context context)
| 2958 | * @param context information about the class being parsed. |
| 2959 | */ |
| 2960 | private void computeImplicitFrame(final Context context) { |
| 2961 | String methodDescriptor = context.currentMethodDescriptor; |
| 2962 | Object[] locals = context.currentFrameLocalTypes; |
| 2963 | int nLocal = 0; |
| 2964 | if ((context.currentMethodAccessFlags & Opcodes.ACC_STATIC) == 0) { |
| 2965 | if ("<init>".equals(context.currentMethodName)) { |
| 2966 | locals[nLocal++] = Opcodes.UNINITIALIZED_THIS; |
| 2967 | } else { |
| 2968 | locals[nLocal++] = readClass(header + 2, context.charBuffer); |
| 2969 | } |
| 2970 | } |
| 2971 | // Parse the method descriptor, one argument type descriptor at each iteration. Start by |
| 2972 | // skipping the first method descriptor character, which is always '('. |
| 2973 | int currentMethodDescritorOffset = 1; |
| 2974 | while (true) { |
| 2975 | int currentArgumentDescriptorStartOffset = currentMethodDescritorOffset; |
| 2976 | switch (methodDescriptor.charAt(currentMethodDescritorOffset++)) { |
| 2977 | case 'Z': |
| 2978 | case 'C': |
| 2979 | case 'B': |
| 2980 | case 'S': |
| 2981 | case 'I': |
| 2982 | locals[nLocal++] = Opcodes.INTEGER; |
| 2983 | break; |
| 2984 | case 'F': |
| 2985 | locals[nLocal++] = Opcodes.FLOAT; |
| 2986 | break; |
| 2987 | case 'J': |
| 2988 | locals[nLocal++] = Opcodes.LONG; |
| 2989 | break; |
| 2990 | case 'D': |
| 2991 | locals[nLocal++] = Opcodes.DOUBLE; |
| 2992 | break; |
| 2993 | case '[': |
| 2994 | while (methodDescriptor.charAt(currentMethodDescritorOffset) == '[') { |
| 2995 | ++currentMethodDescritorOffset; |
| 2996 | } |
| 2997 | if (methodDescriptor.charAt(currentMethodDescritorOffset) == 'L') { |
| 2998 | ++currentMethodDescritorOffset; |
| 2999 | while (methodDescriptor.charAt(currentMethodDescritorOffset) != ';') { |
| 3000 | ++currentMethodDescritorOffset; |
| 3001 | } |
| 3002 | } |
| 3003 | locals[nLocal++] = |
| 3004 | methodDescriptor.substring( |
| 3005 | currentArgumentDescriptorStartOffset, ++currentMethodDescritorOffset); |
| 3006 | break; |
| 3007 | case 'L': |
| 3008 | while (methodDescriptor.charAt(currentMethodDescritorOffset) != ';') { |
| 3009 | ++currentMethodDescritorOffset; |
| 3010 | } |
| 3011 | locals[nLocal++] = |
| 3012 | methodDescriptor.substring( |
| 3013 | currentArgumentDescriptorStartOffset + 1, currentMethodDescritorOffset++); |
| 3014 | break; |
| 3015 | default: |
| 3016 | context.currentFrameLocalCount = nLocal; |
| 3017 | return; |