Changeset 3092
- Timestamp:
- 11/24/08 12:05:37 (12 months ago)
- Location:
- trunk/ProjectFortress
- Files:
-
- 10 modified
-
astgen/Fortress.ast (modified) (3 diffs)
-
src/com/sun/fortress/compiler/OverloadRewriteVisitor.java (modified) (3 diffs)
-
src/com/sun/fortress/compiler/desugarer/DesugaringVisitor.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/disambiguator/ExprDisambiguator.java (modified) (2 diffs)
-
src/com/sun/fortress/compiler/typechecker/TypeChecker.java (modified) (8 diffs)
-
src/com/sun/fortress/interpreter/rewrite/OprInstantiaterVisitor.java (modified) (1 diff)
-
src/com/sun/fortress/nodes_util/ExprFactory.java (modified) (9 diffs)
-
src/com/sun/fortress/nodes_util/NodeFactory.java (modified) (1 diff)
-
src/com/sun/fortress/parser_util/precedence_resolver/ASTUtil.java (modified) (1 diff)
-
src/com/sun/fortress/tools/FortressAstToConcrete.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ProjectFortress/astgen/Fortress.ast
r3082 r3092 188 188 * Import ::= import ImportedNames | import api AliasedAPINames 189 189 */ 190 abstract Import( );190 abstract Import(Option<String> foreignLanguage = Option.<String>none()); 191 191 /** 192 192 * ImportedNames ::= APIName . {...} (except SimpleNames)? … … 1127 1127 */ 1128 1128 FnRef(Id originalName, 1129 List<Id> fns = Collections.<Id>singletonList(in_originalName), 1130 List<StaticArg> staticArgs 1131 = Collections.<StaticArg>emptyList()); 1129 List<Id> fns = Collections.<Id>singletonList(in_originalName)); 1132 1130 /** 1133 1131 * A list of FnRefs used for infering static arguments. Used only between the two … … 1144 1142 */ 1145 1143 OpRef(OpName originalName, 1146 List<OpName> ops = Collections.<OpName>singletonList(in_originalName), 1147 List<StaticArg> staticArgs 1148 = Collections.<StaticArg>emptyList()); 1144 List<OpName> ops = Collections.<OpName>singletonList(in_originalName)); 1149 1145 /** 1150 1146 * Similar to _RewriteInstantiatedFnRefs, this node is used for inferring static -
trunk/ProjectFortress/src/com/sun/fortress/compiler/OverloadRewriteVisitor.java
r3071 r3092 36 36 37 37 @Override 38 public Node forFnRefOnly(FnRef that, Option<Type> exprType_result, Id originalName, List<Id> fns,39 List<StaticArg> staticArgs ) {38 public Node forFnRefOnly(FnRef that, Option<Type> exprType_result, 39 List<StaticArg> staticArgs, Id originalName, List<Id> fns) { 40 40 if (fns.size() > 1) { 41 41 Collections.<Id>sort(fns, NodeComparator.idComparer); … … 57 57 fns = Collections.unmodifiableList(Collections.singletonList(overloadingId)); 58 58 } 59 return super.forFnRefOnly(that, exprType_result , originalName, fns, staticArgs);59 return super.forFnRefOnly(that, exprType_result, staticArgs , originalName, fns); 60 60 } 61 61 62 62 63 63 @Override 64 public Node forOpRefOnly(OpRef that, Option<Type> exprType_result, OpName originalName, List<OpName> ops,65 List<StaticArg> staticArgs ) {64 public Node forOpRefOnly(OpRef that, Option<Type> exprType_result, 65 List<StaticArg> staticArgs, OpName originalName, List<OpName> ops) { 66 66 if (ops.size() > 1) { 67 67 Collections.<OpName>sort(ops, NodeComparator.opNameComparer); … … 83 83 ops = Collections.unmodifiableList(Collections.singletonList(overloadingOpName)); 84 84 } 85 return super.forOpRefOnly(that, exprType_result, originalName, ops, staticArgs);85 return super.forOpRefOnly(that, exprType_result, staticArgs, originalName, ops); 86 86 } 87 87 -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/DesugaringVisitor.java
r3082 r3092 524 524 @Override 525 525 public Node forFnRefOnly(FnRef that, Option<Type> exprType_result, 526 Id fnResult, List<Id> fns_result,527 List<StaticArg> staticArgs_result) {526 List<StaticArg> staticArgs_result, 527 Id fnResult, List<Id> fns_result) { 528 528 // After disambiguation, the Id in a FnRef should have an empty API. 529 529 assert(fnResult.getApi().isNone()); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/ExprDisambiguator.java
r3082 r3092 1307 1307 } 1308 1308 1309 OpRef result = new OpRef(that.getSpan(),that.isParenthesized(), op_name,CollectUtil.makeList(ops),that.getStaticArgs());1309 OpRef result = new OpRef(that.getSpan(),that.isParenthesized(),that.getStaticArgs(),op_name,CollectUtil.makeList(ops)); 1310 1310 return Option.<OpRef>some(result); 1311 1311 } … … 1337 1337 if ( result_.isNone() ) { 1338 1338 // Make sure to populate the 'originalName' field. 1339 return new OpRef(that.getSpan(),that.isParenthesized(), IterUtil.first(that.getOps()), that.getOps(),that.getStaticArgs());1339 return new OpRef(that.getSpan(),that.isParenthesized(),that.getStaticArgs(),IterUtil.first(that.getOps()), that.getOps()); 1340 1340 } 1341 1341 else { -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeChecker.java
r3082 r3092 2442 2442 @Override 2443 2443 public TypeCheckerResult forFnRefOnly(final FnRef that, Option<TypeCheckerResult> exprType_result, 2444 List<TypeCheckerResult> staticArgs_result, 2444 2445 TypeCheckerResult originalName_result, 2445 List<TypeCheckerResult> fns_result, 2446 List<TypeCheckerResult> staticArgs_result) { 2446 List<TypeCheckerResult> fns_result) { 2447 2447 2448 2448 // Could we give a type to each of our fns? … … 2502 2502 that.isParenthesized(), 2503 2503 some(new_type), 2504 new_args, 2504 2505 that.getLexicalDepth(), 2505 2506 that.getOriginalName(), 2506 that.getFns(), 2507 new_args); 2507 that.getFns()); 2508 2508 fn_overloadings.add(new _RewriteFnRefOverloading(that.getSpan(), fn_ref, new_type)); 2509 2509 arrow_types.add(new_type); … … 2519 2519 that.isParenthesized(), 2520 2520 type, 2521 that.getLexicalDepth(),2522 that.getOriginalName(),2523 that.getFns(),2524 that.getStaticArgs(),2525 fn_overloadings);2521 that.getStaticArgs(), 2522 that.getLexicalDepth(), 2523 that.getOriginalName(), 2524 that.getFns(), 2525 fn_overloadings); 2526 2526 } 2527 2527 else { … … 2551 2551 that.isParenthesized(), 2552 2552 type, 2553 that.getStaticArgs(), 2553 2554 that.getLexicalDepth(), 2554 2555 that.getOriginalName(), 2555 that.getFns(), 2556 that.getStaticArgs()); 2556 that.getFns()); 2557 2557 } 2558 2558 … … 3656 3656 @Override 3657 3657 public TypeCheckerResult forOpRefOnly(final OpRef that, Option<TypeCheckerResult> exprType_result, 3658 List<TypeCheckerResult> staticArgs_result, 3658 3659 TypeCheckerResult originalName_result, 3659 List<TypeCheckerResult> ops_result, 3660 List<TypeCheckerResult> staticArgs_result) { 3660 List<TypeCheckerResult> ops_result) { 3661 3661 // Did all ops typecheck? 3662 3662 for( TypeCheckerResult o_r : ops_result ) { … … 3714 3714 OpRef new_op_ref = new OpRef(that.getSpan(), 3715 3715 that.isParenthesized(), 3716 new_args, 3716 3717 that.getLexicalDepth(), 3717 3718 that.getOriginalName(), 3718 that.getOps(), 3719 new_args); 3719 that.getOps()); 3720 3720 3721 3721 overloadings.add(new _RewriteOpRefOverloading(that.getSpan(), new_op_ref, new_type)); … … 3730 3730 that.isParenthesized(), 3731 3731 type, 3732 that.getStaticArgs(), 3732 3733 that.getLexicalDepth(), 3733 3734 that.getOriginalName(), 3734 3735 that.getOps(), 3735 that.getStaticArgs(),3736 3736 overloadings); 3737 3737 constraints = accumulated_constraints; … … 3757 3757 that.isParenthesized(), 3758 3758 type, 3759 (List<StaticArg>)TypeCheckerResult.astFromResults(staticArgs_result), 3759 3760 that.getLexicalDepth(), 3760 3761 that.getOriginalName(), 3761 (List<OpName>)TypeCheckerResult.astFromResults(ops_result), 3762 (List<StaticArg>)TypeCheckerResult.astFromResults(staticArgs_result)); 3762 (List<OpName>)TypeCheckerResult.astFromResults(ops_result)); 3763 3763 } 3764 3764 -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/rewrite/OprInstantiaterVisitor.java
r3089 r3092 75 75 76 76 if (args != n_args || originalName != n_originalName || ops != n_ops || type != n_type) { 77 return new OpRef(op.getSpan(), op.isParenthesized(), Option.wrap(n_type), Environment.TOP_LEVEL,78 n_originalName, n_ops , n_args);77 return new OpRef(op.getSpan(), op.isParenthesized(), Option.wrap(n_type), n_args, Environment.TOP_LEVEL, 78 n_originalName, n_ops); 79 79 } 80 80 -
trunk/ProjectFortress/src/com/sun/fortress/nodes_util/ExprFactory.java
r3082 r3092 265 265 266 266 public static OpRef makeOpRef(OpName op, List<StaticArg> staticArgs) { 267 return new OpRef(op.getSpan(), op, Collections.singletonList(op), staticArgs);267 return new OpRef(op.getSpan(), staticArgs, op, Collections.singletonList(op)); 268 268 } 269 269 … … 315 315 316 316 public static FnRef makeFnRef(FnRef original, int lexicalNestedness) { 317 return new FnRef(original.getSpan(), original.isParenthesized(), original.get LexicalDepth(), original.getOriginalName(), original.getFns(), original.getStaticArgs());317 return new FnRef(original.getSpan(), original.isParenthesized(), original.getStaticArgs(), original.getLexicalDepth(), original.getOriginalName(), original.getFns()); 318 318 } 319 319 320 320 public static FnRef makeFnRef(FnRef that, Option<Type> ty, Id name, 321 321 List<Id> ids, List<StaticArg> sargs) { 322 return new FnRef(that.getSpan(), that.isParenthesized(), ty, name, ids,323 sargs);322 return new FnRef(that.getSpan(), that.isParenthesized(), ty, 323 sargs, name, ids); 324 324 } 325 325 … … 331 331 public static FnRef makeFnRef(Span span, Id name, List<StaticArg> sargs) { 332 332 List<Id> names = Collections.singletonList(name); 333 return new FnRef(span, false, name, names, sargs);333 return new FnRef(span, false, sargs, name, names); 334 334 } 335 335 … … 337 337 List<Id> names = 338 338 Collections.singletonList(name); 339 return new FnRef(name.getSpan(), false, name, names, Collections.<StaticArg>emptyList());339 return new FnRef(name.getSpan(), false, Collections.<StaticArg>emptyList(), name, names); 340 340 } 341 341 342 342 public static FnRef makeFnRef(Id name, Id orig){ 343 return new FnRef(name.getSpan(),false, orig, Collections.singletonList(name),Collections.<StaticArg>emptyList());343 return new FnRef(name.getSpan(),false,Collections.<StaticArg>emptyList(), orig, Collections.singletonList(name)); 344 344 } 345 345 346 346 public static FnRef makeFnRef(Id orig, List<Id> names){ 347 return new FnRef(orig.getSpan(),false, orig, names,Collections.<StaticArg>emptyList());347 return new FnRef(orig.getSpan(),false,Collections.<StaticArg>emptyList(), orig, names); 348 348 } 349 349 … … 351 351 Id qName = NodeFactory.makeId(apiIds, name); 352 352 List<Id> qNames = Collections.singletonList(qName); 353 return new FnRef(qName.getSpan(), false, qName, qNames,354 Collections.<StaticArg>emptyList() );353 return new FnRef(qName.getSpan(), false, 354 Collections.<StaticArg>emptyList(), qName, qNames); 355 355 } 356 356 … … 358 358 Id qName = NodeFactory.makeId(api, name); 359 359 List<Id> qNames = Collections.singletonList(qName); 360 return new FnRef(qName.getSpan(), false, qName, qNames,361 Collections.<StaticArg>emptyList() );360 return new FnRef(qName.getSpan(), false, 361 Collections.<StaticArg>emptyList(), qName, qNames); 362 362 } 363 363 364 364 public static FnRef makeFnRef(Span span, boolean paren, Id original_fn, List<Id> fns, List<StaticArg> sargs) { 365 return new FnRef(span, paren, original_fn, fns, sargs);365 return new FnRef(span, paren, sargs, original_fn, fns); 366 366 } 367 367 … … 873 873 } 874 874 public Expr forFnRef(FnRef e) { 875 return new FnRef(e.getSpan(), true, e.getOriginalName(), e.getFns(),876 e.getStaticArgs() );875 return new FnRef(e.getSpan(), true, 876 e.getStaticArgs(), e.getOriginalName(), e.getFns()); 877 877 } 878 878 public Expr forOpRef(OpRef e) { 879 return new OpRef(e.getSpan(), true, e.getOriginalName(), e.getOps(),880 e.getStaticArgs() );879 return new OpRef(e.getSpan(), true, 880 e.getStaticArgs(), e.getOriginalName(), e.getOps()); 881 881 } 882 882 public Expr forSubscriptExpr(SubscriptExpr e) { … … 920 920 new_original_name = NodeFactory.makeOpInfix((Op)op.getOriginalName()); 921 921 922 OpRef new_op = new OpRef(op.getSpan(),op.isParenthesized(),op.get LexicalDepth(),new_original_name,new_ops,op.getStaticArgs());922 OpRef new_op = new OpRef(op.getSpan(),op.isParenthesized(),op.getStaticArgs(),op.getLexicalDepth(),new_original_name,new_ops); 923 923 return ExprFactory.makeOpExpr(new_op, lhs, rhs); 924 924 } … … 939 939 new_original_name = NodeFactory.makeOpPostfix((Op)op.getOriginalName()); 940 940 941 OpRef new_op = new OpRef(op.getSpan(),op.isParenthesized(),op.get LexicalDepth(),new_original_name,new_ops,op.getStaticArgs());941 OpRef new_op = new OpRef(op.getSpan(),op.isParenthesized(),op.getStaticArgs(),op.getLexicalDepth(),new_original_name,new_ops); 942 942 return ExprFactory.makeOpExpr(e, new_op); 943 943 } -
trunk/ProjectFortress/src/com/sun/fortress/nodes_util/NodeFactory.java
r3082 r3092 1291 1291 1292 1292 public static Expr makeOpRef(OpRef original, int lexicalNestedness) { 1293 return new OpRef(original.getSpan(), original.isParenthesized(), lexicalNestedness, original.getOriginalName(), original.getOps(), original.getStaticArgs());1293 return new OpRef(original.getSpan(), original.isParenthesized(), original.getStaticArgs(), lexicalNestedness, original.getOriginalName(), original.getOps()); 1294 1294 1295 1295 } -
trunk/ProjectFortress/src/com/sun/fortress/parser_util/precedence_resolver/ASTUtil.java
r2236 r3092 109 109 Enclosing en = new Enclosing(s, left, right); 110 110 OpRef ref = new OpRef(s, 111 sargs, 111 112 en, 112 Collections.<OpName>singletonList(en), 113 sargs); 113 Collections.<OpName>singletonList(en)); 114 114 return new OpExpr(span, false, ref, args); 115 115 } else { -
trunk/ProjectFortress/src/com/sun/fortress/tools/FortressAstToConcrete.java
r3082 r3092 1833 1833 1834 1834 @Override public String forFnRefOnly(FnRef that, Option<String> exprType_result, 1835 List<String> staticArgs_result, 1835 1836 String originalName_result, 1836 List<String> fns_result, 1837 List<String> staticArgs_result) { 1837 List<String> fns_result) { 1838 1838 StringBuilder s = new StringBuilder(); 1839 1839 … … 1858 1858 1859 1859 @Override public String forOpRefOnly(OpRef that, Option<String> exprType_result, 1860 List<String> staticArgs_result, 1860 1861 String originalName_result, 1861 List<String> ops_result, 1862 List<String> staticArgs_result) { 1862 List<String> ops_result) { 1863 1863 return handleParen( canonicalOp(originalName_result), 1864 1864 that.isParenthesized() ); … … 1876 1876 public String for_RewriteInstantiatedFnRefsOnly( 1877 1877 _RewriteInstantiatedFnRefs that, Option<String> exprType_result, 1878 String originalName_result, List<String> fns_result,1879 List<String> staticArgs_result, List<String> overloadings_result) {1878 List<String> staticArgs_result, 1879 String originalName_result, List<String> fns_result, List<String> overloadings_result) { 1880 1880 return "(* _RewriteInstantiatedFnRefs *)"; 1881 1881 } … … 1884 1884 public String for_RewriteInstantiatedOpRefsOnly( 1885 1885 _RewriteInstantiatedOpRefs that, Option<String> exprType_result, 1886 String originalName_result, List<String> ops_result,1887 List<String> staticArgs_result, List<String> overloadings_result) {1886 List<String> staticArgs_result, 1887 String originalName_result, List<String> ops_result, List<String> overloadings_result) { 1888 1888 return "(* _RewriteInstantiatedOpRefs *)"; 1889 1889 }

