Changeset 3210
- Timestamp:
- 12/12/08 16:56:30 (12 months ago)
- Location:
- trunk/ProjectFortress
- Files:
-
- 35 modified
-
astgen/Fortress.ast (modified) (13 diffs)
-
build.xml (modified) (1 diff)
-
src/com/sun/fortress/compiler/IndexBuilder.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/desugarer/FreeNameCollection.java (modified) (2 diffs)
-
src/com/sun/fortress/compiler/desugarer/FreeNameCollector.java (modified) (2 diffs)
-
src/com/sun/fortress/compiler/desugarer/ObjectExpressionVisitor.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/desugarer/PreDisambiguationDesugaringVisitor.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/disambiguator/ExprDisambiguator.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/disambiguator/TopLevelEnv.java (modified) (4 diffs)
-
src/com/sun/fortress/compiler/disambiguator/TypeDisambiguator.java (modified) (6 diffs)
-
src/com/sun/fortress/compiler/index/FieldSetterMethod.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/typechecker/FnDeclTypeEnv.java (modified) (2 diffs)
-
src/com/sun/fortress/compiler/typechecker/SubtypeCheckerJUTest.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/typechecker/TraitTable.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/typechecker/TypeAnalyzer.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/typechecker/TypeAnalyzerJUTest.java (modified) (2 diffs)
-
src/com/sun/fortress/compiler/typechecker/TypeCheckerTestCase.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/typechecker/TypeEnv.java (modified) (8 diffs)
-
src/com/sun/fortress/interpreter/glue/NativeApp.java (modified) (1 diff)
-
src/com/sun/fortress/interpreter/rewrite/DesugarerVisitor.java (modified) (3 diffs)
-
src/com/sun/fortress/nodes_util/ExprFactory.java (modified) (1 diff)
-
src/com/sun/fortress/nodes_util/NodeFactory.java (modified) (29 diffs)
-
src/com/sun/fortress/nodes_util/NodeUtil.java (modified) (1 diff)
-
src/com/sun/fortress/nodes_util/OprUtil.java (modified) (3 diffs)
-
src/com/sun/fortress/parser/Function.rats (modified) (2 diffs)
-
src/com/sun/fortress/parser/Identifier.rats (modified) (5 diffs)
-
src/com/sun/fortress/parser/LocalDecl.rats (modified) (2 diffs)
-
src/com/sun/fortress/parser/MayNewlineHeader.rats (modified) (21 diffs)
-
src/com/sun/fortress/parser/Method.rats (modified) (2 diffs)
-
src/com/sun/fortress/parser/MethodParam.rats (modified) (1 diff)
-
src/com/sun/fortress/parser/NoNewlineHeader.rats (modified) (1 diff)
-
src/com/sun/fortress/parser/Syntax.rats (modified) (1 diff)
-
src/com/sun/fortress/parser_util/FortressUtil.java (modified) (1 diff)
-
src/com/sun/fortress/syntax_abstractions/phases/EscapeRewriter.java (modified) (1 diff)
-
src/com/sun/fortress/tests/unit_tests/ConstructorsJUTest.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ProjectFortress/astgen/Fortress.ast
r3206 r3210 415 415 Option<Type> idType) implements Lhs; 416 416 /** 417 * left-hand side of variable declaration 417 * left-hand side of top-level variable declaration, 418 * local variable declaration, or field declaration 418 419 * e.g.) var x: ZZ32 419 420 * Name must be unqualified. … … 1153 1154 * e.g.) throws FailCalled 1154 1155 */ 1155 Effect(Option<List<BaseType>> throwsClause = Option.<List<BaseType>>none(), 1156 boolean ioEffect = false); 1156 Effect(Option<List<BaseType>> throwsClause, boolean ioEffect); 1157 1157 /** 1158 1158 * static argument … … 1198 1198 * static expression 1199 1199 */ 1200 abstract StaticExpr(ignoreForEquals boolean parenthesized = false);1200 abstract StaticExpr(ignoreForEquals boolean parenthesized); 1201 1201 /** 1202 1202 * integer expression … … 1216 1216 * e.g.) m 1217 1217 */ 1218 IntRef(Id name, int lexicalDepth =-2147483648);1218 IntRef(Id name, int lexicalDepth); 1219 1219 /** 1220 1220 * integer expression with an operator … … 1255 1255 * e.g.) ninf 1256 1256 */ 1257 BoolRef(Id name, int lexicalDepth =-2147483648);1257 BoolRef(Id name, int lexicalDepth); 1258 1258 /** 1259 1259 * boolean constraint … … 1306 1306 * e.g.) where { ninf AND NOT nan } 1307 1307 */ 1308 WhereClause(List<WhereBinding> bindings 1309 = Collections.<WhereBinding>emptyList(), 1310 List<WhereConstraint> constraints 1311 = Collections.<WhereConstraint>emptyList()); 1308 WhereClause(List<WhereBinding> bindings, 1309 List<WhereConstraint> constraints); 1312 1310 /** 1313 1311 * hidden type variable binding declared in where clauses … … 1424 1422 * e.g.) requires { n GE 0 } ensures { outcome GE 0 } 1425 1423 */ 1426 Contract(Option<List<Expr>> requiresClause = Option.<List<Expr>>none(), 1427 Option<List<EnsuresClause>> ensuresClause = 1428 Option.<List<EnsuresClause>>none(), 1429 Option<List<Expr>> invariantsClause = Option.<List<Expr>>none()); 1424 Contract(Option<List<Expr>> requiresClause, 1425 Option<List<EnsuresClause>> ensuresClause, 1426 Option<List<Expr>> invariantsClause); 1430 1427 /** 1431 1428 * ensures clause used in contracts … … 1433 1430 * e.g.) sorted(outcome) provided sorted(input) 1434 1431 */ 1435 EnsuresClause(Expr post, Option<Expr> pre = Option.<Expr>none());1432 EnsuresClause(Expr post, Option<Expr> pre); 1436 1433 /** 1437 1434 * static parameter … … 1468 1465 * 1469 1466 */ 1470 APIName(List<Id> ids, 1471 ignoreForEquals String text = com.sun.fortress.useful.Useful.<Id>dottedList(in_ids).intern()); 1467 APIName(List<Id> ids, ignoreForEquals String text); 1472 1468 /** 1473 1469 * non-API name … … 1476 1472 * | opr EncloserPair 1477 1473 */ 1478 abstract IdOrOpOrAnonymousName(Option<APIName> apiName 1479 = Option.<APIName>none()); 1474 abstract IdOrOpOrAnonymousName(Option<APIName> apiName); 1480 1475 /** 1481 1476 * identifier or operator name … … 1542 1537 * because different ops can be chosen for different clauses. 1543 1538 */ 1544 CaseClause(Expr matchClause, Block body, 1545 Option<FunctionalRef> op = Option.<FunctionalRef>none()); 1539 CaseClause(Expr matchClause, Block body, Option<FunctionalRef> op); 1546 1540 /** 1547 1541 * catch clause used in try expressions … … 1604 1598 * e.g.) T[\ninf, nan\] where { ninf AND NOT nan } 1605 1599 */ 1606 TraitTypeWhere(BaseType baseType, 1607 Option<WhereClause> whereClause 1608 = Option.<WhereClause>none()); 1600 TraitTypeWhere(BaseType baseType, Option<WhereClause> whereClause); 1609 1601 /** 1610 1602 * array dimensionality … … 1658 1650 * nonterminal header 1659 1651 */ 1660 NonterminalHeader(Modifiers mods = Modifiers.None,/* Only Modifiers.Private is allowed */1652 NonterminalHeader(Modifiers mods, /* Only Modifiers.Private is allowed */ 1661 1653 Id name, 1662 1654 List<NonterminalParameter> params, 1663 List<StaticParam> staticParams 1664 = Collections.<StaticParam>emptyList(), 1655 List<StaticParam> staticParams, 1665 1656 Option<Type> paramType, 1666 Option<WhereClause> whereClause 1667 = Option.<WhereClause>none()); 1657 Option<WhereClause> whereClause); 1668 1658 1669 1659 /** -
trunk/ProjectFortress/build.xml
r3151 r3210 304 304 <delete file="FortressLibrary.ast"/> 305 305 <delete file="FortressLibrary.tfs"/> 306 <delete file="${basedir}/tests/printing/test_output.txt" /> 306 307 <delete file="testFile.txt"/> 307 308 <delete file="${src}/com/sun/fortress/scala_src/nodes/FortressAst.scala" /> -
trunk/ProjectFortress/src/com/sun/fortress/compiler/IndexBuilder.java
r3206 r3210 195 195 public static ObjectTraitIndex buildObjectExprIndex(ObjectExpr obj) { 196 196 Span fake_span = NodeFactory.makeSpan("FAKE_SPAN"); 197 Id fake_object_name = newId(fake_span, "FAKE_NAME");197 Id fake_object_name = NodeFactory.makeId(fake_span, "FAKE_NAME"); 198 198 IndexBuilder builder = new IndexBuilder(); 199 199 -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/FreeNameCollection.java
r3176 r3210 35 35 import com.sun.fortress.nodes.VarType; 36 36 import com.sun.fortress.nodes_util.NodeUtil; 37 import com.sun.fortress.nodes_util.NodeFactory; 37 38 import com.sun.fortress.useful.Debug; 38 39 … … 131 132 newFreeVarRefs.add(var); 132 133 } else if( NodeUtil.isBoolParam(spOp.unwrap()) ) { 133 this.add( newBoolRef(var.getSpan(), var.getVarId()) );134 this.add( NodeFactory.makeBoolRef(var.getSpan(), var.getVarId()) ); 134 135 } else if( NodeUtil.isIntParam(spOp.unwrap()) ) { 135 this.add( newIntRef(var.getSpan(), var.getVarId()) );136 this.add( NodeFactory.makeIntRef(var.getSpan(), var.getVarId()) ); 136 137 } else if( NodeUtil.isNatParam(spOp.unwrap()) ) { 137 this.add( newIntRef(var.getSpan(), var.getVarId()) );138 this.add( NodeFactory.makeIntRef(var.getSpan(), var.getVarId()) ); 138 139 } else { 139 140 throw new DesugarerError( "Unexpected Static Param type " + -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/FreeNameCollector.java
r3156 r3210 34 34 import com.sun.fortress.nodes.*; 35 35 import com.sun.fortress.nodes_util.Span; 36 import com.sun.fortress.nodes_util.NodeFactory; 36 37 import com.sun.fortress.useful.Debug; 37 38 … … 242 243 enclosingObjectDecl : 243 244 enclosingTraitDecl).unwrap().getSpan(); 244 Option<Type> type = objExprTypeEnv.type( newId(s, "self") );245 Option<Type> type = objExprTypeEnv.type( NodeFactory.makeId(s, "self") ); 245 246 freeNames.setEnclosingSelfType(type); 246 247 } -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/ObjectExpressionVisitor.java
r3202 r3210 833 833 834 834 if( NodeUtil.isBoolParam(sParam) ) { 835 BoolRef boolRef = newBoolRef(span, (Id)sParam.getName());835 BoolRef boolRef = NodeFactory.makeBoolRef(span, (Id)sParam.getName()); 836 836 return new BoolArg(span, boolRef); 837 837 } else if( NodeUtil.isIntParam(sParam) ) { 838 IntRef intRef = newIntRef(span, (Id)sParam.getName());838 IntRef intRef = NodeFactory.makeIntRef(span, (Id)sParam.getName()); 839 839 return new IntArg(span, intRef); 840 840 } else if( NodeUtil.isNatParam(sParam) ) { 841 IntRef intRef = newIntRef(span, (Id)sParam.getName());841 IntRef intRef = NodeFactory.makeIntRef(span, (Id)sParam.getName()); 842 842 return new IntArg(span, intRef); 843 843 } else if( NodeUtil.isTypeParam(sParam) ) { -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/PreDisambiguationDesugaringVisitor.java
r3206 r3210 49 49 public class PreDisambiguationDesugaringVisitor extends NodeUpdateVisitor { 50 50 51 private final Id anyTypeId = newId(NodeFactory.makeSpan("singleton"), WellKnownNames.anyTypeName);51 private final Id anyTypeId = NodeFactory.makeId(NodeFactory.makeSpan("singleton"), WellKnownNames.anyTypeName); 52 52 53 53 /** If the extends clause of a trait declaration, an object declaration, or -
trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/ExprDisambiguator.java
r3206 r3210 299 299 300 300 private ExprDisambiguator extendWithSelf(Span span) { 301 Set<Id> selfSet = Collections.singleton( newId(span, "self"));301 Set<Id> selfSet = Collections.singleton(NodeFactory.makeId(span, "self")); 302 302 return extendWithVars(selfSet); 303 303 } 304 304 305 305 private ExprDisambiguator extendWithOutcome(Span span) { 306 Set<Id> outcomeSet = Collections.singleton( newId(span, "outcome"));306 Set<Id> outcomeSet = Collections.singleton(NodeFactory.makeId(span, "outcome")); 307 307 return extendWithVars(outcomeSet); 308 308 } -
trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/TopLevelEnv.java
r3156 r3210 165 165 Id key = entry.getKey(); 166 166 if (table.containsKey(key)) { 167 table.get(key).add( newId(key.getSpan(),167 table.get(key).add(NodeFactory.makeId(key.getSpan(), 168 168 Option.some(apiEntry.getKey()), 169 169 key.getText())); … … 171 171 } else { 172 172 Set<Id> matches = new HashSet<Id>(); 173 matches.add( newId(key.getSpan(),173 matches.add(NodeFactory.makeId(key.getSpan(), 174 174 Option.some(apiEntry.getKey()), 175 175 key.getText())); … … 236 236 if (fnName instanceof Id ) { 237 237 Id _fnName = (Id)fnName; 238 Id name = newId(_fnName.getSpan(),238 Id name = NodeFactory.makeId(_fnName.getSpan(), 239 239 Option.some(apiEntry.getKey()), 240 240 _fnName.getText()); … … 545 545 546 546 private Id ignoreApi(Id id) { 547 return newId(id.getSpan(), id.getText());547 return NodeFactory.makeId(id.getSpan(), id.getText()); 548 548 } 549 549 -
trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/TypeDisambiguator.java
r3206 r3210 347 347 return p.getKind().accept(new NodeAbstractVisitor<StaticArg>() { 348 348 @Override public StaticArg forKindBool(KindBool k) { 349 return new BoolArg(s, newBoolRef(s, name));349 return new BoolArg(s, NodeFactory.makeBoolRef(s, name)); 350 350 } 351 351 @Override public StaticArg forKindDim(KindDim p) { … … 353 353 } 354 354 @Override public StaticArg forKindInt(KindInt p) { 355 return new IntArg(s, newIntRef(s, name));355 return new IntArg(s, NodeFactory.makeIntRef(s, name)); 356 356 } 357 357 @Override public StaticArg forKindNat(KindNat p) { 358 return new IntArg(s, newIntRef(s, name));358 return new IntArg(s, NodeFactory.makeIntRef(s, name)); 359 359 // TODO: shouldn't there be a NatArg class? 360 360 } … … 363 363 } 364 364 @Override public StaticArg forKindUnit(KindUnit p) { 365 return new UnitArg(s, new UnitRef(s, name));365 return new UnitArg(s, new UnitRef(s, false, name)); 366 366 } 367 367 @Override public StaticArg forKindOp(KindOp p) { … … 559 559 NodeAbstractVisitor<StaticArg> v =new NodeAbstractVisitor<StaticArg>(){ 560 560 @Override public StaticArg forKindBool(KindBool k) { 561 return new BoolArg(arg.getSpan(), newBoolRef(arg.getSpan(), (Id)name));561 return new BoolArg(arg.getSpan(), NodeFactory.makeBoolRef(arg.getSpan(), (Id)name)); 562 562 } 563 563 @Override … … 567 567 @Override 568 568 public StaticArg forKindInt(KindInt k) { 569 return new IntArg(arg.getSpan(), newIntRef(arg.getSpan(), (Id)name));569 return new IntArg(arg.getSpan(), NodeFactory.makeIntRef(arg.getSpan(), (Id)name)); 570 570 } 571 571 @Override 572 572 public StaticArg forKindNat(KindNat k) { 573 return new IntArg(arg.getSpan(), newIntRef(arg.getSpan(), (Id)name));573 return new IntArg(arg.getSpan(), NodeFactory.makeIntRef(arg.getSpan(), (Id)name)); 574 574 } 575 575 @Override … … 580 580 public StaticArg forKindUnit(KindUnit k) { 581 581 return new UnitArg(arg.getSpan(), 582 new UnitRef(arg.getSpan(), (Id)name));582 new UnitRef(arg.getSpan(), false, (Id)name)); 583 583 } 584 584 @Override -
trunk/ProjectFortress/src/com/sun/fortress/compiler/index/FieldSetterMethod.java
r3206 r3210 61 61 Param p = NodeFactory.makeParam(_ast.getSpan(), 62 62 Modifiers.None, 63 newId(_ast.getSpan(), "fakeParamForImplicitSetter"),63 NodeFactory.makeId(_ast.getSpan(), "fakeParamForImplicitSetter"), 64 64 _ast.getIdType()); 65 65 return Collections.singletonList(p); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/FnDeclTypeEnv.java
r3203 r3210 67 67 Id _var = (Id)var; 68 68 if (_var.getApiName().isSome()) 69 return binding( newId(_var.getSpan(), _var.getText()));69 return binding(NodeFactory.makeId(_var.getSpan(), _var.getText())); 70 70 } 71 71 return parent.binding(var); … … 102 102 Id _var = (Id)var; 103 103 if (_var.getApiName().isSome()) 104 return declarationSite( newId(_var.getSpan(), _var.getText()));104 return declarationSite(NodeFactory.makeId(_var.getSpan(), _var.getText())); 105 105 } 106 106 return parent.declarationSite(var); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/SubtypeCheckerJUTest.java
r3184 r3210 390 390 for (String sup : supers) { 391 391 BaseType supT = (BaseType) parseType(sup); 392 extendsClause.add( newTraitTypeWhere(span, supT, Option.<WhereClause>none()));392 extendsClause.add(NodeFactory.makeTraitTypeWhere(span, supT, Option.<WhereClause>none())); 393 393 } 394 394 TraitDecl ast; -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TraitTable.java
r3123 r3210 41 41 public Option<TypeConsIndex> typeCons(Id name) { 42 42 TypeConsIndex result; 43 Id simpleName = newId(NodeFactory.makeSpan(name), name.getText());43 Id simpleName = NodeFactory.makeId(NodeFactory.makeSpan(name), name.getText()); 44 44 // TODO: Shouldn't qualified names only point to APIs? -- Dan 45 45 if (name.getApiName().isNone() || -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeAnalyzer.java
r3202 r3210 355 355 List<BaseType> reduced = reduceDisjuncts(normalThrows.unwrap(), 356 356 _emptyHistory); 357 if (reduced.isEmpty()) { return newEffect(NodeFactory.makeSpan(e), e.isIoEffect()); }357 if (reduced.isEmpty()) { return NodeFactory.makeEffect(NodeFactory.makeSpan(e), e.isIoEffect()); } 358 358 else if (reduced.equals(e.getThrowsClause().unwrap())) { 359 359 return e; -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeAnalyzerJUTest.java
r3203 r3210 463 463 for (String sup : supers) { 464 464 BaseType supT = (BaseType) parseType(sup); 465 extendsClause.add( newTraitTypeWhere(span, supT, Option.<WhereClause>none()));465 extendsClause.add(NodeFactory.makeTraitTypeWhere(span, supT, Option.<WhereClause>none())); 466 466 } 467 467 TraitDecl ast; … … 607 607 608 608 private static Effect parseEffect(String s) { 609 if (s.length() == 0) { return newEffect(span); }609 if (s.length() == 0) { return NodeFactory.makeEffect(span); } 610 610 611 611 boolean io = false; 612 612 s = s.trim(); 613 if (s.equals("io")) { return newEffect(span, true); }613 if (s.equals("io")) { return NodeFactory.makeEffect(span, true); } 614 614 else if (s.startsWith("io ")) { io = true; s = s.substring(3).trim(); } 615 615 else if (s.endsWith(" io")) { io = true; s = s.substring(0, s.length()-3).trim(); } -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeCheckerTestCase.java
r3202 r3210 106 106 for (String sup : supers) { 107 107 BaseType supT = (BaseType) parseType(sup); 108 extendsClause.add( newTraitTypeWhere(span, supT, Option.<WhereClause>none()));108 extendsClause.add(NodeFactory.makeTraitTypeWhere(span, supT, Option.<WhereClause>none())); 109 109 } 110 110 TraitDecl ast = NodeFactory.makeTraitDecl(span, NodeFactory.makeId(name), sparams, -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeEnv.java
r3206 r3210 40 40 import com.sun.fortress.compiler.index.Variable; 41 41 import com.sun.fortress.nodes.AnonymousFnName; 42 import com.sun.fortress.nodes.APIName; 42 43 import com.sun.fortress.nodes.BoolArg; 43 44 import com.sun.fortress.nodes.BoolRef; … … 190 191 result.add(param.getKind().accept(new NodeAbstractVisitor<StaticArg>() { 191 192 public StaticArg forKindBool(KindBool k) { 192 return new BoolArg(new Span(), newBoolRef(new Span(), (Id)name));193 return new BoolArg(new Span(), NodeFactory.makeBoolRef(new Span(), (Id)name)); 193 194 } 194 195 public StaticArg forKindDim(KindDim k) { … … 196 197 } 197 198 public StaticArg forKindInt(KindInt k) { 198 return new IntArg(new Span(), newIntRef(new Span(), (Id)name));199 return new IntArg(new Span(), NodeFactory.makeIntRef(new Span(), (Id)name)); 199 200 } 200 201 public StaticArg forKindNat(KindNat k) { 201 return new IntArg(new Span(), newIntRef(new Span(), (Id)name));202 return new IntArg(new Span(), NodeFactory.makeIntRef(new Span(), (Id)name)); 202 203 } 203 204 public StaticArg forKindType(KindType k) { … … 206 207 } 207 208 public StaticArg forKindUnit(KindUnit k) { 208 return new UnitArg(new Span(), new UnitRef(new Span(), (Id)name));209 return new UnitArg(new Span(), new UnitRef(new Span(), false, (Id)name)); 209 210 } 210 211 public StaticArg forKindOp(KindOp that) { … … 221 222 222 223 static Op removeApi(Op id) { 223 return new Op(id.getSpan(), id.getText(), id.getFixity(), id.isEnclosing()); 224 return new Op(id.getSpan(), Option.<APIName>none(), 225 id.getText(), id.getFixity(), id.isEnclosing()); 224 226 } 225 227 226 228 static IdOrOpOrAnonymousName removeApi(IdOrOpOrAnonymousName id) { 227 229 return id.accept(new NodeDepthFirstVisitor<IdOrOpOrAnonymousName>(){ 228 @Override public IdOrOpOrAnonymousName forId(Id that) { return removeApi(that); } 229 @Override 230 public IdOrOpOrAnonymousName forOp(Op that) { 231 return new Op(that.getSpan(), that.getText(), that.getFixity(), that.isEnclosing()); 232 } 233 @Override 234 public IdOrOpOrAnonymousName forAnonymousFnName(AnonymousFnName that) { 235 return new AnonymousFnName(that.getSpan()); 236 } 237 @Override 238 public IdOrOpOrAnonymousName forConstructorFnName(ConstructorFnName that) { 239 return new ConstructorFnName(that.getSpan(), that.getDef()); 240 } 230 @Override public IdOrOpOrAnonymousName forId(Id that) { return removeApi(that); } 231 @Override 232 public IdOrOpOrAnonymousName forOp(Op that) { 233 return new Op(that.getSpan(), Option.<APIName>none(), 234 that.getText(), that.getFixity(), that.isEnclosing()); 235 } 236 @Override 237 public IdOrOpOrAnonymousName forAnonymousFnName(AnonymousFnName that) { 238 return new AnonymousFnName(that.getSpan(), 239 Option.<APIName>none()); 240 } 241 @Override 242 public IdOrOpOrAnonymousName forConstructorFnName(ConstructorFnName that) { 243 return new ConstructorFnName(that.getSpan(), 244 Option.<APIName>none(), 245 that.getDef()); 246 } 241 247 }); 242 248 } … … 451 457 for (FnDecl decl : decls) { 452 458 overloads.add(genericArrowFromDecl(decl)); 453 mods = mods.combine(decl.getMods());454 459 } 455 460 this.mods = mods; … … 495 500 if( mutable ) 496 501 return true; 502 497 503 return mods.isMutable(); 498 504 } … … 508 514 * Replace all of the inference variables given with their corresponding types. 509 515 */ 510 public abstract TypeEnv replaceAllIVars(Map<_InferenceVarType, Type> ivars);516 public abstract TypeEnv replaceAllIVars(Map<_InferenceVarType, Type> ivars); 511 517 } -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/glue/NativeApp.java
r3182 r3210 114 114 115 115 public <RetType> RetType accept(NodeVisitor<RetType> visitor) { 116 return visitor.forId( newId(NodeFactory.makeSpan(""), ""));116 return visitor.forId(NodeFactory.makeId(NodeFactory.makeSpan(""), "")); 117 117 } 118 118 public void accept(NodeVisitor_void visitor) {} -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/rewrite/DesugarerVisitor.java
r3202 r3210 458 458 if (i > 0) { 459 459 return ExprFactory.makeFieldRef(s, dottedReference(s, i - 1), 460 newId(s,WellKnownNames.secretParentName));460 NodeFactory.makeId(s,WellKnownNames.secretParentName)); 461 461 } else { 462 462 throw new Error("Confusion in member reference numbering."); … … 765 765 Id id = lvb.getName(); 766 766 if ("_".equals(id.getText())) { 767 Id newId = newId(id.getSpan(), WellKnownNames.tempForUnderscore(id));767 Id newId = NodeFactory.makeId(id.getSpan(), WellKnownNames.tempForUnderscore(id)); 768 768 return NodeFactory.makeLValue(lvb, newId); 769 769 } … … 917 917 int element_index = 0; 918 918 for (LValue lv : lhs) { 919 Id newName = newId(at, "$" + element_index);919 Id newName = NodeFactory.makeId(at, "$" + element_index); 920 920 Option<Type> type = lv.getIdType(); 921 921 newdecls.add(new VarDecl(at, Useful.list(lv), -
trunk/ProjectFortress/src/com/sun/fortress/nodes_util/ExprFactory.java
r3202 r3210 675 675 Expr body) { 676 676 return makeFnExpr(span, false, Option.<Type>none(), 677 new AnonymousFnName(span ),677 new AnonymousFnName(span, Option.<APIName>none()), 678 678 Collections.<StaticParam>emptyList(), params, 679 679 returnType, Option.<WhereClause>none(), -
trunk/ProjectFortress/src/com/sun/fortress/nodes_util/NodeFactory.java
r3206 r3210 284 284 return makeFnDecl(span, mods, name, staticParams, params, returnType, 285 285 throwsC, whereC, contract, 286 newId(span, "FN$"+span.toString()),286 makeId(span, "FN$"+span.toString()), 287 287 Option.<Expr>none(), Option.<Id>none()); 288 288 } … … 299 299 return makeFnDecl(span, mods, name, staticParams, params, returnType, 300 300 throwsC, whereC, contract, 301 newId(span, "FN$"+span.toString()),301 makeId(span, "FN$"+span.toString()), 302 302 body, Option.<Id>none()); 303 303 } … … 491 491 public static Param makeAbsParam(Type type) { 492 492 return makeParam(type.getSpan(), Modifiers.None, 493 newId(type.getSpan(), "_"), type);493 makeId(type.getSpan(), "_"), type); 494 494 } 495 495 … … 792 792 } 793 793 794 /***************************************************************************/ 795 796 797 public static Id makeTemporaryId() { 798 return makeId("$$bogus_name$$"); 799 } 800 801 public static Op makeTemporaryOp() { 802 return makeOp("$$bogus_name$$"); 794 /** Create an "empty" effect at the given location. */ 795 public static Effect makeEffect(SourceLoc loc) { 796 return makeEffect(new Span(loc, loc)); 797 } 798 799 public static Effect makeEffect(Span span) { 800 return makeEffect(span, Option.<List<BaseType>>none(), false); 801 } 802 803 public static Effect makeEffect(List<BaseType> throwsClause) { 804 return makeEffect(FortressUtil.spanAll(throwsClause), 805 Option.some(throwsClause), false); 806 } 807 808 public static Effect makeEffect(SourceLoc defaultLoc, List<BaseType> throwsClause) { 809 return makeEffect(FortressUtil.spanAll(defaultLoc, throwsClause), 810 Option.some(throwsClause), false); 811 } 812 813 public static Effect makeEffect(Option<List<BaseType>> throwsClause) { 814 Span span = FortressUtil.spanAll(throwsClause.unwrap(Collections.<BaseType>emptyList())); 815 return makeEffect(span, throwsClause, false); 816 } 817 818 public static Effect makeEffect(SourceLoc defaultLoc, Option<List<BaseType>> throwsClause) { 819 Span span = FortressUtil.spanAll(defaultLoc, 820 throwsClause.unwrap(Collections.<BaseType>emptyList())); 821 return makeEffect(span, throwsClause, false); 822 } 823 824 public static Effect makeEffect(Span span, boolean ioEffect) { 825 return new Effect(span, Option.<List<BaseType>>none(), ioEffect); 826 } 827 828 829 public static Effect makeEffect(Span span, Option<List<BaseType>> throwsC, 830 boolean ioEffect) { 831 return new Effect(span, throwsC, ioEffect); 832 } 833 834 public static TraitTypeWhere makeTraitTypeWhere(BaseType in_type) { 835 Span sp = in_type.getSpan(); 836 return makeTraitTypeWhere(sp, in_type, 837 Option.<WhereClause>none()); 838 } 839 840 public static TraitTypeWhere makeTraitTypeWhere(BaseType in_type, Option<WhereClause> in_where) { 841 if ( in_where.isSome() ) 842 return makeTraitTypeWhere(new Span(in_type.getSpan(), in_where.unwrap().getSpan()), in_type, in_where); 843 else 844 return makeTraitTypeWhere(in_type.getSpan(), in_type, in_where); 845 } 846 847 public static TraitTypeWhere makeTraitTypeWhere(Span span, BaseType type, 848 Option<WhereClause> where) { 849 return new TraitTypeWhere(span, type, where); 850 } 851 852 public static ConstructorFnName makeConstructorFnName(GenericWithParams def) { 853 return new ConstructorFnName(def.getSpan(), Option.<APIName>none(), def); 854 } 855 856 public static Id makeId(Span span, String name) { 857 return makeId(span, Option.<APIName>none(), name); 858 } 859 860 public static Id makeId(Span span, Option<APIName> apiName, String text) { 861 return new Id(span, apiName, text); 862 } 863 864 865 public static Id bogusId(Span span) { 866 return makeId(span, Option.<APIName>none(), "_"); 867 } 868 869 public static Id makeId(Id id, String newName) { 870 return makeId(id.getSpan(), id.getApiName(), newName); 871 } 872 873 public static Id makeId(Span span, Id id) { 874 return makeId(span, id.getApiName(), id.getText()); 875 } 876 877 public static Id makeId(Iterable<Id> apiIds, Id id) { 878 Span span; 879 Option<APIName> api; 880 if (IterUtil.isEmpty(apiIds)) { 881 span = id.getSpan(); 882 api = Option.none(); 883 } 884 else { 885 APIName n = makeAPIName(apiIds); 886 span = FortressUtil.spanTwo(n, id); 887 api = Option.some(n); 888 } 889 return makeId(span, api, id.getText()); 890 } 891 892 public static Id makeId(Span span, String api, String name) { 893 List<Id> apis = new ArrayList<Id>(); 894 apis.add(makeId(span, api)); 895 apis = Useful.immutableTrimmedList(apis); 896 return makeId(span, Option.some(makeAPIName(span, apis)), name); 897 } 898 899 public static Id makeId(Span span, Iterable<Id> apiIds, Id id) { 900 Option<APIName> api; 901 if (IterUtil.isEmpty(apiIds)) { api = Option.none(); } 902 else { api = Option.some(makeAPIName(apiIds)); } 903 return makeId(span, api, id.getText()); 904 } 905 906 public static Id makeId(Span span, Id id, Iterable<Id> ids) { 907 Option<APIName> api; 908 Id last; 909 if (IterUtil.isEmpty(ids)) { api = Option.none(); last = id; } 910 else { api = Option.some(makeAPIName(id, IterUtil.skipLast(ids))); 911 last = IterUtil.last(ids); 912 } 913 return makeId(span, api, last.getText()); 914 } 915 916 public static Id makeId(Span span, APIName api, Id id) { 917 return makeId(span, Option.some(api), id.getText()); 918 } 919 920 /** Assumes {@code ids} is nonempty. */ 921 public static Id makeId(Iterable<Id> ids) { 922 return makeId(IterUtil.skipLast(ids), IterUtil.last(ids)); 923 } 924 925 public static Id makeId(String nameFirst, String... nameRest) { 926 Iterable<Id> ids = IterUtil.compose(makeId(nameFirst), 927 IterUtil.map(IterUtil.asIterable(nameRest), STRING_TO_ID)); 928 return makeId(ids); 929 } 930 931 public static Id makeId(APIName api, Id name) { 932 return makeId(FortressUtil.spanTwo(api, name), Option.some(api), 933 name.getText()); 934 } 935 936 public static Id makeId(APIName api, Id name, Span span) { 937 return makeId(span, Option.some(api), name.getText()); 938 } 939 940 public static Id makeId(Option<APIName> api, Id name) { 941 return makeId(name.getSpan(), api, name.getText()); 942 } 943 944 public static Id makeId(Span span, APIName api, String name) { 945 return makeId(span, Option.some(api), name); 946 } 947 948 public static Id makeId(String string) { 949 return makeId(new Span(), string); 803 950 } 804 951 … … 813 960 } 814 961 ids = Useful.immutableTrimmedList(ids); 815 return newAPIName(FortressUtil.spanTwo(first, last), ids);962 return makeAPIName(FortressUtil.spanTwo(first, last), ids); 816 963 } 817 964 … … 822 969 ids.addAll(rest.getApiName().unwrap().getIds()); 823 970 } 824 ids.add( newId(rest.getSpan(), rest.getText()));971 ids.add(makeId(rest.getSpan(), rest.getText())); 825 972 ids = Useful.immutableTrimmedList(ids); 826 return new APIName(FortressUtil.spanTwo(first, rest), ids); 973 return makeAPIName(FortressUtil.spanTwo(first, rest), ids); 974 } 975 976 public static APIName makeAPIName(Span span, List<Id> apis) { 977 return makeAPIName(span, apis, Useful.<Id>dottedList(apis).intern()); 978 } 979 980 public static APIName makeAPIName(Span span, String s) { 981 return makeAPIName(span, Useful.list(makeId(span, s))); 982 } 983 984 public static APIName makeAPIName(Span span, Id s) { 985 return makeAPIName(span, Useful.list(s)); 986 } 987 988 public static APIName makeAPIName(Id s) { 989 return makeAPIName(s.getSpan(), Useful.list(s)); 990 } 991 992 public static APIName makeAPIName(Span span, List<Id> apis, String text) { 993 return new APIName(span, apis, text); 994 } 995 996 public static APIName makeAPIName(String s) { 997 return makeAPIName(stringToIds(s)); 998 } 999 1000 public static APIName makeAPIName(Iterable<Id> ids) { 1001 return makeAPIName(FortressUtil.spanAll(ids), CollectUtil.makeList(ids)); 1002 } 1003 1004 public static APIName makeAPIName(Id id, Iterable<Id> ids) { 1005 return makeAPIName(CollectUtil.makeList(IterUtil.compose(id, ids))); 1006 } 1007 1008 public static APIName makeAPIName(Span span, Iterable<Id> ids) { 1009 return makeAPIName(span, CollectUtil.makeList(ids)); 1010 } 1011 1012 public static BoolRef makeBoolRef(String string) { 1013 return makeBoolRef(new Span(), false, makeId(string), lexicalDepth); 1014 } 1015 1016 public static BoolRef makeBoolRef(BoolRef old, int depth) { 1017 return makeBoolRef(old.getSpan(), old.isParenthesized(), old.getName(), depth); 1018 } 1019 1020 public static BoolRef makeBoolRef(Span span, Id name) { 1021 return makeBoolRef(span, false, name, lexicalDepth); 1022 } 1023 1024 public static BoolRef makeBoolRef(Span span, boolean parenthesized, 1025 Id name, int depth) { 1026 return new BoolRef(span, parenthesized, name, depth); 1027 } 1028 1029 public static BoolBinaryOp makeBoolBinaryOp(Span span, 1030 BoolExpr left, BoolExpr right, Op op) { 1031 return makeBoolBinaryOp(span, false, left, right, op); 1032 } 1033 1034 public static BoolBinaryOp makeBoolBinaryOp(Span span, boolean parenthesized, 1035 BoolExpr left, BoolExpr right, Op op) { 1036 return new BoolBinaryOp(span, parenthesized, left, right, op); 1037 } 1038 1039 public static IntBinaryOp makeIntBinaryOp(Span span, 1040 IntExpr left, IntExpr right, Op op) { 1041 return makeIntBinaryOp(span, false, left, right, op); 1042 } 1043 1044 public static IntBinaryOp makeIntBinaryOp(Span span, boolean parenthesized, 1045 IntExpr left, IntExpr right, Op op) { 1046 return new IntBinaryOp(span, parenthesized, left, right, op); 1047 } 1048 1049 public static IntRef makeIntRef(String string) { 1050 return makeIntRef(new Span(), makeId(string)); 1051 } 1052 1053 public static IntRef makeIntRef(IntRef old, int depth) { 1054 return makeIntRef(old.getSpan(), old.isParenthesized(), old.getName(), depth); 1055 } 1056 1057 public static IntRef makeIntRef(Span span, Id name) { 1058 return new IntRef(span, false, name, lexicalDepth); 1059 } 1060 1061 public static IntRef makeIntRef(Span span, boolean parenthesized, 1062 Id name, int depth) { 1063 return new IntRef(span, parenthesized, name, depth); 1064 } 1065 1066 /***************************************************************************/ 1067 1068 1069 public static Id makeTemporaryId() { 1070 return makeId("$$bogus_name$$"); 1071 } 1072 1073 public static Op makeTemporaryOp() { 1074 return makeOp("$$bogus_name$$"); 827 1075 } 828 1076 829 1077 public static Id makeIdFromLast(Id id) { 830 return new Id(id.getSpan(), id.getText()); 831 } 832 833 public static TraitTypeWhere makeTraitTypeWhere(BaseType in_type) { 834 Span sp = in_type.getSpan(); 835 return new TraitTypeWhere(sp, in_type, 836 Option.<WhereClause>none()); 837 } 838 839 public static TraitTypeWhere makeTraitTypeWhere(BaseType in_type, Option<WhereClause> in_where) { 840 if ( in_where.isSome() ) 841 return new TraitTypeWhere(new Span(in_type.getSpan(), in_where.unwrap().getSpan()), in_type, in_where); 842 else 843 return new TraitTypeWhere(in_type.getSpan(), in_type, in_where); 1078 return makeId(id.getSpan(), id.getText()); 844 1079 } 845 1080 … … 865 1100 866 1101 public static UnitRef makeUnitRef(Span span, String name) { 867 return new UnitRef(span, makeId(name));1102 return new UnitRef(span, false, makeId(name)); 868 1103 } 869 1104 … … 883 1118 } 884 1119 885 /** Create an "empty" effect at the given location. */886 public static Effect makeEffect(SourceLoc loc) {887 return new Effect(new Span(loc, loc));888 }889 890 public static Effect makeEffect(List<BaseType> throwsClause) {891 return new Effect(FortressUtil.spanAll(throwsClause), Option.some(throwsClause));892 }893 894 public static Effect makeEffect(SourceLoc defaultLoc, List<BaseType> throwsClause) {895 return new Effect(FortressUtil.spanAll(defaultLoc, throwsClause),896 Option.some(throwsClause));897 }898 899 public static Effect makeEffect(Option<List<BaseType>> throwsClause) {900 Span span = FortressUtil.spanAll(throwsClause.unwrap(Collections.<BaseType>emptyList()));901 return new Effect(span, throwsClause);902 }903 904 public static Effect makeEffect(SourceLoc defaultLoc, Option<List<BaseType>> throwsClause) {905 Span span = FortressUtil.spanAll(defaultLoc,906 throwsClause.unwrap(Collections.<BaseType>emptyList()));907 return new Effect(span, throwsClause);908 }909 910 1120 public static KeywordType makeKeywordType(Id name, Type type) { 911 1121 return new KeywordType(new Span(), name, type); 912 }913 914 public static ConstructorFnName makeConstructorFnName(GenericWithParams def) {915 return new ConstructorFnName(def.getSpan(), def);916 }917 918 public static APIName makeAPIName(Span span, String s) {919 return new APIName(span, Useful.list(new Id(span, s)));920 }921 922 public static APIName makeAPIName(Span span, Id s) {923 return new APIName(span, Useful.list(s));924 }925 926 public static APIName makeAPIName(Id s) {927 return new APIName(s.getSpan(), Useful.list(s));928 1122 } 929 1123 … … 940 1134 } 941 1135 942 public static APIName makeAPIName(String s) {943 return makeAPIName(stringToIds(s));944 }945 946 public static APIName makeAPIName(Iterable<Id> ids) {947 return new APIName(FortressUtil.spanAll(ids), CollectUtil.makeList(ids));948 }949 950 public static APIName makeAPIName(Id id, Iterable<Id> ids) {951 return makeAPIName(CollectUtil.makeList(IterUtil.compose(id, ids)));952 }953 954 public static APIName makeAPIName(Span span, Iterable<Id> ids) {955 return new APIName(span, CollectUtil.makeList(ids));956 }957 958 1136 /** 959 1137 * Create a APIName from the name of the file with the given path. … … 975 1153 String file = new File(path).getName(); 976 1154 if (file.length() <= 4) { 977 return error( newId(span, "_"), "Invalid file name.");1155 return error(makeId(span, "_"), "Invalid file name."); 978 1156 } 979 1157 for (String n : file.substring(0, file.length()-4).split(delimiter)) { 980 ids.add( newId(span, n));1158 ids.add(makeId(span, n)); 981 1159 } 982 1160 ids = Useful.immutableTrimmedList(ids); 983 return new APIName(span, ids); 984 } 985 986 public static Id bogusId(Span span) { 987 return new Id(span, Option.<APIName>none(), "_"); 988 } 989 990 public static Id makeId(Id id, String newName) { 991 return new Id(id.getSpan(), id.getApiName(), newName); 992 } 993 994 public static Id makeId(Span span, String s) { 995 return new Id(span, Option.<APIName>none(), s); 996 } 997 998 public static Id makeId(Span span, Id id) { 999 return new Id(span, id.getApiName(), id.getText()); 1000 } 1001 1002 public static Id makeId(Iterable<Id> apiIds, Id id) { 1003 Span span; 1004 Option<APIName> api; 1005 if (IterUtil.isEmpty(apiIds)) { 1006 span = id.getSpan(); 1007 api = Option.none(); 1008 } 1009 else { 1010 APIName n = makeAPIName(apiIds); 1011 span = FortressUtil.spanTwo(n, id); 1012 api = Option.some(n); 1013 } 1014 return new Id(span, api, id.getText()); 1015 } 1016 1017 public static Id makeId(Span span, String api, String name) { 1018 List<Id> apis = new ArrayList<Id>(); 1019 apis.add(makeId(span, api)); 1020 apis = Useful.immutableTrimmedList(apis); 1021 return new Id(span, Option.some(new APIName(span, apis)), name); 1022 } 1023 1024 public static Id makeId(Span span, Iterable<Id> apiIds, Id id) { 1025 Option<APIName> api; 1026 if (IterUtil.isEmpty(apiIds)) { api = Option.none(); } 1027 else { api = Option.some(makeAPIName(apiIds)); } 1028 return new Id(span, api, id.getText()); 1029 } 1030 1031 public static Id makeId(Span span, Id id, Iterable<Id> ids) { 1032 Option<APIName> api; 1033 Id last; 1034 if (IterUtil.isEmpty(ids)) { api = Option.none(); last = id; } 1035 else { api = Option.some(makeAPIName(id, IterUtil.skipLast(ids))); 1036 last = IterUtil.last(ids); 1037 } 1038 return new Id(span, api, last.getText()); 1039 } 1040 1041 public static Id makeId(Span span, APIName api, Id id) { 1042 return new Id(span, Option.some(api), id.getText()); 1043 } 1044 1045 /** Assumes {@code ids} is nonempty. */ 1046 public static Id makeId(Iterable<Id> ids) { 1047 return makeId(IterUtil.skipLast(ids), IterUtil.last(ids)); 1048 } 1049 1050 public static Id makeId(String nameFirst, String... nameRest) { 1051 Iterable<Id> ids = IterUtil.compose(makeId(nameFirst), 1052 IterUtil.map(IterUtil.asIterable(nameRest), STRING_TO_ID)); 1053 return makeId(ids); 1054 } 1055 1056 public static Id makeId(APIName api, Id name) { 1057 return new Id(FortressUtil.spanTwo(api, name), Option.some(api), 1058 name.getText()); 1059 } 1060 1061 public static Id makeId(APIName api, Id name, Span span) { 1062 return new Id(span, Option.some(api), name.getText()); 1063 } 1064 1065 public static Id makeId(Option<APIName> api, Id name) { 1066 return new Id(name.getSpan(), api, name.getText()); 1067 } 1068 1069 public static Id makeId(Span span, APIName api, String name) { 1070 return new Id(span, Option.some(api), name); 1071 } 1072 1073 public static Id makeId(String string) { 1074 return new Id(new Span(), string); 1161 return makeAPIName(span, ids); 1075 1162 } 1076 1163 … … 1080 1167 1081 1168 public static Op makeEnclosing(Span in_span, String in_open, String in_close) { 1082 return new Op(in_span, PrecedenceMap.ONLY.canon(in_open + " " + in_close), 1169 return new Op(in_span, Option.<APIName>none(), 1170 PrecedenceMap.ONLY.canon(in_open + " " + in_close), 1083 1171 enclosing, true); 1084 1172 } … … 1095 1183 1096 1184 public static Op makeOp(String name) { 1097 return new Op(new Span(), PrecedenceMap.ONLY.canon(name), unknownFix, false); 1185 return new Op(new Span(), Option.<APIName>none(), 1186 PrecedenceMap.ONLY.canon(name), unknownFix, false); 1098 1187 } 1099 1188 1100 1189 public static Op makeOp(Span span, String name) { 1101 return new Op(span, PrecedenceMap.ONLY.canon(name), unknownFix, false); 1190 return new Op(span, Option.<APIName>none(), 1191 PrecedenceMap.ONLY.canon(name), unknownFix, false); 1102 1192 } 1103 1193 1104 1194 public static Op makeOp(Span span, String name, Fixity fixity) { 1105 return new Op(span, PrecedenceMap.ONLY.canon(name), fixity, false); 1195 return new Op(span, Option.<APIName>none(), 1196 PrecedenceMap.ONLY.canon(name), fixity, false); 1106 1197 } 1107 1198 1108 1199 public static Op makeOp(Op op, String name) { 1109 return new Op(op.getSpan(), PrecedenceMap.ONLY.canon(name), 1200 return new Op(op.getSpan(), Option.<APIName>none(), 1201 PrecedenceMap.ONLY.canon(name), 1110 1202 op.getFixity(), op.isEnclosing()); 1111 1203 } 1112 1204 1113 1205 public static Op makeOpInfix(Span span, String name) { 1114 return new Op(span, PrecedenceMap.ONLY.canon(name), infix, false); 1206 return new Op(span, Option.<APIName>none(), 1207 PrecedenceMap.ONLY.canon(name), infix, false); 1115 1208 } 1116 1209 … … 1127 1220 1128 1221 public static Op makeOpPrefix(Span span, String name) { 1129 return new Op(span, PrecedenceMap.ONLY.canon(name), prefix, false); 1222 return new Op(span, Option.<APIName>none(), 1223 PrecedenceMap.ONLY.canon(name), prefix, false); 1130 1224 } 1131 1225 … … 1135 1229 1136 1230 public static Op makeOpPostfix(Span span, String name) { 1137 return new Op(span, PrecedenceMap.ONLY.canon(name), postfix, false); 1231 return new Op(span, Option.<APIName>none(), 1232 PrecedenceMap.ONLY.canon(name), postfix, false); 1138 1233 } 1139 1234 … … 1152 1247 1153 1248 public static Op makeOpNofix(Op op) { 1154 return new Op(op.getSpan(), op.getText(), nofix, op.isEnclosing()); 1249 return new Op(op.getSpan(), Option.<APIName>none(), 1250 op.getText(), nofix, op.isEnclosing()); 1155 1251 } 1156 1252 1157 1253 public static Op makeOpMultifix(Op op) { 1158 return new Op(op.getSpan(), op.getText(), multifix, op.isEnclosing()); 1254 return new Op(op.getSpan(), Option.<APIName>none(), 1255 op.getText(), multifix, op.isEnclosing()); 1159 1256 } 1160 1257 1161 1258 public static Op makeOpEnclosing(Span span, String name) { 1162 return new Op(span, PrecedenceMap.ONLY.canon(name), enclosing, false); 1259 return new Op(span, Option.<APIName>none(), 1260 PrecedenceMap.ONLY.canon(name), enclosing, false); 1163 1261 } 1164 1262 1165 1263 public static Op makeOpBig(Span span, String name) { 1166 return new Op(span, PrecedenceMap.ONLY.canon(name), big, false); 1264 return new Op(span, Option.<APIName>none(), 1265 PrecedenceMap.ONLY.canon(name), big, false); 1167 1266 } 1168 1267 1169 1268 public static Op makeOpUnknown(Span span, String name) { 1170 return new Op(span, PrecedenceMap.ONLY.canon(name), unknownFix, false); 1269 return new Op(span, Option.<APIName>none(), 1270 PrecedenceMap.ONLY.canon(name), unknownFix, false); 1171 1271 } 1172 1272 … … 1179 1279 return makeEnclosing(op.getSpan(), left, right); 1180 1280 } else 1181 return new Op(op.getSpan(), PrecedenceMap.ONLY.canon("BIG " + op.getText()), big, op.isEnclosing() ); 1281 return new Op(op.getSpan(), Option.<APIName>none(), 1282 PrecedenceMap.ONLY.canon("BIG " + op.getText()), big, op.isEnclosing() ); 1182 1283 } 1183 1284 1184 1285 public static StaticParam makeTypeParam(String name) { 1185 1286 Span s = new Span(); 1186 return new StaticParam(s, newId(s, name),1287 return new StaticParam(s, makeId(s, name), 1187 1288 Collections.<BaseType>emptyList(), 1188 1289 Option.<Type>none(), false, … … 1194 1295 List<BaseType> supers = new ArrayList<BaseType>(1); 1195 1296 supers.add(makeVarType(sup)); 1196 return new StaticParam(s, newId(s, name), supers,1297 return new StaticParam(s, makeId(s, name), supers, 1197 1298 Option.<Type>none(), false, 1198 1299 new KindType()); … … 1208 1309 public static StaticParam makeBoolParam(String name) { 1209 1310 Span s = new Span(); 1210 return new StaticParam(s, newId(s, name),1311 return new StaticParam(s, makeId(s, name), 1211 1312 Collections.<BaseType>emptyList(), 1212 1313 Option.<Type>none(), false, … … 1216 1317 public static StaticParam makeDimParam(String name) { 1217 1318 Span s = new Span(); 1218 return new StaticParam(s, newId(s, name),1319 return new StaticParam(s, makeId(s, name), 1219 1320 Collections.<BaseType>emptyList(), 1220 1321 Option.<Type>none(), false, … … 1224 1325 public static StaticParam makeUnitParam(String name) { 1225 1326 Span s = new Span(); 1226 return new StaticParam(s, newId(s, name),1327 return new StaticParam(s, makeId(s, name), 1227 1328 Collections.<BaseType>emptyList(), 1228 1329 Option.<Type>none(), false, … … 1232 1333 public static StaticParam makeIntParam(String name) { 1233 1334 Span s = new Span(); 1234 return new StaticParam(s, newId(s, name),1335 return new StaticParam(s, makeId(s, name), 1235 1336 Collections.<BaseType>emptyList(), 1236 1337 Option.<Type>none(), false, … … 1240 1341 public static StaticParam makeNatParam(String name) { 1241 1342 Span s = new Span(); 1242 return new StaticParam(s, newId(s, name),1343 return new StaticParam(s, makeId(s, name), 1243 1344 Collections.<BaseType>emptyList(), 1244 1345 Option.<Type>none(), false, … … 1266 1367 } 1267 1368 1268 public static BoolRef makeBoolRef(String string) {1269 return new BoolRef(new Span(), makeId(string));1270 }1271 1369 1272 1370 public static BoolArg makeBoolArg(String string) { … … 1274 1372 } 1275 1373 1276 public static IntRef makeIntRef(String string) {1277 return new IntRef(new Span(), makeId(string));1278 }1279 1280 1374 public static IntExpr makeIntVal(String i) { 1281 1375 Span span = new Span(); 1282 return new IntBase(span, ExprFactory.makeIntLiteralExpr(span, 1283 new BigInteger(i))); 1376 return new IntBase(span, false, 1377 ExprFactory.makeIntLiteralExpr(span, 1378 new BigInteger(i))); 1284 1379 } 1285 1380 … … 1319 1414 1320 1415 public static VarDecl makeVarDecl(Span span, String name, Expr init) { 1321 Id id = newId(span, name);1416 Id id = makeId(span, name); 1322 1417 FortressUtil.validId(id); 1323 1418 LValue bind = new LValue(span, id, … … 1333 1428 } 1334 1429 public BoolExpr forBoolRef(BoolRef b) { 1335 return new BoolRef(b.getSpan(), true, b.getName());1430 return makeBoolRef(b.getSpan(), true, b.getName(), b.getLexicalDepth()); 1336 1431 } 1337 1432 public BoolExpr forBoolUnaryOp(BoolUnaryOp b) { … … 1339 1434 } 1340 1435 public BoolExpr forBoolBinaryOp(BoolBinaryOp b) { 1341 return newBoolBinaryOp(b.getSpan(), true,1436 return makeBoolBinaryOp(b.getSpan(), true, 1342 1437 b.getLeft(), b.getRight(), b.getOp()); 1343 1438 } … … 1381 1476 } 1382 1477 public IntExpr forIntRef(IntRef i) { 1383 return new IntRef(i.getSpan(), true, i.getName());1478 return makeIntRef(i.getSpan(), true, i.getName(), i.getLexicalDepth()); 1384 1479 } 1385 1480 public IntExpr forIntBinaryOp(IntBinaryOp i) { 1386 return newIntBinaryOp(i.getSpan(), true, i.getLeft(),1481 return makeIntBinaryOp(i.getSpan(), true, i.getLeft(), 1387 1482 i.getRight(), i.getOp()); 1388 1483 } … … 1467 1562 public static Import makeImportStar(APIName api, List<IdOrOpOrAnonymousName> excepts) { 1468 1563 return new ImportStar(makeSpan(api, excepts), Option.<String>none(), api, excepts); 1469 }1470 1471 public static BoolRef makeBoolRef(BoolRef old, int depth) {1472 return new BoolRef(old.getSpan(), old.isParenthesized(), old.getName(), depth);1473 }1474 1475 1476 public static IntRef makeIntRef(IntRef old, int depth) {1477 return new IntRef(old.getSpan(), old.isParenthesized(), old.getName(), depth);1478 1564 } 1479 1565 -
trunk/ProjectFortress/src/com/sun/fortress/nodes_util/NodeUtil.java
r3206 r3210 543 543 public static final Fn<String, Id> StringToIdFn = new Fn<String, Id>() { 544 544 public Id apply(String x) { 545 return newId(new Span(), x);545 return NodeFactory.makeId(new Span(), x); 546 546 } 547 547 }; -
trunk/ProjectFortress/src/com/sun/fortress/nodes_util/OprUtil.java
r3132 r3210 18 18 package com.sun.fortress.nodes_util; 19 19 20 import com.sun.fortress.nodes.APIName; 20 21 import com.sun.fortress.nodes.Fixity; 21 22 import com.sun.fortress.nodes.Node; … … 139 140 /** Return a new operator with the fixity prepended to the text. */ 140 141 public static Op decorateOperator(Op o) { 141 return new Op(o.getSpan(), fixityDecorator(o.getFixity(), o.getText()), o.getFixity(), o.isEnclosing()); 142 return new Op(o.getSpan(), Option.<APIName>none(), 143 fixityDecorator(o.getFixity(), o.getText()), 144 o.getFixity(), o.isEnclosing()); 142 145 } 143 146 … … 148 151 return o; 149 152 } 150 return new Op(o.getSpan(), o.getText().substring(i+1), o.getFixity(), o.isEnclosing()); 153 return new Op(o.getSpan(), Option.<APIName>none(), 154 o.getText().substring(i+1), 155 o.getFixity(), o.isEnclosing()); 151 156 } 152 157 -
trunk/ProjectFortress/src/com/sun/fortress/parser/Function.rats
r3206 r3210 62 62 TupleType _d = (TupleType)d; 63 63 for (Type argT : _d.getElements()) { 64 Id name = newId(argT.getSpan(), "_");64 Id name = NodeFactory.makeId(argT.getSpan(), "_"); 65 65 params.add(NodeFactory.makeParam(argT.getSpan(), mods, name, argT)); 66 66 } 67 67 if (_d.getVarargs().isSome()) { 68 68 Type argT = _d.getVarargs().unwrap(); 69 Id name = newId(argT.getSpan(), "_");69 Id name = NodeFactory.makeId(argT.getSpan(), "_"); 70 70 params.add(NodeFactory.makeVarargsParam(argT.getSpan(), mods, name, argT)); 71 71 } … … 74 74 75 75 } else { 76 Id name = newId(d.getSpan(), "_");76 Id name = NodeFactory.makeId(d.getSpan(), "_"); 77 77 params.add(NodeFactory.makeParam(d.getSpan(), mods, name, d)); 78 78 } -
trunk/ProjectFortress/src/com/sun/fortress/parser/Identifier.rats
r3132 r3210 53 53 54 54 Id Id = 55 <FIRST> a1:IdText { yyValue = newId(createSpan(yyStart,yyCount), a1); };55 <FIRST> a1:IdText { yyValue = NodeFactory.makeId(createSpan(yyStart,yyCount), a1); }; 56 56 57 57 /* IdOrOpName ::= Id | OpName */ … … 61 61 Id BindId = 62 62 Id 63 / a1:"_" { yyValue = newId(createSpan(yyStart,yyCount), a1); };63 / a1:"_" { yyValue = NodeFactory.makeId(createSpan(yyStart,yyCount), a1); }; 64 64 65 65 /* BindIdList ::= BindId (w , w BindId)* */ … … 101 101 yyValue = NodeFactory.makeAPIName(span, bogusId); 102 102 } else if (FortressUtil.validId(a1)) 103 yyValue = NodeFactory.makeAPIName(span, newId(span, a1));103 yyValue = NodeFactory.makeAPIName(span, NodeFactory.makeId(span, a1)); 104 104 else if (FortressUtil.validOp(a1)) { 105 105 log(span, a1 + " is not a valid Fortress identifier."); … … 112 112 / a1:idOrKeyword a2s:(dot idOrKeyword)* &(w ellipses) 113 113 { Span span = createSpan(yyStart,yyCount); 114 List<Id> ids = CollectUtil.makeList(IterUtil.compose( newId(span, a1),114 List<Id> ids = CollectUtil.makeList(IterUtil.compose(NodeFactory.makeId(span, a1), 115 115 IterUtil.map(a2s.list(), 116 116 NodeUtil.StringToIdFn))); … … 133 133 / a1:idOrKeyword a2s:(dot idOrKeyword)* 134 134 { Span span = createSpan(yyStart,yyCount); 135 List<Id> ids = CollectUtil.makeList(IterUtil.compose( newId(span, a1),135 List<Id> ids = CollectUtil.makeList(IterUtil.compose(NodeFactory.makeId(span, a1), 136 136 IterUtil.map(a2s.list(), 137 137 NodeUtil.StringToIdFn))); -
trunk/ProjectFortress/src/com/sun/fortress/parser/LocalDecl.rats
r3206 r3210 196 196 / Unpasting 197 197 { Span span = createSpan(yyStart,yyCount); 198 yyValue = NodeFactory.makeLValue(span, newId(span, "_"));198 yyValue = NodeFactory.makeLValue(span, NodeFactory.makeId(span, "_")); 199 199 }; 200 200 … … 227 227 /* CaseClause ::= NoNewlineExpr w => w BlockElems */ 228 228 CaseClause CaseClause = a1:NoNewlineExpr w match w a2:BlockElems 229 { yyValue = new CaseClause(createSpan(yyStart,yyCount), a1, a2); }; 229 { yyValue = new CaseClause(createSpan(yyStart,yyCount), a1, a2, 230 Option.<FunctionalRef>none()); 231 }; -
trunk/ProjectFortress/src/com/sun/fortress/parser/MayNewlineHeader.rats
r3170 r3210 122 122 transient IntExpr IntVal = 123 123 a1:IntLiteralExpr 124 { yyValue = new IntBase(createSpan(yyStart,yyCount), a1); }124 { yyValue = new IntBase(createSpan(yyStart,yyCount), false, a1); } 125 125 / a1:QualifiedName 126 { yyValue = newIntRef(createSpan(yyStart,yyCount), a1); };126 { yyValue = NodeFactory.makeIntRef(createSpan(yyStart,yyCount), a1); }; 127 127 128 128 /* IntExpr ::= … … 156 156 public IntExpr run(IntExpr base) { 157 157 Op plus = NodeFactory.makeOpInfix(a1.getSpan(), "+"); 158 return newIntBinaryOp(createSpan(yyStart,yyCount),158 return NodeFactory.makeIntBinaryOp(createSpan(yyStart,yyCount), 159 159 (IntExpr)base, a1, plus); 160 160 }}; … … 166 166 public IntExpr run(IntExpr base) { 167 167 Op minus = NodeFactory.makeOpInfix(a1.getSpan(), "-"); 168 return newIntBinaryOp(createSpan(yyStart,yyCount),168 return NodeFactory.makeIntBinaryOp(createSpan(yyStart,yyCount), 169 169 (IntExpr)base, a1, minus); 170 170 }}; … … 176 176 public IntExpr run(IntExpr base) { 177 177 Op product = NodeFactory.makeOpInfix(a1.getSpan(), " "); 178 return newIntBinaryOp(createSpan(yyStart,yyCount),178 return NodeFactory.makeIntBinaryOp(createSpan(yyStart,yyCount), 179 179 (IntExpr)base, a1, product); 180 180 }}; … … 191 191 "An exponentiation should not be immediately followed " + 192 192 "by an exponentiation."); 193 return newIntBinaryOp(span, (IntExpr)base, a1, exponent);194 } return newIntBinaryOp(span, (IntExpr)base, a1, exponent);193 return NodeFactory.makeIntBinaryOp(span, (IntExpr)base, a1, exponent); 194 } return NodeFactory.makeIntBinaryOp(span, (IntExpr)base, a1, exponent); 195 195 }}; 196 196 }; … … 211 211 { Span span = createSpan(yyStart,yyCount); 212 212 Op not = NodeFactory.makeOpPrefix(span, "NOT"); 213 yyValue = new BoolUnaryOp(span, a1, not);213 yyValue = new BoolUnaryOp(span, false, a1, not); 214 214 } 215 215 / a1:BoolConstraintHead w OR w a2:BoolExpr 216 216 { Span span = createSpan(yyStart,yyCount); 217 217 Op op = NodeFactory.makeOpInfix(span, "OR"); 218 yyValue = newBoolBinaryOp(span, a1, a2, op);218 yyValue = NodeFactory.makeBoolBinaryOp(span, a1, a2, op); 219 219 } 220 220 / a1:BoolConstraintHead w AND w a2:BoolExpr 221 221 { Span span = createSpan(yyStart,yyCount); 222 222 Op op = NodeFactory.makeOpInfix(span, "AND"); 223 yyValue = newBoolBinaryOp(span, a1, a2, op);223 yyValue = NodeFactory.makeBoolBinaryOp(span, a1, a2, op); 224 224 } 225 225 / a1:BoolConstraintHead w IMPLIES w a2:BoolExpr 226 226 { Span span = createSpan(yyStart,yyCount); 227 227 Op op = NodeFactory.makeOpInfix(span, "IMPLIES"); 228 yyValue = newBoolBinaryOp(span, a1, a2, op);228 yyValue = NodeFactory.makeBoolBinaryOp(span, a1, a2, op); 229 229 } 230 230 / a1:BoolConstraintHead w equals w a2:BoolExpr 231 231 { Span span = createSpan(yyStart,yyCount); 232 232 Op op = NodeFactory.makeOpInfix(span, "="); 233 yyValue = newBoolBinaryOp(span, a1, a2, op);233 yyValue = NodeFactory.makeBoolBinaryOp(span, a1, a2, op); 234 234 }; 235 235 … … 252 252 Span span = createSpan(yyStart,yyCount); 253 253 Op op = NodeFactory.makeOpInfix(span, "OR"); 254 return newBoolBinaryOp(span, (BoolConstraint)base, a1, op);254 return NodeFactory.makeBoolBinaryOp(span, (BoolConstraint)base, a1, op); 255 255 }}; 256 256 }; … … 262 262 Span span = createSpan(yyStart,yyCount); 263 263 Op op = NodeFactory.makeOpInfix(span, "AND"); 264 return newBoolBinaryOp(span, (BoolConstraint)base, a1, op);264 return NodeFactory.makeBoolBinaryOp(span, (BoolConstraint)base, a1, op); 265 265 }}; 266 266 }; … … 272 272 Span span = createSpan(yyStart,yyCount); 273 273 Op op = NodeFactory.makeOpInfix(span, "IMPLIES"); 274 return newBoolBinaryOp(span, (BoolConstraint)base, a1, op);274 return NodeFactory.makeBoolBinaryOp(span, (BoolConstraint)base, a1, op); 275 275 }}; 276 276 }; … … 282 282 Span span = createSpan(yyStart,yyCount); 283 283 Op op = NodeFactory.makeOpInfix(span, ""); 284 return newBoolBinaryOp(span, (BoolConstraint)base, a1, op);284 return NodeFactory.makeBoolBinaryOp(span, (BoolConstraint)base, a1, op); 285 285 }}; 286 286 }; … … 293 293 transient private BoolExpr BoolVal = 294 294 a1:"true" 295 { yyValue = new BoolBase(createSpan(yyStart,yyCount), true); }295 { yyValue = new BoolBase(createSpan(yyStart,yyCount), false, true); } 296 296 / a1:"false" 297 { yyValue = new BoolBase(createSpan(yyStart,yyCount), false ); }297 { yyValue = new BoolBase(createSpan(yyStart,yyCount), false, false); } 298 298 / a1:QualifiedName 299 { yyValue = newBoolRef(createSpan(yyStart,yyCount), a1); };299 { yyValue = NodeFactory.makeBoolRef(createSpan(yyStart,yyCount), a1); }; 300 300 301 301 /* BoolExpr ::= … … 315 315 { Span span = createSpan(yyStart,yyCount); 316 316 Op not = NodeFactory.makeOpPrefix(span, "NOT"); 317 yyValue = new BoolUnaryOp(span, a1, not);317 yyValue = new BoolUnaryOp(span, false, a1, not); 318 318 }; 319 319 … … 331 331 Span span = createSpan(yyStart,yyCount); 332 332 Op op = NodeFactory.makeOpInfix(span, "OR"); 333 return newBoolBinaryOp(span, (BoolExpr)base, a1, op);333 return NodeFactory.makeBoolBinaryOp(span, (BoolExpr)base, a1, op); 334 334 }}; 335 335 }; … … 341 341 Span span = createSpan(yyStart,yyCount); 342 342 Op op = NodeFactory.makeOpInfix(span, "AND"); 343 return newBoolBinaryOp(span, (BoolExpr)base, a1, op);343 return NodeFactory.makeBoolBinaryOp(span, (BoolExpr)base, a1, op); 344 344 }}; 345 345 }; … … 351 351 Span span = createSpan(yyStart,yyCount); 352 352 Op op = NodeFactory.makeOpInfix(span, "IMPLIES"); 353 return newBoolBinaryOp(span, (BoolExpr)base, a1, op);353 return NodeFactory.makeBoolBinaryOp(span, (BoolExpr)base, a1, op); 354 354 }}; 355 355 }; … … 361 361 Span span = createSpan(yyStart,yyCount); 362 362 Op op = NodeFactory.makeOpInfix(span, "="); 363 return newBoolBinaryOp(span, (BoolExpr)base, a1, op);363 return NodeFactory.makeBoolBinaryOp(span, (BoolExpr)base, a1, op); 364 364 }}; 365 365 }; … … 382 382 a1:"dimensionless" 383 383 { Span span = createSpan(yyStart,yyCount); 384 yyValue = new UnitRef(span, NodeFactory.makeId(span, a1));384 yyValue = new UnitRef(span, false, NodeFactory.makeId(span, a1)); 385 385 } 386 386 / a1:QualifiedName 387 { yyValue = new UnitRef(createSpan(yyStart,yyCount), a1); }387 { yyValue = new UnitRef(createSpan(yyStart,yyCount), false, a1); } 388 388 / openparen w a1:UnitExpr w closeparen 389 389 { yyValue = NodeFactory.makeInParentheses(a1); }; … … 400 400 public UnitExpr run(UnitExpr base) { 401 401 Op product = NodeFactory.makeOpInfix(a1.getSpan(), " "); 402 return new UnitBinaryOp(createSpan(yyStart,yyCount), 402 return new UnitBinaryOp(createSpan(yyStart,yyCount), false, 403 403 (UnitExpr)base, a1, product); 404 404 }}; … … 410 410 public UnitExpr run(UnitExpr base) { 411 411 Op quotient = NodeFactory.makeOpInfix(a1.getSpan(), "/"); 412 return new UnitBinaryOp(createSpan(yyStart,yyCount), 412 return new UnitBinaryOp(createSpan(yyStart,yyCount), false, 413 413 (UnitExpr)base, a1, quotient); 414 414 }}; … … 420 420 public UnitExpr run(UnitExpr base) { 421 421 Op exponent = NodeFactory.makeOpInfix(a1.getSpan(), "^"); 422 return new UnitBinaryOp(createSpan(yyStart,yyCount), 422 return new UnitBinaryOp(createSpan(yyStart,yyCount), false, 423 423 (UnitExpr)base, a1, exponent); 424 424 }}; … … 559 559 / a1:"true" 560 560 { Span span = createSpan(yyStart,yyCount); 561 yyValue = new BoolArg(span, new BoolBase(span, true));561 yyValue = new BoolArg(span, new BoolBase(span, false, true)); 562 562 } 563 563 / a1:"false" 564 564 { Span span = createSpan(yyStart,yyCount); 565 yyValue = new BoolArg(span, new BoolBase(span, false ));565 yyValue = new BoolArg(span, new BoolBase(span, false, false)); 566 566 } 567 567 / !(QualifiedName (w DOT / w slash / w per / w DimPostfixOp) / "dimensionless") -
trunk/ProjectFortress/src/com/sun/fortress/parser/Method.rats
r3206 r3210 143 143 Span span = createSpan(yyStart+9,8); 144 144 yyValue = FortressUtil.mkFnDecl(createSpan(yyStart,yyCount), mods, 145 newId(span,"coerce"),a1, params, a4, a6);145 NodeFactory.makeId(span,"coerce"),a1, params, a4, a6); 146 146 }; 147 147 … … 157 157 Span span = createSpan(yyStart+9,8); 158 158 yyValue = FortressUtil.mkFnDecl(createSpan(yyStart,yyCount), mods, 159 newId(span, "coerce"),159 NodeFactory.makeId(span, "coerce"), 160 160 a1, params, a4); 161 161 }; -
trunk/ProjectFortress/src/com/sun/fortress/parser/MethodParam.rats
r3132 r3210 51 51 PlainParam 52 52 / a1:self 53 { yyValue = NodeFactory.makeParam( newId(createSpan(yyStart,yyCount),53 { yyValue = NodeFactory.makeParam(NodeFactory.makeId(createSpan(yyStart,yyCount), 54 54 "self")); }; 55 55 56 56 Param AbsParam := 57 57 a1:self 58 { yyValue = NodeFactory.makeParam( newId(createSpan(yyStart,yyCount),58 { yyValue = NodeFactory.makeParam(NodeFactory.makeId(createSpan(yyStart,yyCount), 59 59 "self")); } 60 60 / AbsPlainParam; -
trunk/ProjectFortress/src/com/sun/fortress/parser/NoNewlineHeader.rats
r3206 r3210 53 53 else 54 54 where = Option.some(a2); 55 yyValue = newTraitTypeWhere(createSpan(yyStart,yyCount),56 a1, where);55 yyValue = NodeFactory.makeTraitTypeWhere(createSpan(yyStart,yyCount), 56 a1, where); 57 57 }; 58 58 -
trunk/ProjectFortress/src/com/sun/fortress/parser/Syntax.rats
r3206 r3210 112 112 else 113 113 where = Option.some(whereClauses); 114 yyValue = new NonterminalHeader(createSpan(yyStart, yyCount), mod, name, params, staticParams, type1, where); 114 yyValue = new NonterminalHeader(createSpan(yyStart, yyCount), mod, name, 115 params, staticParams, type1, where); 115 116 }; 116 117 -
trunk/ProjectFortress/src/com/sun/fortress/parser_util/FortressUtil.java
r3206 r3210 88 88 } 89 89 90 private static Effect effect = newEffect(NodeFactory.makeSpan("singleton"));90 private static Effect effect = NodeFactory.makeEffect(NodeFactory.makeSpan("singleton")); 91 91 92 92 public static Effect emptyEffect() { -
trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/phases/EscapeRewriter.java
r3122 r3210 127 127 String s = removeEscape(result_id.getText()); 128 128 // TODO is span correct below? 129 return new PrefixedSymbol(that.getSpan(), newId(result_id.getSpan(), s), result_symbol);129 return new PrefixedSymbol(that.getSpan(), NodeFactory.makeId(result_id.getSpan(), s), result_symbol); 130 130 } 131 131 -
trunk/ProjectFortress/src/com/sun/fortress/tests/unit_tests/ConstructorsJUTest.java
r3200 r3210 77 77 78 78 public void testId() { 79 Id id1 = newId(newSpan("cat", 1, 2, 3), "TheIdString");80 Id id2 = newId(newSpan("cat", 1, 2, 3), "TheIdString");81 Id id3 = newId(newSpan("cat", 1, 2, 999), "TheIdString");82 Id id4 = newId(newSpan("cat", 1, 2, 3), "AnotherString");79 Id id1 = NodeFactory.makeId(newSpan("cat", 1, 2, 3), "TheIdString"); 80 Id id2 = NodeFactory.makeId(newSpan("cat", 1, 2, 3), "TheIdString"); 81 Id id3 = NodeFactory.makeId(newSpan("cat", 1, 2, 999), "TheIdString"); 82 Id id4 = NodeFactory.makeId(newSpan("cat", 1, 2, 3), "AnotherString"); 83 83 Assert.assertEquals(id1, id2); 84 84 Assert.assertTrue(id1.equals(id3)); // We ignore Sourceloc for equality … … 88 88 89 89 Id newId(String id, int l, int c1, int c2) { 90 return newId(newSpan("somefile", l, c1, c2), id);90 return NodeFactory.makeId(newSpan("somefile", l, c1, c2), id); 91 91 } 92 92 Id newId(String id) { 93 return newId(newSpan("somefile", 1, 2, 3), id);93 return NodeFactory.makeId(newSpan("somefile", 1, 2, 3), id); 94 94 } 95 95 public void testAPIName() {

