01: /**************************************************************************/
02: /* N I C E */
03: /* A high-level object-oriented research language */
04: /* (c) Daniel Bonniot 2002 */
05: /* */
06: /* This program is free software; you can redistribute it and/or modify */
07: /* it under the terms of the GNU General Public License as published by */
08: /* the Free Software Foundation; either version 2 of the License, or */
09: /* (at your option) any later version. */
10: /* */
11: /**************************************************************************/package nice.tools.code;
12:
13: /**
14: The bytecode type of a tuple.
15:
16: @version $Date: 2004/02/11 12:46:39 $
17: @author Daniel Bonniot (bonniot@users.sourceforge.net)
18: */
19:
20: import gnu.bytecode.*;
21:
22: public class TupleType extends SpecialArray {
23: TupleType(Type arrayType, Type[] componentTypes) {
24: super (arrayType);
25: this .componentTypes = componentTypes;
26: }
27:
28: TupleType(Type[] componentTypes) {
29: this (Types.lowestCommonSupertype(componentTypes),
30: componentTypes);
31: }
32:
33: public Type[] componentTypes;
34:
35: public String toString() {
36: return "tuple[" + getComponentType() + "]("
37: + bossa.util.Util.map("", ",", ")", componentTypes);
38: }
39:
40: public static gnu.expr.Expression createExp(Type arrayType,
41: Type[] componentTypes, gnu.expr.Expression[] components) {
42: return new gnu.expr.ApplyExp(
43: new nice.tools.code.LiteralArrayProc(new TupleType(
44: arrayType, componentTypes), components.length,
45: false), components);
46: }
47: }
|