Changeset 3203
- Timestamp:
- 12/12/08 11:46:23 (12 months ago)
- Location:
- trunk/ProjectFortress
- Files:
-
- 15 modified
-
astgen/Fortress.ast (modified) (1 diff)
-
src/com/sun/fortress/compiler/Types.java (modified) (4 diffs)
-
src/com/sun/fortress/compiler/disambiguator/TypeDisambiguator.java (modified) (4 diffs)
-
src/com/sun/fortress/compiler/typechecker/FnDeclTypeEnv.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/typechecker/FnTypeEnv.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/typechecker/InferenceVarTranslator.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/typechecker/MethodTypeEnv.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/typechecker/SubtypeChecker.java (modified) (2 diffs)
-
src/com/sun/fortress/compiler/typechecker/TypeAnalyzerJUTest.java (modified) (3 diffs)
-
src/com/sun/fortress/compiler/typechecker/TypeChecker.java (modified) (4 diffs)
-
src/com/sun/fortress/compiler/typechecker/TypeEnv.java (modified) (2 diffs)
-
src/com/sun/fortress/compiler/typechecker/TypesUtil.java (modified) (1 diff)
-
src/com/sun/fortress/nodes_util/NodeFactory.java (modified) (10 diffs)
-
src/com/sun/fortress/parser/Type.rats (modified) (4 diffs)
-
src/com/sun/fortress/parser_util/precedence_resolver/TypeResolver.java (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ProjectFortress/astgen/Fortress.ast
r3202 r3203 976 976 * type 977 977 */ 978 root abstract Type(ignoreForEquals boolean parenthesized = false);978 root abstract Type(ignoreForEquals boolean parenthesized); 979 979 /** 980 980 * base types: things that can be extended, excluded, thrown, etc. -
trunk/ProjectFortress/src/com/sun/fortress/compiler/Types.java
r3202 r3203 55 55 public static final Id IMMUTABLE_HEAP_SEQ_NAME = makeId(fortressLibrary, "ImmutableArray"); 56 56 57 public static final AnyType ANY = new AnyType(span );58 public static final BottomType BOTTOM = new BottomType(span );57 public static final AnyType ANY = new AnyType(span, false); 58 public static final BottomType BOTTOM = new BottomType(span, false); 59 59 public static final TraitType OBJECT = makeTraitType(fortressBuiltin, "Object"); 60 60 … … 73 73 74 74 75 public static final LabelType LABEL = new LabelType(span );75 public static final LabelType LABEL = new LabelType(span, false); 76 76 77 77 public static final TraitType makeVarargsParamType(Type varargsType) { … … 127 127 default: { 128 128 List<Type> l = CollectUtil.makeList(ts); 129 return new UnionType(NodeFactory.makeSpan("impossible", l), l); 129 return NodeFactory.makeUnionType(NodeFactory.makeSpan("impossible", l), 130 false, l); 130 131 } 131 132 } … … 147 148 default: { 148 149 List<Type> l = CollectUtil.makeList(ts); 149 return newIntersectionType(NodeFactory.makeSpan("impossible", l), l);150 return NodeFactory.makeIntersectionType(NodeFactory.makeSpan("impossible", l), l); 150 151 } 151 152 } -
trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/TypeDisambiguator.java
r3202 r3203 209 209 public Type value(Id n) { 210 210 if (n.equals(Types.ANY_NAME)) { 211 return new AnyType(that.getSpan() );211 return new AnyType(that.getSpan(), false); 212 212 } 213 213 else { … … 238 238 List<StaticArg> args = that.getArgs(); 239 239 if (n.equals(Types.ANY_NAME) && args.isEmpty()) { 240 return new AnyType(that.getSpan() );240 return new AnyType(that.getSpan(), false); 241 241 } 242 242 else { … … 353 353 } 354 354 @Override public StaticArg forKindDim(KindDim p) { 355 return new DimArg(s, newDimRef(s, name));355 return new DimArg(s, NodeFactory.makeDimRef(s, name)); 356 356 } 357 357 @Override public StaticArg forKindInt(KindInt p) { … … 567 567 @Override 568 568 public StaticArg forKindDim(KindDim k) { 569 return new DimArg(arg.getSpan(), newDimRef(arg.getSpan(), (Id)name));569 return new DimArg(arg.getSpan(), NodeFactory.makeDimRef(arg.getSpan(), (Id)name)); 570 570 } 571 571 @Override -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/FnDeclTypeEnv.java
r3123 r3203 77 77 } 78 78 // TODO highly bogus span here -- we need a set-span 79 return some(new BindingLookup(var, newIntersectionType(NodeFactory.makeSetSpan("impossible", overloadedTypes), overloadedTypes)));79 return some(new BindingLookup(var, NodeFactory.makeIntersectionType(NodeFactory.makeSetSpan("impossible", overloadedTypes), overloadedTypes))); 80 80 } 81 81 -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/FnTypeEnv.java
r3202 r3203 162 162 } 163 163 } 164 return Option.some(new BindingLookup(var, newIntersectionType(NodeFactory.makeSetSpan("impossible", overloadedTypes), overloadedTypes)));164 return Option.some(new BindingLookup(var, NodeFactory.makeIntersectionType(NodeFactory.makeSetSpan("impossible", overloadedTypes), overloadedTypes))); 165 165 } 166 166 -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/InferenceVarTranslator.java
r3071 r3203 90 90 // created elsewhere that wrap Characters (currently, other instances just wrap 91 91 // raw Objects) 92 return new _InferenceVarType(NodeFactory.makeSpan("blame InferenceVarTranslator.nextCanonicalVar"), _canonicalNames.next()); 92 return NodeFactory.make_InferenceVarType(NodeFactory.makeSpan("blame InferenceVarTranslator.nextCanonicalVar"), 93 false, _canonicalNames.next()); 93 94 } 94 95 -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/MethodTypeEnv.java
r3122 r3203 84 84 } 85 85 // TODO, need a "set span" 86 return Option.some(new BindingLookup(var, newIntersectionType(NodeFactory.makeSetSpan("impossible", overloads), overloads)));86 return Option.some(new BindingLookup(var, NodeFactory.makeIntersectionType(NodeFactory.makeSetSpan("impossible", overloads), overloads))); 87 87 } 88 88 -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/SubtypeChecker.java
r3176 r3203 548 548 default: { 549 549 List<Type> l = CollectUtil.makeList(elts); 550 return new UnionType(NodeFactory.makeSetSpan("impossible", l),l);550 return NodeFactory.makeUnionType(NodeFactory.makeSetSpan("impossible", l), false, l); 551 551 } 552 552 } … … 567 567 default: { 568 568 List<Type> l = CollectUtil.makeList(elts); 569 return newIntersectionType(NodeFactory.makeSetSpan("impossible", l),l);569 return NodeFactory.makeIntersectionType(NodeFactory.makeSetSpan("impossible", l),l); 570 570 } 571 571 } -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeAnalyzerJUTest.java
r3202 r3203 526 526 opIndex = findAtTop(s, "|"); 527 527 if (opIndex == 0) { 528 return new UnionType(span, parseTypeList(s, "|{", "}"));528 return NodeFactory.makeUnionType(span, false, parseTypeList(s, "|{", "}")); 529 529 } 530 530 else if (opIndex > 0) { … … 536 536 opIndex = findAtTop(s, "&"); 537 537 if (opIndex == 0) { 538 return newIntersectionType(span, parseTypeList(s, "&{", "}"));538 return NodeFactory.makeIntersectionType(span, parseTypeList(s, "&{", "}")); 539 539 } 540 540 else if (opIndex > 0) { … … 567 567 568 568 if (s.startsWith("#")) { 569 return new _InferenceVarType(span, s);569 return NodeFactory.make_InferenceVarType(span, false, s); 570 570 } 571 571 -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeChecker.java
r3202 r3203 2537 2537 type = (arrow_types.isEmpty()) ? 2538 2538 Option.<Type>none() : 2539 Option.<Type>some( newIntersectionType(NodeFactory.makeSetSpan("impossible", arrow_types), arrow_types));2539 Option.<Type>some(NodeFactory.makeIntersectionType(NodeFactory.makeSetSpan("impossible", arrow_types), arrow_types)); 2540 2540 constraints = accumulated_constraints; 2541 2541 new_node = ExprFactory.makeFnRef(that.getSpan(), … … 2565 2565 type = Option.<Type>some(arrow_types.get(0)); 2566 2566 } else { 2567 type = Option.<Type>some( newIntersectionType(NodeFactory.makeSetSpan("impossible", arrow_types), arrow_types));2567 type = Option.<Type>some(NodeFactory.makeIntersectionType(NodeFactory.makeSetSpan("impossible", arrow_types), arrow_types)); 2568 2568 } 2569 2569 2570 2570 type = (arrow_types.isEmpty()) ? 2571 2571 Option.<Type>none() : 2572 Option.<Type>some( newIntersectionType(NodeFactory.makeSetSpan("impossible", arrow_types), arrow_types));2572 Option.<Type>some(NodeFactory.makeIntersectionType(NodeFactory.makeSetSpan("impossible", arrow_types), arrow_types)); 2573 2573 constraints = accumulated_constraints; 2574 2574 new_node = ExprFactory.makeFnRef(that.getSpan(), … … 3846 3846 type = (arrow_types.isEmpty()) ? 3847 3847 Option.<Type>none() : 3848 Option.<Type>some( newIntersectionType(NodeFactory.makeSetSpan("impossible", arrow_types), arrow_types));3848 Option.<Type>some(NodeFactory.makeIntersectionType(NodeFactory.makeSetSpan("impossible", arrow_types), arrow_types)); 3849 3849 new_node = ExprFactory.makeOpRef(that.getSpan(), 3850 3850 that.isParenthesized(), … … 3872 3872 type = (arrow_types.isEmpty()) ? 3873 3873 Option.<Type>none() : 3874 Option.<Type>some( newIntersectionType(NodeFactory.makeSetSpan("impossible", arrow_types), arrow_types));3874 Option.<Type>some(NodeFactory.makeIntersectionType(NodeFactory.makeSetSpan("impossible", arrow_types), arrow_types)); 3875 3875 3876 3876 constraints = accumulated_constraints; -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeEnv.java
r3202 r3203 195 195 } 196 196 public StaticArg forKindDim(KindDim k) { 197 return new DimArg(new Span(), newDimRef(new Span(), (Id)name));197 return new DimArg(new Span(), NodeFactory.makeDimRef(new Span(), (Id)name)); 198 198 } 199 199 public StaticArg forKindInt(KindInt k) { … … 455 455 mods.addAll(decl.getMods()); 456 456 } 457 type = Option.<Type>some( newIntersectionType(NodeFactory.makeSetSpan("impossible", overloads), overloads));457 type = Option.<Type>some(NodeFactory.makeIntersectionType(NodeFactory.makeSetSpan("impossible", overloads), overloads)); 458 458 mutable = false; 459 459 } -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypesUtil.java
r3202 r3203 421 421 } 422 422 } 423 return Option.some(Pair.make((Type) new IntersectionType(that.getSpan(),that.isParenthesized(),conjuncts),accumulated_constraint)); 423 return Option.some(Pair.make((Type) NodeFactory.makeIntersectionType(that.getSpan(), 424 that.isParenthesized(), 425 conjuncts),accumulated_constraint)); 424 426 } 425 427 -
trunk/ProjectFortress/src/com/sun/fortress/nodes_util/NodeFactory.java
r3202 r3203 649 649 } 650 650 651 public static DimBinaryOp makeDimBinaryOp(DimBinaryOp t, DimExpr s, DimExpr u, Op o) { 652 return makeDimBinaryOp(t.getSpan(), t.isParenthesized(), s, u, o); 653 } 654 655 public static DimBinaryOp makeDimBinaryOp(Span span, boolean parenthesized, 656 DimExpr left, DimExpr right, Op op) { 657 return new DimBinaryOp(span, parenthesized, left, right, op); 658 } 659 660 public static DimUnaryOp makeDimUnaryOp(DimUnaryOp t, DimExpr s) { 661 return makeDimUnaryOp(t.getSpan(), t.isParenthesized(), s, t.getOp()); 662 } 663 664 public static DimUnaryOp makeDimUnaryOp(Span span, boolean parenthesized, 665 DimExpr dim, Op op) { 666 return new DimUnaryOp(span, parenthesized, dim, op); 667 } 668 669 public static DimExponent makeDimExponent(DimExponent t, Type s) { 670 return makeDimExponent(t.getSpan(), t.isParenthesized(), s, 671 t.getPower()); 672 } 673 674 public static DimExponent makeDimExponent(Span span, boolean parenthesized, 675 Type base, IntExpr power) { 676 return new DimExponent(span, parenthesized, base, power); 677 } 678 679 public static DimRef makeDimRef(Span span, String name) { 680 return makeDimRef(span, false, makeId(name)); 681 } 682 683 public static DimRef makeDimRef(Span span, Id name) { 684 return new DimRef(span, false, name); 685 } 686 687 public static DimRef makeDimRef(Span span, boolean parenthesized, Id name) { 688 return new DimRef(span, parenthesized, name); 689 } 690 691 public static DimBase makeDimBase(Span span, boolean parenthesized) { 692 return new DimBase(span, parenthesized); 693 } 694 695 public static FixedPointType makeFixedPointType(FixedPointType t, Type s) { 696 return makeFixedPointType(t.getSpan(), t.isParenthesized(), t.getName(), s); 697 } 698 699 public static FixedPointType makeFixedPointType(_InferenceVarType name, Type s) { 700 return makeFixedPointType(s.getSpan(), s.isParenthesized(), name, s); 701 } 702 703 public static FixedPointType makeFixedPointType(Span span, boolean parenthesized, 704 _InferenceVarType name, Type body) { 705 return new FixedPointType(span, parenthesized, name, body); 706 } 707 708 public static UnionType makeUnionType(Type t1, Type t2) { 709 return new UnionType(FortressUtil.spanTwo(t1, t2), false, 710 Arrays.asList(t1, t2)); 711 } 712 713 public static UnionType makeUnionType(Set<? extends Type> types){ 714 return new UnionType(FortressUtil.spanAll(types), false, 715 CollectUtil.makeList(types)); 716 } 717 718 public static UnionType makeUnionType(Span span, boolean parenthesized, 719 List<Type> elements) { 720 return new UnionType(span, parenthesized, elements); 721 } 722 723 public static List<Type> make_InferenceVarTypes(Span s, int size) { 724 List<Type> result = new ArrayList<Type>(size); 725 for (int i = 0; i < size; i++) { result.add(make_InferenceVarType(s)); } 726 return result; 727 } 728 729 public static _InferenceVarType make_InferenceVarType(Span s) { 730 return make_InferenceVarType(s, false, new Object()); 731 } 732 733 public static _InferenceVarType make_InferenceVarType(Span span, boolean parenthesized, Object id) { 734 return new _InferenceVarType(span, parenthesized, id); 735 } 736 737 public static TaggedUnitType makeTaggedUnitType(TaggedUnitType t, Type s) { 738 return makeTaggedUnitType(t.getSpan(), t.isParenthesized(), s, 739 t.getUnitExpr()); 740 } 741 742 public static TaggedUnitType makeTaggedUnitType(Span span, boolean parenthesized, 743 Type elem, Expr unit) { 744 return makeTaggedUnitType(span, parenthesized, elem, unit); 745 } 746 747 748 public static MatrixType makeMatrixType(Span span, Type element, 749 ExtentRange dimension) { 750 List<ExtentRange> dims = new ArrayList<ExtentRange>(); 751 dims.add(dimension); 752 dims = Useful.immutableTrimmedList(dims); 753 return makeMatrixType(span, false, element, dims); 754 } 755 756 public static MatrixType makeMatrixType(Span span, Type element, 757 ExtentRange dimension, 758 List<ExtentRange> dimensions) { 759 List<ExtentRange> dims = new ArrayList<ExtentRange>(); 760 dims.add(dimension); 761 dims.addAll(dimensions); 762 dims = Useful.immutableTrimmedList(dims); 763 return makeMatrixType(span, false, element, dims); 764 } 765 766 public static MatrixType makeMatrixType(Span span, boolean parenthesized, 767 Type elem, List<ExtentRange> dim) { 768 return new MatrixType(span, parenthesized, elem, dim); 769 } 770 771 public static ArrayType makeArrayType(Span span, Type element, 772 Option<Indices> ind) { 773 Indices indices = ind.unwrap(new Indices(span, Collections.<ExtentRange>emptyList())); 774 return makeArrayType(span, false, element, indices); 775 } 776 777 public static ArrayType makeArrayType(Span span, boolean parenthesized, 778 Type elem, Indices indices) { 779 return new ArrayType(span, parenthesized, elem, indices); 780 } 781 782 public static IntersectionType makeIntersectionType(Type t1, Type t2) { 783 return makeIntersectionType(FortressUtil.spanTwo(t1, t2), false, 784 Arrays.asList(t1, t2)); 785 } 786 787 public static IntersectionType makeIntersectionType(Set<? extends Type> types) { 788 return makeIntersectionType(FortressUtil.spanAll(types), false, 789 CollectUtil.makeList(types)); 790 } 791 792 public static IntersectionType makeIntersectionType(Span span, 793 List<Type> elems) { 794 return new IntersectionType(span, false, elems); 795 } 796 797 public static IntersectionType makeIntersectionType(Span span, boolean parenthesized, 798 List<Type> elems) { 799 return new IntersectionType(span, parenthesized, elems); 800 } 801 651 802 /***************************************************************************/ 652 803 … … 688 839 } 689 840 690 public static ArrayType makeArrayType(Span span, Type element,691 Option<Indices> ind) {692 Indices indices = ind.unwrap(new Indices(span, Collections.<ExtentRange>emptyList()));693 return new ArrayType(span, element, indices);694 }695 696 public static DimExponent makeDimExponent(DimExponent t, Type s) {697 return new DimExponent(t.getSpan(), t.isParenthesized(), s,698 t.getPower());699 }700 701 public static DimBinaryOp makeDimBinaryOp(DimBinaryOp t, DimExpr s, DimExpr u, Op o) {702 return new DimBinaryOp(t.getSpan(), t.isParenthesized(), s, u, o);703 }704 705 public static DimUnaryOp makeDimUnaryOp(DimUnaryOp t, DimExpr s) {706 return new DimUnaryOp(t.getSpan(), t.isParenthesized(), s, t.getOp());707 }708 709 841 public static TraitTypeWhere makeTraitTypeWhere(BaseType in_type) { 710 842 Span sp = in_type.getSpan(); … … 720 852 } 721 853 722 public static _InferenceVarType make_InferenceVarType(Span s) {723 return new _InferenceVarType(s, new Object());724 }725 726 public static List<Type> make_InferenceVarTypes(Span s, int size) {727 List<Type> result = new ArrayList<Type>(size);728 for (int i = 0; i < size; i++) { result.add(make_InferenceVarType(s)); }729 return result;730 }731 732 854 public static KeywordType makeKeywordType(KeywordType t, Type s) { 733 855 return new KeywordType(t.getSpan(), t.getName(), s); 734 856 } 735 857 736 public static TaggedUnitType makeTaggedUnitType(TaggedUnitType t, Type s) {737 return new TaggedUnitType(t.getSpan(), t.isParenthesized(), s,738 t.getUnitExpr());739 }740 741 858 public static TypeArg makeTypeArg(TypeArg t, Type s) { 742 859 return new TypeArg(t.getSpan(), s); … … 751 868 } 752 869 753 public static DimRef makeDimRef(Span span, String name) {754 return new DimRef(span, makeId(name));755 }756 757 870 public static UnitArg makeUnitArg(UnitExpr s) { 758 871 return new UnitArg(s.getSpan(), s); … … 761 874 public static UnitRef makeUnitRef(Span span, String name) { 762 875 return new UnitRef(span, makeId(name)); 763 }764 765 public static FixedPointType makeFixedPointType(FixedPointType t, Type s) {766 return new FixedPointType(t.getSpan(), t.isParenthesized(), t.getName(),767 s);768 }769 770 public static FixedPointType makeFixedPointType(_InferenceVarType name, Type s) {771 return new FixedPointType(s.getSpan(), s.isParenthesized(), name, s);772 }773 774 public static IntersectionType makeIntersectionType(Type t1, Type t2) {775 return new IntersectionType(FortressUtil.spanTwo(t1, t2), Arrays.asList(t1, t2));776 }777 778 public static IntersectionType makeIntersectionType(Set<? extends Type> types){779 return new IntersectionType(FortressUtil.spanAll(types),CollectUtil.makeList(types));780 }781 782 public static UnionType makeUnionType(Type t1, Type t2) {783 return new UnionType(FortressUtil.spanTwo(t1, t2), Arrays.asList(t1, t2));784 }785 786 public static UnionType makeUnionType(Set<? extends Type> types){787 return new UnionType(FortressUtil.spanAll(types),CollectUtil.makeList(types));788 876 } 789 877 … … 999 1087 }; 1000 1088 1001 public static MatrixType makeMatrixType(Span span, Type element,1002 ExtentRange dimension) {1003 List<ExtentRange> dims = new ArrayList<ExtentRange>();1004 dims.add(dimension);1005 dims = Useful.immutableTrimmedList(dims);1006 return new MatrixType(span, element, dims);1007 }1008 1009 public static MatrixType makeMatrixType(Span span, Type element,1010 ExtentRange dimension,1011 List<ExtentRange> dimensions) {1012 List<ExtentRange> dims = new ArrayList<ExtentRange>();1013 dims.add(dimension);1014 dims.addAll(dimensions);1015 dims = Useful.immutableTrimmedList(dims);1016 return new MatrixType(span, element, dims);1017 }1018 1019 1089 public static Op makeEnclosing(Span in_span, String in_open, String in_close) { 1020 1090 return new Op(in_span, PrecedenceMap.ONLY.canon(in_open + " " + in_close), … … 1290 1360 return dim.accept(new NodeAbstractVisitor<DimExpr>() { 1291 1361 public DimExpr forDimBase(DimBase t) { 1292 return newDimBase(t.getSpan(), true);1362 return makeDimBase(t.getSpan(), true); 1293 1363 } 1294 1364 public DimExpr forDimRef(DimRef t) { 1295 return newDimRef(t.getSpan(), true, t.getName());1365 return makeDimRef(t.getSpan(), true, t.getName()); 1296 1366 } 1297 1367 public DimExpr forDimBinaryOp(DimBinaryOp t) { 1298 return newDimBinaryOp(t.getSpan(), true, t.getLeft(),1368 return makeDimBinaryOp(t.getSpan(), true, t.getLeft(), 1299 1369 t.getRight(), t.getOp()); 1300 1370 } 1301 1371 public DimExpr forDimExponent(DimExponent t) { 1302 return newDimExponent(t.getSpan(), true, t.getBase(),1303 t.getPower());1372 return makeDimExponent(t.getSpan(), true, t.getBase(), 1373 t.getPower()); 1304 1374 } 1305 1375 public DimExpr forDimUnaryOp(DimUnaryOp t) { 1306 return newDimUnaryOp(t.getSpan(), true, t.getDimVal(), t.getOp());1376 return makeDimUnaryOp(t.getSpan(), true, t.getDimVal(), t.getOp()); 1307 1377 } 1308 1378 public DimExpr defaultCase(Node x) { … … 1356 1426 } 1357 1427 public Type forArrayType(ArrayType t) { 1358 return newArrayType(t.getSpan(), true, t.getElemType(),1359 t.getIndices());1428 return makeArrayType(t.getSpan(), true, t.getElemType(), 1429 t.getIndices()); 1360 1430 } 1361 1431 public Type forVarType(VarType t) { … … 1363 1433 } 1364 1434 public Type forMatrixType(MatrixType t) { 1365 return newMatrixType(t.getSpan(), true, t.getElemType(),1366 t.getDimensions());1435 return makeMatrixType(t.getSpan(), true, t.getElemType(), 1436 t.getDimensions()); 1367 1437 } 1368 1438 public Type forTraitType(TraitType t) { … … 1379 1449 } 1380 1450 public Type forTaggedUnitType(TaggedUnitType t) { 1381 return newTaggedUnitType(t.getSpan(), true, t.getElemType(),1451 return makeTaggedUnitType(t.getSpan(), true, t.getElemType(), 1382 1452 t.getUnitExpr()); 1383 1453 } -
trunk/ProjectFortress/src/com/sun/fortress/parser/Type.rats
r3202 r3203 151 151 / TypeRef 152 152 / VoidType 153 / one { yyValue = new DimBase(createSpan(yyStart,1)); };153 / one { yyValue = NodeFactory.makeDimBase(createSpan(yyStart,1), false); }; 154 154 155 155 /* ParenthesizedType ::= ( w Type w ) */ … … 205 205 / "Unity" 206 206 { Span span = createSpan(yyStart,yyCount); 207 yyValue = new DimBase(span);207 yyValue = NodeFactory.makeDimBase(span, false); 208 208 } 209 209 / a1:Id a2:StaticArgs? … … 302 302 "by an exponentiation."); 303 303 if (base instanceof DimExpr) { 304 return newDimExponent(createSpan(yyStart,yyCount),305 (DimExpr)base, a1);304 return NodeFactory.makeDimExponent(createSpan(yyStart,yyCount), 305 false, (DimExpr)base, a1); 306 306 } else { // !(base instanceof DimExpr) 307 return newDimExponent(createSpan(yyStart,yyCount),308 (Type)base, a1);307 return NodeFactory.makeDimExponent(createSpan(yyStart,yyCount), 308 false, (Type)base, a1); 309 309 } 310 310 }}; … … 353 353 public Type run(Type base) { 354 354 return NodeFactory.makeTaggedDimType(createSpan(yyStart,yyCount), false, 355 (Type)base, newDimRef(a1.getSpan(), a1),355 (Type)base, NodeFactory.makeDimRef(a1.getSpan(), a1), 356 356 Option.<Expr>none()); 357 357 }}; -
trunk/ProjectFortress/src/com/sun/fortress/parser_util/precedence_resolver/TypeResolver.java
r3202 r3203 75 75 private static Type makeProductDim(Span span, TaggedDimType expr0, 76 76 DimExpr expr2) throws TypeConvertFailure { 77 DimExpr dim = newDimBinaryOp(span, true, dimToDim(expr0.getDimExpr()),78 dimToDim(expr2), product(span));77 DimExpr dim = NodeFactory.makeDimBinaryOp(span, true, dimToDim(expr0.getDimExpr()), 78 dimToDim(expr2), product(span)); 79 79 return NodeFactory.makeTaggedDimType(span, true, 80 80 typeToType(expr0.getElemType()), dim, … … 85 85 DimExpr expr2) 86 86 throws TypeConvertFailure { 87 DimExpr dim = newDimBinaryOp(span, true, dimToDim(expr0.getDimExpr()),87 DimExpr dim = NodeFactory.makeDimBinaryOp(span, true, dimToDim(expr0.getDimExpr()), 88 88 dimToDim(expr2), quotient(span)); 89 89 return NodeFactory.makeTaggedDimType(span, true, … … 268 268 DimExpr _first = typeToDim(first); 269 269 if (isDOT(op)) 270 return newDimBinaryOp(span, true, _first, _second,270 return NodeFactory.makeDimBinaryOp(span, true, _first, _second, 271 271 product(span)); 272 272 else // op.getText().equals("/") || 273 273 // op.getText().equals("per") 274 return newDimBinaryOp(span, true, _first, _second,274 return NodeFactory.makeDimBinaryOp(span, true, _first, _second, 275 275 quotient(span)); 276 276 // throw new ReadError(op.getSpan(), "DimExpr is expected."); … … 457 457 DimExpr e = 458 458 typeToDim(((RealType)__opTypes.getFirst()).getType()); 459 return _rest.cons(new RealType( newDimUnaryOp(e.getSpan(), true,459 return _rest.cons(new RealType(NodeFactory.makeDimUnaryOp(e.getSpan(), true, 460 460 e, op))); 461 461 } catch (TypeConvertFailure x) { … … 529 529 try { 530 530 DimExpr _expr0 = typeToDim(expr0); 531 e = newDimBinaryOp(span, true,531 e = NodeFactory.makeDimBinaryOp(span, true, 532 532 _expr0, expr2, 533 533 quotient(span)); … … 574 574 Op op = ((Postfix)(_rest.getFirst())).getOp(); 575 575 PureList<PostfixOpExpr> restRest = _rest.getRest(); 576 DimExpr dim = newDimUnaryOp(_first.getSpan(),576 DimExpr dim = NodeFactory.makeDimUnaryOp(_first.getSpan(), 577 577 _first.isParenthesized(), 578 578 _first, op); … … 630 630 public DimExpr forDimExponent(DimExponent t) { 631 631 try { 632 return newDimExponent(t.getSpan(),632 return NodeFactory.makeDimExponent(t.getSpan(), 633 633 t.isParenthesized(), 634 634 typeToDim(t.getBase()), … … 647 647 ExtentRange dimension = dimensions.get(0); 648 648 IntArg power = (IntArg)dimension.getSize().unwrap(); 649 return newDimExponent(t.getSpan(),649 return NodeFactory.makeDimExponent(t.getSpan(), 650 650 t.isParenthesized(), 651 651 typeToDim(t.getElemType()), … … 659 659 try { 660 660 if (t.getUnitExpr().isNone()) { 661 return newDimBinaryOp(t.getSpan(),661 return NodeFactory.makeDimBinaryOp(t.getSpan(), 662 662 t.isParenthesized(), 663 663 typeToDim(t.getElemType()), … … 691 691 public DimExpr forDimExponent(DimExponent d) { 692 692 try { 693 return newDimExponent(d.getSpan(),693 return NodeFactory.makeDimExponent(d.getSpan(), 694 694 d.isParenthesized(), 695 695 typeToDim(d.getBase()), … … 700 700 } 701 701 public DimExpr forDimBinaryOp(DimBinaryOp d) { 702 return newDimBinaryOp(d.getSpan(),702 return NodeFactory.makeDimBinaryOp(d.getSpan(), 703 703 d.isParenthesized(), 704 704 dimToDim(d.getLeft()), … … 707 707 } 708 708 public DimExpr forDimUnaryOp(DimUnaryOp d) { 709 return newDimUnaryOp(d.getSpan(),709 return NodeFactory.makeDimUnaryOp(d.getSpan(), 710 710 d.isParenthesized(), 711 711 dimToDim(d.getDimVal()), … … 779 779 DimExpr rleft = _right.getLeft(); 780 780 Span span = spanTwo(left, rleft); 781 left = newDimBinaryOp(span,781 left = NodeFactory.makeDimBinaryOp(span, 782 782 true, left, rleft, 783 783 product(span)); … … 786 786 } else 787 787 left = canonicalizeDim(left); 788 return newDimBinaryOp(d.getSpan(),788 return NodeFactory.makeDimBinaryOp(d.getSpan(), 789 789 d.isParenthesized(), 790 790 left, right, product(d.getSpan())); 791 791 } else { 792 return newDimBinaryOp(d.getSpan(),792 return NodeFactory.makeDimBinaryOp(d.getSpan(), 793 793 d.isParenthesized(), 794 794 canonicalizeDim(d.getLeft()), … … 799 799 } 800 800 public DimExpr forDimExponent(DimExponent d) { 801 return newDimExponent(d.getSpan(),801 return NodeFactory.makeDimExponent(d.getSpan(), 802 802 d.isParenthesized(), 803 803 canonicalizeDim((DimExpr)d.getBase()), … … 805 805 } 806 806 public DimExpr forDimUnaryOp(DimUnaryOp d) { 807 return newDimUnaryOp(d.getSpan(),807 return NodeFactory.makeDimUnaryOp(d.getSpan(), 808 808 d.isParenthesized(), 809 809 canonicalizeDim(d.getDimVal()),

