[Nice-commit] Nice/src/nice/tools/code LiteralArrayProc.java,1.7,1.8
Brought to you by:
bonniot
From: Daniel B. <bo...@us...> - 2004-06-21 17:08:45
|
Update of /cvsroot/nice/Nice/src/nice/tools/code In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22779/src/nice/tools/code Modified Files: LiteralArrayProc.java Log Message: Better use of context information for compiling tuples (fixes #976723). Index: LiteralArrayProc.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/code/LiteralArrayProc.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** LiteralArrayProc.java 11 Feb 2004 12:46:39 -0000 1.7 --- LiteralArrayProc.java 21 Jun 2004 17:08:37 -0000 1.8 *************** *** 50,54 **** CodeAttr code = comp.getCode(); ! Type componentType = getComponentType(args); code.emitPushInt(nbElements); --- 50,54 ---- CodeAttr code = comp.getCode(); ! Type componentType = arrayType.getComponentType().getImplementationType(); code.emitPushInt(nbElements); *************** *** 57,63 **** // Set a special type, not the legacy array type. code.popType(); ! code.pushType(SpecialTypes.array(componentType)); - /* Optimization: --- 57,62 ---- // Set a special type, not the legacy array type. code.popType(); ! code.pushType(arrayType); /* Optimization: *************** *** 103,127 **** } - private Type getComponentType (Expression[] args) - { - Type type = Types.lowestUpperBound(args); - - if (type.isSubtype(arrayType.getComponentType())) - { - // We could precise that type of the array, but this is not - // necessary given the context, and it would even be bas for primitive - // types (byte[] will need conversion if int[] is expected). - // Just keep the original type. - type = arrayType.getComponentType(); - } - - if (type == Type.nullType) - // All we know is that this array will contain only null, and will be - // used generically. Let's make that Object. - type = Type.pointer_type; - - return type; - } - public Type getReturnType(Expression[] args) { --- 102,105 ---- *************** *** 129,133 **** return ClassType.make("java.util.List"); ! return SpecialTypes.array(getComponentType(args)); } --- 107,111 ---- return ClassType.make("java.util.List"); ! return arrayType; } |