Changeset 3123
- Timestamp:
- 11/30/08 08:02:27 (12 months ago)
- Location:
- trunk/ProjectFortress
- Files:
-
- 52 modified
-
astgen/Fortress.ast (modified) (34 diffs)
-
src/com/sun/fortress/compiler/Types.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/desugarer/DesugaringVisitor.java (modified) (9 diffs)
-
src/com/sun/fortress/compiler/desugarer/FreeNameCollection.java (modified) (4 diffs)
-
src/com/sun/fortress/compiler/desugarer/FreeNameCollector.java (modified) (4 diffs)
-
src/com/sun/fortress/compiler/desugarer/ObjectExpressionVisitor.java (modified) (4 diffs)
-
src/com/sun/fortress/compiler/desugarer/PreDisambiguationDesugaringVisitor.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/desugarer/VarRefContainer.java (modified) (4 diffs)
-
src/com/sun/fortress/compiler/disambiguator/ExprDisambiguator.java (modified) (9 diffs)
-
src/com/sun/fortress/compiler/disambiguator/NonterminalEnv.java (modified) (3 diffs)
-
src/com/sun/fortress/compiler/disambiguator/NonterminalNameDisambiguator.java (modified) (3 diffs)
-
src/com/sun/fortress/compiler/disambiguator/TopLevelEnv.java (modified) (6 diffs)
-
src/com/sun/fortress/compiler/disambiguator/TypeDisambiguator.java (modified) (4 diffs)
-
src/com/sun/fortress/compiler/typechecker/FnDeclTypeEnv.java (modified) (2 diffs)
-
src/com/sun/fortress/compiler/typechecker/FnTypeEnv.java (modified) (2 diffs)
-
src/com/sun/fortress/compiler/typechecker/StaticTypeReplacer.java (modified) (12 diffs)
-
src/com/sun/fortress/compiler/typechecker/SubtypeChecker.java (modified) (13 diffs)
-
src/com/sun/fortress/compiler/typechecker/TraitTable.java (modified) (1 diff)
-
src/com/sun/fortress/compiler/typechecker/TypeAnalyzer.java (modified) (8 diffs)
-
src/com/sun/fortress/compiler/typechecker/TypeAnalyzerUtil.java (modified) (5 diffs)
-
src/com/sun/fortress/compiler/typechecker/TypeChecker.java (modified) (41 diffs)
-
src/com/sun/fortress/compiler/typechecker/TypesUtil.java (modified) (12 diffs)
-
src/com/sun/fortress/interpreter/evaluator/BaseEnv.java (modified) (8 diffs)
-
src/com/sun/fortress/interpreter/evaluator/BuildTopLevelEnvironments.java (modified) (1 diff)
-
src/com/sun/fortress/interpreter/evaluator/EvalType.java (modified) (9 diffs)
-
src/com/sun/fortress/interpreter/evaluator/Evaluator.java (modified) (21 diffs)
-
src/com/sun/fortress/interpreter/evaluator/LHSEvaluator.java (modified) (1 diff)
-
src/com/sun/fortress/interpreter/evaluator/MakeInferenceSpecific.java (modified) (2 diffs)
-
src/com/sun/fortress/interpreter/evaluator/types/FTraitOrObject.java (modified) (1 diff)
-
src/com/sun/fortress/interpreter/evaluator/types/IntNat.java (modified) (1 diff)
-
src/com/sun/fortress/interpreter/glue/NativeApp.java (modified) (1 diff)
-
src/com/sun/fortress/interpreter/rewrite/DesugarerVisitor.java (modified) (12 diffs)
-
src/com/sun/fortress/nodes_util/DesugarerUtil.java (modified) (2 diffs)
-
src/com/sun/fortress/nodes_util/ErrorMsgMaker.java (modified) (10 diffs)
-
src/com/sun/fortress/nodes_util/ExprFactory.java (modified) (6 diffs)
-
src/com/sun/fortress/nodes_util/NodeComparator.java (modified) (7 diffs)
-
src/com/sun/fortress/nodes_util/NodeFactory.java (modified) (15 diffs)
-
src/com/sun/fortress/nodes_util/NodeUtil.java (modified) (6 diffs)
-
src/com/sun/fortress/nodes_util/Printer.java (modified) (2 diffs)
-
src/com/sun/fortress/parser/Compilation.rats (modified) (1 diff)
-
src/com/sun/fortress/parser/NoNewlineType.rats (modified) (1 diff)
-
src/com/sun/fortress/parser/Type.rats (modified) (1 diff)
-
src/com/sun/fortress/parser/preparser/PreCompilation.rats (modified) (1 diff)
-
src/com/sun/fortress/parser_util/precedence_opexpr/RealExpr.java (modified) (1 diff)
-
src/com/sun/fortress/parser_util/precedence_resolver/TypeResolver.java (modified) (8 diffs)
-
src/com/sun/fortress/syntax_abstractions/phases/ExtensionDesugarer.java (modified) (8 diffs)
-
src/com/sun/fortress/syntax_abstractions/phases/ItemDisambiguator.java (modified) (4 diffs)
-
src/com/sun/fortress/syntax_abstractions/phases/TemplateVarRewriter.java (modified) (1 diff)
-
src/com/sun/fortress/syntax_abstractions/phases/Transform.java (modified) (12 diffs)
-
src/com/sun/fortress/syntax_abstractions/rats/util/ModuleInfo.java (modified) (1 diff)
-
src/com/sun/fortress/syntax_abstractions/util/FortressTypeToJavaType.java (modified) (2 diffs)
-
src/com/sun/fortress/tools/FortressAstToConcrete.java (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ProjectFortress/astgen/Fortress.ast
r3122 r3123 648 648 * expression annotated with a type 649 649 */ 650 abstract TypeAnnotatedExpr(Expr expr, Type type);650 abstract TypeAnnotatedExpr(Expr expr, Type annType); 651 651 /** 652 652 * type ascription expression … … 678 678 * opr, this node gives a separate OpRef for each Lhs. 679 679 */ 680 Assignment(List<Lhs> lhs, Option<OpRef> opr, Expr rhs,680 Assignment(List<Lhs> lhs, Option<OpRef> assignOp, Expr rhs, 681 681 Option<List<OpRef>> opsForLhs = Option.<List<OpRef>>none()); 682 682 /** … … 786 786 */ 787 787 Try(Block body, Option<Catch> catchClause = Option.<Catch>none(), 788 List<BaseType> forbid = Collections.<BaseType>emptyList(),788 List<BaseType> forbidClause = Collections.<BaseType>emptyList(), 789 789 Option<Block> finallyClause = Option.<Block>none()); 790 790 /** … … 828 828 * e.g.) while x < 10 do print x; x += 1 end 829 829 */ 830 While(GeneratorClause test , Do body);830 While(GeneratorClause testExpr, Do body); 831 831 /** 832 832 * comprehension or accumulator … … 841 841 * e.g.) PROD[i <- 1:n] i 842 842 */ 843 Accumulator(OpName opr, List<GeneratorClause> gens, Expr body);843 Accumulator(OpName accOp, List<GeneratorClause> gens, Expr body); 844 844 /** 845 845 * array comprehension … … 981 981 * e.g.) 7 982 982 */ 983 IntLiteralExpr(String text = in_ val.toString(),984 BigInteger val);983 IntLiteralExpr(String text = in_intVal.toString(), 984 BigInteger intVal); 985 985 /** 986 986 * char literal 987 987 * e.g.) 'c' 988 988 */ 989 CharLiteralExpr(int val = in_text.charAt(0));989 CharLiteralExpr(int charVal = in_text.charAt(0)); 990 990 /** 991 991 * string literal … … 1004 1004 * e.g.) length 1005 1005 */ 1006 VarRef(Id var , int lexicalDepth=-2147483648) implements Lhs;1006 VarRef(Id varId, int lexicalDepth=-2147483648) implements Lhs; 1007 1007 /** 1008 1008 * A reference to a singleton object. Created at typechecking or disambiguation-time. … … 1049 1049 * list from a FnRef into something else. 1050 1050 */ 1051 _RewriteFnRef(Expr fn ,1052 List<StaticArg> staticArgs1053 = Collections.<StaticArg>emptyList());1051 _RewriteFnRef(Expr fnExpr, 1052 List<StaticArg> staticArgs 1053 = Collections.<StaticArg>emptyList()); 1054 1054 /** 1055 1055 * named functional in functional applications … … 1167 1167 * after inferring the implicit coercion invocations 1168 1168 */ 1169 CoercionInvocation(BaseType t ype,1169 CoercionInvocation(BaseType toType, 1170 1170 List<StaticArg> staticArgs 1171 1171 = Collections.<StaticArg>emptyList(), … … 1262 1262 * e.g.) Time squared 1263 1263 */ 1264 OpDim(DimExpr val, Op op);1264 OpDim(DimExpr dimVal, Op op); 1265 1265 /** 1266 1266 * base types: things that can be extended, excluded, thrown, etc. … … 1302 1302 * abbreviated type 1303 1303 */ 1304 abstract AbbreviatedType(Type type);1304 abstract AbbreviatedType(Type elemType); 1305 1305 /** 1306 1306 * array type … … 1321 1321 * e.g.) RR64 Length 1322 1322 */ 1323 TaggedDimType(DimExpr dim ,1324 Option<Expr> unit = Option.<Expr>none());1323 TaggedDimType(DimExpr dimExpr, 1324 Option<Expr> unitExpr = Option.<Expr>none()); 1325 1325 /** 1326 1326 * type with unit … … 1328 1328 * e.g.) RR64 meter 1329 1329 */ 1330 TaggedUnitType(Expr unit );1330 TaggedUnitType(Expr unitExpr); 1331 1331 /** 1332 1332 * tuple-like types … … 1402 1402 */ 1403 1403 Effect(Option<List<BaseType>> throwsClause = Option.<List<BaseType>>none(), 1404 boolean io = false);1404 boolean ioEffect = false); 1405 1405 /** 1406 1406 * static argument … … 1412 1412 * e.g.) List[\ZZ64\] 1413 1413 */ 1414 TypeArg(Type type );1414 TypeArg(Type typeArg); 1415 1415 /** 1416 1416 * integer used as static argument … … 1418 1418 * e.g.) m + n 1419 1419 */ 1420 IntArg(IntExpr val);1420 IntArg(IntExpr intVal); 1421 1421 /** 1422 1422 * boolean used as static argument … … 1424 1424 * e.g.) ninf OR pinf 1425 1425 */ 1426 BoolArg(BoolExpr bool );1426 BoolArg(BoolExpr boolArg); 1427 1427 /** 1428 1428 * operator used as static argument … … 1436 1436 * e.g.) Unity 1437 1437 */ 1438 DimArg(DimExpr dim );1438 DimArg(DimExpr dimArg); 1439 1439 /** 1440 1440 * unit used as static argument … … 1442 1442 * e.g.) dimensionless 1443 1443 */ 1444 UnitArg(UnitExpr unit );1444 UnitArg(UnitExpr unitArg); 1445 1445 /** 1446 1446 * static expression … … 1462 1462 * e.g.) 8 1463 1463 */ 1464 NumberConstraint(IntLiteralExpr val);1464 NumberConstraint(IntLiteralExpr intVal); 1465 1465 /** 1466 1466 * integer identifier … … 1513 1513 * e.g.) true 1514 1514 */ 1515 BoolConstant(boolean bool );1515 BoolConstant(boolean boolVal); 1516 1516 /** 1517 1517 * boolean identiier … … 1530 1530 * e.g.) NOT ninf 1531 1531 */ 1532 NotConstraint(BoolExpr bool );1532 NotConstraint(BoolExpr boolVal); 1533 1533 /** 1534 1534 * binary boolean constraint … … 1718 1718 * e.g.) requires { n GE 0 } ensures { outcome GE 0 } 1719 1719 */ 1720 Contract(Option<List<Expr>> requires = Option.<List<Expr>>none(),1721 Option<List<EnsuresClause>> ensures =1720 Contract(Option<List<Expr>> requiresClause = Option.<List<Expr>>none(), 1721 Option<List<EnsuresClause>> ensuresClause = 1722 1722 Option.<List<EnsuresClause>>none(), 1723 Option<List<Expr>> invariants = Option.<List<Expr>>none());1723 Option<List<Expr>> invariantsClause = Option.<List<Expr>>none()); 1724 1724 /** 1725 1725 * ensures clause used in contracts … … 1849 1849 TypeParam(List<BaseType> extendsClause = 1850 1850 Collections.<BaseType>emptyList(), 1851 boolean absorbs = false);1851 boolean absorbsParam = false); 1852 1852 /** 1853 1853 * unit parameter … … 1855 1855 * e.g.) unit U absrbs unit 1856 1856 */ 1857 UnitParam(Option<Type> dim = Option.<Type>none(),1858 boolean absorbs = false);1857 UnitParam(Option<Type> dimParam = Option.<Type>none(), 1858 boolean absorbsParam = false); 1859 1859 /** 1860 1860 * name used in declarations and references … … 1876 1876 * | opr EncloserPair 1877 1877 */ 1878 abstract IdOrOpOrAnonymousName(Option<APIName> api 1878 abstract IdOrOpOrAnonymousName(Option<APIName> apiName 1879 1879 = Option.<APIName>none()); 1880 1880 /** … … 1949 1949 * because different ops can be chosen for different clauses. 1950 1950 */ 1951 CaseClause(Expr match , Block body,1951 CaseClause(Expr matchClause, Block body, 1952 1952 Option<OpRef> op = Option.<OpRef>none()); 1953 1953 /** … … 1963 1963 * e.g.) IOException => throw ForbiddenException(e) 1964 1964 */ 1965 CatchClause(BaseType match , Block body);1965 CatchClause(BaseType matchType, Block body); 1966 1966 /** 1967 1967 * block expression used in do expressions … … 1969 1969 * e.g.) at a.region(j) do w := a_j 1970 1970 */ 1971 DoFront(Option<Expr> loc = Option.<Expr>none(), boolean atomic = false, 1971 DoFront(Option<Expr> loc = Option.<Expr>none(), 1972 boolean atomicBlock = false, 1972 1973 Block expr); 1973 1974 /** … … 1977 1978 * e.g.) if x IN { 0, 1, 2 } then 0 1978 1979 */ 1979 IfClause(GeneratorClause test , Block body);1980 IfClause(GeneratorClause testClause, Block body); 1980 1981 /** 1981 1982 * typecase clause used in typecase expressions … … 1985 1986 * e.g.) String => x.append("foo") 1986 1987 */ 1987 TypecaseClause(List<Type> match , Block body);1988 TypecaseClause(List<Type> matchType, Block body); 1988 1989 /** 1989 1990 * array and matrix size … … 2012 2013 * e.g.) x = String 2013 2014 */ 2014 KeywordType(Id name, Type type);2015 KeywordType(Id name, Type keywordType); 2015 2016 /** 2016 2017 * trait type with a where clause used in extends clauses … … 2018 2019 * e.g.) T[\ninf, nan\] where { ninf AND NOT nan } 2019 2020 */ 2020 TraitTypeWhere(BaseType type,2021 TraitTypeWhere(BaseType baseType, 2021 2022 Option<WhereClause> whereClause 2022 2023 = Option.<WhereClause>none()); … … 2115 2116 * in the Printer and UnPrinter so be careful if Level is changed. 2116 2117 */ 2117 Level(Integer level, Object object);2118 Level(Integer level, Object _object); 2118 2119 /* 2119 2120 * An overloading, and the type of that particular overloading. 2120 2121 */ 2121 _RewriteFnRefOverloading(FnRef fn , Type ty);2122 _RewriteFnRefOverloading(FnRef fnRef, Type ty); 2122 2123 /** 2123 2124 * An operator overloading, and the tpye of that overloading. -
trunk/ProjectFortress/src/com/sun/fortress/compiler/Types.java
r3114 r3123 271 271 Map<Id, Type> result = new LinkedHashMap<Id, Type>(8); 272 272 for (KeywordType k : _d.getKeywords()) { 273 result.put(k.getName(), k.get Type());273 result.put(k.getName(), k.getKeywordType()); 274 274 } 275 275 return result; -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/DesugaringVisitor.java
r3122 r3123 244 244 VarRef obj = (VarRef)rewrite.getObj(); 245 245 obj = ExprFactory.makeVarRef(obj, obj.getExprType(), 246 mangleName(obj.getVar ()));246 mangleName(obj.getVarId())); 247 247 body = (Expr)forFieldRefOnly(rewrite, field.getIdType(), 248 248 obj, rewrite.getField()); … … 289 289 VarRef obj = (VarRef)rewrite.getObj(); 290 290 obj = ExprFactory.makeVarRef(obj, obj.getExprType(), 291 mangleName(obj.getVar ()));291 mangleName(obj.getVarId())); 292 292 assign = ExprFactory.makeMethodInvocation(rewrite.getSpan(), false, 293 293 Option.some(voidType), obj, … … 403 403 left.add((Lhs)lhs_that.accept(DesugaringVisitor.this)); 404 404 return ExprFactory.makeAssignment(span, voidType, left, 405 that.get Opr(), rhs_result);405 that.getAssignOp(), rhs_result); 406 406 } 407 407 public Node forSubscriptExpr(SubscriptExpr lhs_that) { … … 409 409 left.add((Lhs)lhs_that.accept(DesugaringVisitor.this)); 410 410 return ExprFactory.makeAssignment(span, voidType, left, 411 that.get Opr(), rhs_result);411 that.getAssignOp(), rhs_result); 412 412 } 413 413 public Node forFieldRef(FieldRef lhs_that) { 414 414 Expr obj = (Expr) lhs_that.getObj().accept(DesugaringVisitor.this); 415 415 Expr rhs = rhs_result; 416 if ( that.get Opr().isSome() ) {416 if ( that.getAssignOp().isSome() ) { 417 417 Expr _lhs = (Expr)lhs_that.accept(DesugaringVisitor.this); 418 418 rhs = ExprFactory.makeOpExpr(span, lhs_that.getExprType(), 419 that.get Opr().unwrap(),419 that.getAssignOp().unwrap(), 420 420 _lhs, rhs); 421 421 } … … 429 429 Expr obj = (Expr) lhs_that.getObj().accept(DesugaringVisitor.this); 430 430 Expr rhs = rhs_result; 431 if ( that.get Opr().isSome() ) {431 if ( that.getAssignOp().isSome() ) { 432 432 Expr _lhs = (Expr)lhs_that.accept(DesugaringVisitor.this); 433 433 rhs = ExprFactory.makeOpExpr(span, lhs_that.getExprType(), 434 that.get Opr().unwrap(),434 that.getAssignOp().unwrap(), 435 435 _lhs, rhs); 436 436 } … … 443 443 return ExprFactory.makeAssignment(span, voidType, 444 444 that.getLhs(), 445 that.get Opr(),445 that.getAssignOp(), 446 446 rhs_result); 447 447 } … … 467 467 */ 468 468 boolean paren = that.isParenthesized(); 469 Option<OpRef> opr = that.get Opr();469 Option<OpRef> opr = that.getAssignOp(); 470 470 List<Expr> assigns = new ArrayList<Expr>(); 471 471 List<LValue> secondLhs = new ArrayList<LValue>(); … … 500 500 Id varResult) { 501 501 // After disambiguation, the Id in a VarRef should have an empty API. 502 assert(varResult.getApi ().isNone());502 assert(varResult.getApiName().isNone()); 503 503 504 504 if (fieldsInScope.contains(varResult)) { … … 523 523 Option<List<_RewriteFnRefOverloading>> overloadings_result) { 524 524 // After disambiguation, the Id in a FnRef should have an empty API. 525 assert(fnResult.getApi ().isNone());525 assert(fnResult.getApiName().isNone()); 526 526 527 527 if (fieldsInScope.contains(fnResult)) { -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/FreeNameCollection.java
r2999 r3123 64 64 private List<VarRef> freeMutableVarRefs = new LinkedList<VarRef>(); 65 65 66 // free exit labels 66 // free exit labels 67 67 private List<Exit> freeExitLabels = new LinkedList<Exit>(); 68 68 … … 90 90 this.freeMutableVarRefs.addAll(other.freeMutableVarRefs); 91 91 this.freeExitLabels.addAll(other.freeExitLabels); 92 92 93 93 if( other.enclosingSelfType.isSome() ) { 94 94 this.enclosingSelfType = … … 129 129 130 130 for(VarRef var : freeVarRefs) { 131 Option<StaticParam> spOp = typeEnv.staticParam( var.getVar () );131 Option<StaticParam> spOp = typeEnv.staticParam( var.getVarId() ); 132 132 if( spOp.isNone() ) { // it's not a static param 133 133 newFreeVarRefs.add(var); 134 134 } else if( spOp.unwrap() instanceof BoolParam ) { 135 this.add( new BoolRef(var.getSpan(), var.getVar ()) );135 this.add( new BoolRef(var.getSpan(), var.getVarId()) ); 136 136 } else if( spOp.unwrap() instanceof IntParam ) { 137 this.add( new IntRef(var.getSpan(), var.getVar ()) );137 this.add( new IntRef(var.getSpan(), var.getVarId()) ); 138 138 } else if( spOp.unwrap() instanceof NatParam ) { 139 this.add( new IntRef(var.getSpan(), var.getVar ()) );139 this.add( new IntRef(var.getSpan(), var.getVarId()) ); 140 140 } else { 141 141 throw new DesugarerError( "Unexpected Static Param type " + … … 211 211 this.freeIntRefs.equals( other.freeIntRefs ) && 212 212 this.freeBoolRefs.equals( other.freeBoolRefs ) && 213 this.freeVarTypes.equals( other.freeVarTypes ) && 213 this.freeVarTypes.equals( other.freeVarTypes ) && 214 214 this.freeMutableVarRefs.equals( other.freeMutableVarRefs ) && 215 this.freeExitLabels.equals( other.freeExitLabels) ); 215 this.freeExitLabels.equals( other.freeExitLabels) ); 216 216 } 217 217 -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/FreeNameCollector.java
r3122 r3123 269 269 for(VarRef var : mutableVars) { 270 270 Option<Node> declNodeOp = 271 objExprTypeEnv.declarationSite( var.getVar () );271 objExprTypeEnv.declarationSite( var.getVarId() ); 272 272 if(declNodeOp.isNone()) { 273 273 throw new DesugarerError( var.getSpan(), … … 402 402 forVarRefDoFirst(that); 403 403 recurOnOptionOfType(that.getExprType()); 404 recur(that.getVar ());404 recur(that.getVarId()); 405 405 406 406 Debug.debug(Debug.Type.COMPILER, 407 407 DEBUG_LEVEL0, "FreeNameCollector visiting ", that); 408 408 409 boolean isDecledInObjExpr = isDeclaredInObjExpr(that.getVar ());410 boolean isDecledAtTopLevel = isDeclaredAtTopLevel(that.getVar ());409 boolean isDecledInObjExpr = isDeclaredInObjExpr(that.getVarId()); 410 boolean isDecledAtTopLevel = isDeclaredAtTopLevel(that.getVarId()); 411 411 boolean isShadowed = false; 412 412 413 413 if(enclosingTraitDecl.isSome()) { 414 414 isShadowed = isShadowedInNode( enclosingTraitDecl.unwrap(), 415 that.getVar () );415 that.getVarId() ); 416 416 } else if(enclosingObjectDecl.isSome()) { 417 417 isShadowed = isShadowedInNode( enclosingObjectDecl.unwrap(), 418 that.getVar () );418 that.getVarId() ); 419 419 } 420 420 … … 886 886 887 887 for(VarRef var : freeVarRefs) { 888 Option<Boolean> isMutable = typeEnv.mutable( var.getVar () );888 Option<Boolean> isMutable = typeEnv.mutable( var.getVarId() ); 889 889 if( isMutable.isNone() ) { 890 890 throw new DesugarerError("Binding for VarRef " + … … 978 978 @Override 979 979 public void forTraitTypeWhere(TraitTypeWhere that) { 980 BaseType baseType = that.get Type();980 BaseType baseType = that.getBaseType(); 981 981 if( (baseType instanceof NamedType) == false ) { 982 982 throw new DesugarerError(that.getSpan(), -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/ObjectExpressionVisitor.java
r3122 r3123 209 209 VarRefContainer container = mutableVarRefContainerMap.get(var); 210 210 newObjectDecls.add( container.containerDecl() ); 211 Pair<Id,Id> keyPair = new Pair<Id,Id>( that.getName(), var.getVar () );211 Pair<Id,Id> keyPair = new Pair<Id,Id>( that.getName(), var.getVarId() ); 212 212 // Use an empty span; the correct span will be filled in 213 213 // later at the use site … … 542 542 } else { 543 543 throw new DesugarerError(objExpr.getSpan(), 544 var.getVar () + " is mutable but not found in "544 var.getVarId() + " is mutable but not found in " 545 545 + "the mutableVarRefContainerMap!"); 546 546 } 547 547 } else { 548 548 VarRef newVar = 549 ExprFactory.makeVarRef( var.getSpan(), var.getVar () );549 ExprFactory.makeVarRef( var.getSpan(), var.getVarId() ); 550 550 exprs.add(newVar); 551 551 } … … 735 735 } else { 736 736 throw new DesugarerError(target.getSpan(), 737 var.getVar () + " is mutable but not found in "737 var.getVarId() + " is mutable but not found in " 738 738 + "the mutableVarRefContainerMap!"); 739 739 } … … 744 744 type = var.getExprType(); 745 745 param = NodeFactory.makeParam(var.getSpan(), 746 var.getVar (), type);746 var.getVarId(), type); 747 747 params.add(param); 748 748 } -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/PreDisambiguationDesugaringVisitor.java
r3102 r3123 181 181 public Node forAccumulator(Accumulator that) { 182 182 return visitAccumulator(that.getSpan(), that.getGens(), 183 that.get Opr(), that.getBody(),183 that.getAccOp(), that.getBody(), 184 184 that.getStaticArgs()); 185 185 } -
trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/VarRefContainer.java
r3115 r3123 68 68 String name = ObjectExpressionVisitor.MANGLE_CHAR + 69 69 CONTAINER_DECL_PREFIX + "_" + uniqueSuffix + 70 "_" + origVar.getVar ().getText();70 "_" + origVar.getVarId().getText(); 71 71 return NodeFactory.makeId( origDeclNode.getSpan(), name ); 72 72 } … … 75 75 String name = ObjectExpressionVisitor.MANGLE_CHAR + 76 76 CONTAINER_FIELD_PREFIX + "_" + uniqueSuffix + 77 "_" + origVar.getVar ().getText();77 "_" + origVar.getVarId().getText(); 78 78 return NodeFactory.makeId( origDeclNode.getSpan(), name ); 79 79 } … … 131 131 return ExprFactory.makeFieldRef( varRefSpan, 132 132 this.containerVarRef(varRefSpan), 133 origVar.getVar () );133 origVar.getVarId() ); 134 134 } 135 135 … … 150 150 List<Modifier> mods = new LinkedList<Modifier>(); 151 151 mods.add( new ModifierSettable(paramSpan) ); 152 Param param = new Param(paramSpan, var.getVar (), mods, typeOp);152 Param param = new Param(paramSpan, var.getVarId(), mods, typeOp); 153 153 return param; 154 154 } -
trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/ExprDisambiguator.java
r3122 r3123 573 573 for( TraitTypeWhere trait_ : extended_traits ) { 574 574 575 BaseType type_ = trait_.get Type();575 BaseType type_ = trait_.getBaseType(); 576 576 577 577 if( h.hasExplored(type_) ) … … 764 764 public Node forTaggedDimType(TaggedDimType that) { 765 765 return forTaggedDimTypeOnly(that, 766 (Type)that.get Type().accept(this),767 that.getDim (),768 that.getUnit ());766 (Type)that.getElemType().accept(this), 767 that.getDimExpr(), 768 that.getUnitExpr()); 769 769 } 770 770 … … 775 775 public Node forTaggedUnitType(TaggedUnitType that) { 776 776 return forTaggedUnitTypeOnly(that, 777 (Type)that.get Type().accept(this),778 that.getUnit ());777 (Type)that.getElemType().accept(this), 778 that.getUnitExpr()); 779 779 } 780 780 … … 826 826 ExprDisambiguator v = extendWithOutcome(that.getSpan()); 827 827 return forContractOnly(that, 828 v.recurOnOptionOfListOfExpr(that.getRequires ()),829 v.recurOnOptionOfListOfEnsuresClause(that.getEnsures ()),830 v.recurOnOptionOfListOfExpr(that.getInvariants ()));828 v.recurOnOptionOfListOfExpr(that.getRequiresClause()), 829 v.recurOnOptionOfListOfEnsuresClause(that.getEnsuresClause()), 830 v.recurOnOptionOfListOfExpr(that.getInvariantsClause())); 831 831 } 832 832 … … 850 850 return forAccumulatorOnly(that, type_result, 851 851 recurOnListOfStaticArg(that.getStaticArgs()), 852 (OpName)that.get Opr().accept(this),852 (OpName)that.getAccOp().accept(this), 853 853 pair.first(), 854 854 (Expr)that.getBody().accept(extended_d)); … … 861 861 @Override 862 862 public Node forIfClause(IfClause that) { 863 GeneratorClause gen = that.getTest ();863 GeneratorClause gen = that.getTestClause(); 864 864 ExprDisambiguator e_d = this.extendWithVars(Useful.set(gen.getBind())); 865 865 866 866 return forIfClauseOnly(that, 867 (GeneratorClause)that.getTest ().accept(this),867 (GeneratorClause)that.getTestClause().accept(this), 868 868 (Block)that.getBody().accept(e_d)); 869 869 } … … 874 874 @Override 875 875 public Node forWhile(While that) { 876 GeneratorClause gen = that.getTest ();876 GeneratorClause gen = that.getTestExpr(); 877 877 ExprDisambiguator e_d = this.extendWithVars(Useful.set(gen.getBind())); 878 878 879 879 Option<Type> type_result = recurOnOptionOfType(that.getExprType()); 880 880 return forWhileOnly(that, type_result, 881 (GeneratorClause)that.getTest ().accept(this),881 (GeneratorClause)that.getTestExpr().accept(this), 882 882 (Do)that.getBody().accept(e_d)); 883 883 } … … 961 961 /** VarRefs can be made qualified or translated into FnRefs. */ 962 962 @Override public Node forVarRef(VarRef that) { 963 Id name = that.getVar ();964 Option<APIName> api = name.getApi ();963 Id name = that.getVarId(); 964 Option<APIName> api = name.getApiName(); 965 965 ConsList<Id> fields = ConsList.empty(); 966 966 Expr result = null; … … 1013 1013 Id newName = IterUtil.first(vars); 1014 1014 1015 if (newName.getApi ().isNone() && newName == name && fields.isEmpty()) {1015 if (newName.getApiName().isNone() && newName == name && fields.isEmpty()) { 1016 1016 // no change -- no need to recreate the VarRef 1017 1017 return that; -
trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/NonterminalEnv.java
r2746 r3123 96 96 } 97 97 } 98 98 99 99 /* 100 100 private void initializeNonterminals() { … … 134 134 */ 135 135 private APIName constructNonterminalApi(Id grammarName) { 136 Option<APIName> optApi = grammarName.getApi ();136 Option<APIName> optApi = grammarName.getApiName(); 137 137 APIName api; 138 138 if (optApi.isSome()) … … 148 148 /** 149 149 * Given a disambiguated name (aliases and imports have been resolved), 150 * determine whether a nonterminal exists. Assumes {@code name.getApi ().isSome()}.150 * determine whether a nonterminal exists. Assumes {@code name.getApiName().isSome()}. 151 151 */ 152 152 public boolean hasQualifiedNonterminal(Id name) { 153 153 Debug.debug( Debug.Type.SYNTAX, 3, "Find a qualified id for non-terminal " + name ); 154 Option<APIName> optApi = name.getApi ();154 Option<APIName> optApi = name.getApiName(); 155 155 if (optApi.isNone()) 156 156 bug(name, "A qualified identifier is supposed to have an API name, but the api is not present"); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/NonterminalNameDisambiguator.java
r2674 r3123 98 98 public Option<Id> handleNonterminalName(NonterminalEnv currentEnv, Id name) { 99 99 // If it is already fully qualified 100 if (name.getApi ().isSome()) {101 APIName originalApiGrammar = name.getApi ().unwrap();100 if (name.getApiName().isSome()) { 101 APIName originalApiGrammar = name.getApiName().unwrap(); 102 102 Option<APIName> realApiGrammarOpt = this.grammarName(originalApiGrammar); 103 103 // Check that the qualifying part is a real grammar … … 123 123 if (1 == names.size()) { 124 124 Id qname = IterUtil.first(names); 125 return Option.some(qname); 125 return Option.some(qname); 126 126 } 127 127 // If the nonterminal is not defined in the current grammar then look … … 143 143 // // We need to repatriating the nonterminal to this grammar 144 144 // Id currentName = currentEnv.getGrammarIndex().getName(); 145 // APIName currentApi = currentName.getApi ().unwrap();145 // APIName currentApi = currentName.getApiName().unwrap(); 146 146 // Id qname = SyntaxAbstractionUtil.qualifyMemberName(currentApi, currentName.getText(), uqname); 147 147 Debug.debug( Debug.Type.SYNTAX, 4, uqname + " is qualified as " + IterUtil.first(names) ); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/TopLevelEnv.java
r3122 r3123 491 491 492 492 public boolean hasQualifiedTypeCons(Id name) { 493 Option<APIName> optApi= name.getApi ();493 Option<APIName> optApi= name.getApiName(); 494 494 if (optApi.isNone()) { 495 495 bug(name, "Expected to have an API name."); … … 504 504 505 505 public boolean hasQualifiedVariable(Id name) { 506 Option<APIName> optApi= name.getApi ();506 Option<APIName> optApi= name.getApiName(); 507 507 if (optApi.isNone()) 508 508 bug(name, "Expected to have an API name."); … … 515 515 516 516 public boolean hasQualifiedFunction(Id name) { 517 Option<APIName> optApi= name.getApi ();517 Option<APIName> optApi= name.getApiName(); 518 518 if (optApi.isNone()) 519 519 bug(name, "Expected to have an API name."); … … 526 526 527 527 public boolean hasQualifiedGrammar(Id name) { 528 Option<APIName> optApi= name.getApi ();528 Option<APIName> optApi= name.getApiName(); 529 529 if (optApi.isNone()) 530 530 bug(name, "Expected to have an API name."); … … 537 537 538 538 public TypeConsIndex typeConsIndex(final Id name) { 539 Option<APIName> api = name.getApi ();539 Option<APIName> api = name.getApiName(); 540 540 APIName actualApi; 541 541 // If no API in name or it's the current API, use its own typeCons. … … 566 566 public Option<GrammarIndex> grammarIndex(final Id name) { 567 567 String uqname = name.getText(); 568 if (name.getApi ().isSome()) {569 APIName n = name.getApi ().unwrap();568 if (name.getApiName().isSome()) { 569 APIName n = name.getApiName().unwrap(); 570 570 if (_filteredGlobalEnv.definesApi(n)) { 571 571 return Option.some(_filteredGlobalEnv.api(n).grammars().get(uqname)); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/TypeDisambiguator.java
r3122 r3123 283 283 Thunk<Type> variableHandler, 284 284 Lambda<Id, Type> typeConsHandler) { 285 if (n.getApi ().isSome()) {286 APIName originalApi = n.getApi ().unwrap();285 if (n.getApiName().isSome()) { 286 APIName originalApi = n.getApiName().unwrap(); 287 287 Option<APIName> realApiOpt = _env.apiName(originalApi); 288 288 if (realApiOpt.isNone()) { … … 342 342 343 343 @Override public StaticArg forTypeArg(final TypeArg a) { 344 final Type t = a.getType ();344 final Type t = a.getTypeArg(); 345 345 if (t instanceof VarType) { 346 346 final Span s = a.getSpan(); … … 482 482 483 483 private Id handleGrammarName(Id name) { 484 if (name.getApi ().isSome()) {485 APIName originalApi = name.getApi ().unwrap();484 if (name.getApiName().isSome()) { 485 APIName originalApi = name.getApiName().unwrap(); 486 486 Option<APIName> realApiOpt = _env.apiName(originalApi); 487 487 if (realApiOpt.isNone()) { … … 554 554 @Override 555 555 public Node forTypeArgOnly(final TypeArg arg, final Type t) { 556 if(arg.getType () instanceof VarType){557 Id name = ((VarType)arg.getType ()).getName();556 if(arg.getTypeArg() instanceof VarType){ 557 Id name = ((VarType)arg.getTypeArg()).getName(); 558 558 Option<StaticParam> param=this._env.hasTypeParam(name); 559 559 if(param.isSome()){ -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/FnDeclTypeEnv.java
r3095 r3123 66 66 if (var instanceof Id) { 67 67 Id _var = (Id)var; 68 if (_var.getApi ().isSome())68 if (_var.getApiName().isSome()) 69 69 return binding(new Id(_var.getSpan(), _var.getText())); 70 70 } … … 101 101 if (var instanceof Id) { 102 102 Id _var = (Id)var; 103 if (_var.getApi ().isSome())103 if (_var.getApiName().isSome()) 104 104 return declarationSite(new Id(_var.getSpan(), _var.getText())); 105 105 } -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/FnTypeEnv.java
r3122 r3123 103 103 // Ugh.. 104 104 TypeArg type_arg = (TypeArg)arg0; 105 VarType v = (VarType)type_arg.getType ();105 VarType v = (VarType)type_arg.getTypeArg(); 106 106 StaticParam p = new TypeParam(NodeFactory.makeSpan(v), v.getName()); 107 107 StaticArg a = NodeFactory.makeTypeArg(NodeFactory.make_InferenceVarType(p.getSpan())); … … 142 142 Span loc = _fn.declaringTrait().getSpan(); 143 143 // Make trait name fully qualified, since Constructors are not. 144 Id qualified_trait_name = NodeFactory.makeId(var.getApi (), _fn.declaringTrait());144 Id qualified_trait_name = NodeFactory.makeId(var.getApiName(), _fn.declaringTrait()); 145 145 Type selfType = makeTraitType(qualified_trait_name, 146 146 staticParamsToArgs(_fn.staticParameters())); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/StaticTypeReplacer.java
r2968 r3123 107 107 108 108 private Node updateNode(Node that, Id name) { 109 if (name.getApi ().isSome()) { return that; }109 if (name.getApiName().isSome()) { return that; } 110 110 StaticArg arg = parameterMap.get(name); 111 111 if (arg == null) { return that; } … … 113 113 // unwrap the StaticArg 114 114 return arg.accept(new NodeAbstractVisitor<Node>() { 115 @Override public Node forTypeArg(TypeArg arg) { return arg.getType (); }116 @Override public Node forIntArg(IntArg arg) { return arg.get Val(); }117 @Override public Node forBoolArg(BoolArg arg) { return arg.getBool (); }115 @Override public Node forTypeArg(TypeArg arg) { return arg.getTypeArg(); } 116 @Override public Node forIntArg(IntArg arg) { return arg.getIntVal(); } 117 @Override public Node forBoolArg(BoolArg arg) { return arg.getBoolArg(); } 118 118 @Override public Node forOpArg(OpArg arg) { return arg.getName(); } 119 @Override public Node forDimArg(DimArg arg) { return arg.getDim (); }120 @Override public Node forUnitArg(UnitArg arg) { return arg.getUnit (); }119 @Override public Node forDimArg(DimArg arg) { return arg.getDimArg(); } 120 @Override public Node forUnitArg(UnitArg arg) { return arg.getUnitArg(); } 121 121 }); 122 122 } … … 125 125 // ----------- VISITOR METHODS --------------- 126 126 127 128 127 128 129 129 @Override 130 130 public Node forVarType(VarType that) { … … 179 179 else { 180 180 ConstraintFormula valid= ConstraintFormula.TRUE; 181 181 182 182 Iterable<Pair<StaticParam,StaticArg>> zip = IterUtil.zip(static_params, static_args); 183 183 for(Pair<StaticParam,StaticArg> temp : zip){ 184 184 final StaticParam param = temp.first(); 185 final StaticArg arg = temp.second(); 185 final StaticArg arg = temp.second(); 186 186 NodeDepthFirstVisitor<Option<ConstraintFormula>> outer = new NodeDepthFirstVisitor<Option<ConstraintFormula>>() { 187 187 @Override … … 189 189 return InterpreterBug.bug("Static param has been extended since argMatchParams was written"); 190 190 } 191 191 192 192 @Override 193 193 public Option<ConstraintFormula> forBoolParam(BoolParam that) { … … 198 198 return arg.accept(inner); 199 199 } 200 200 201 201 @Override 202 202 public Option<ConstraintFormula> forDimParam(DimParam that) { … … 207 207 return arg.accept(inner); 208 208 } 209 209 210 210 @Override 211 211 public Option<ConstraintFormula> forIntParam(IntParam that) { … … 216 216 return arg.accept(inner); 217 217 } 218 218 219 219 @Override 220 220 public Option<ConstraintFormula> forNatParam(NatParam that) { … … 225 225 return arg.accept(inner); 226 226 } 227 227 228 228 @Override 229 229 public Option<ConstraintFormula> forTypeParam(final TypeParam param) { … … 232 232 @Override public Option<ConstraintFormula> forTypeArg(TypeArg arg) { 233 233 Type upperbound = NodeFactory.makeIntersectionType(CollectUtil.asSet(param.getExtendsClause())); 234 return Option.some(subtype_checker.subtype(arg.getType (),upperbound));234 return Option.some(subtype_checker.subtype(arg.getTypeArg(),upperbound)); 235 235 } 236 236 }; 237 237 return arg.accept(inner); 238 238 } 239 239 240 240 @Override 241 241 public Option<ConstraintFormula> forUnitParam(UnitParam that) { … … 246 246 return arg.accept(inner); 247 247 } 248 248 249 249 @Override 250 250 public Option<ConstraintFormula> forOpParam(OpParam that) { … … 256 256 } 257 257 }; 258 258 259 259 Option<ConstraintFormula> result = param.accept(outer); 260 260 if(result.isSome()){ -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/SubtypeChecker.java
r3114 r3123 96 96 ArrayType tt = (ArrayType)t; 97 97 Span span = tt.getSpan(); 98 TypeArg elem = NodeFactory.makeTypeArg(tt.get Type());98 TypeArg elem = NodeFactory.makeTypeArg(tt.getElemType()); 99 99 IntArg zero = NodeFactory.makeIntArgVal("0"); 100 100 List<ExtentRange> dims = tt.getIndices().getExtents(); … … 182 182 Id name = NodeFactory.makeId(span, WellKnownNames.fortressLibrary, "Matrix"); 183 183 return NodeFactory.makeTraitType(span, false, name, 184 NodeFactory.makeTypeArg(tt.get Type()),184 NodeFactory.makeTypeArg(tt.getElemType()), 185 185 first.getSize().unwrap(), 186 186 second.getSize().unwrap()); … … 210 210 if (isTypeArg(a)) 211 211 typeSubs.put(p.getName(), 212 ((TypeArg) a).getType ());212 ((TypeArg) a).getTypeArg()); 213 213 else error("A type parameter is instantiated with a " + 214 214 "non-type argument."); … … 223 223 if (isIntArg(a)) 224 224 intSubs.put(p.getName(), 225 ((IntArg)a).get Val());225 ((IntArg)a).getIntVal()); 226 226 else error("An integer parameter is instantiated with a " + 227 227 "non-integer argument."); … … 230 230 if (isIntArg(a)) 231 231 intSubs.put(p.getName(), 232 ((IntArg)a).get Val());232 ((IntArg)a).getIntVal()); 233 233 else error("A nat parameter is instantiated with a " + 234 234 "non-nat argument."); … … 237 237 if (isBoolArg(a)) 238 238 boolSubs.put(p.getName(), 239 ((BoolArg)a).getBool ());239 ((BoolArg)a).getBoolArg()); 240 240 else error("A bool parameter is instantiated with a " + 241 241 "non-bool argument."); … … 244 244 if (isDimArg(a)) 245 245 dimSubs.put(p.getName(), 246 ((DimArg)a).getDim ());246 ((DimArg)a).getDimArg()); 247 247 else error("A dimension parameter is instantiated with a " + 248 248 "non-dimension argument."); … … 251 251 if (isUnitArg(a)) 252 252 unitSubs.put(p.getName(), 253 ((UnitArg)a).getUnit ());253 ((UnitArg)a).getUnitArg()); 254 254 else error("A unit parameter is instantiated with a " + 255 255 "non-unit argument."); … … 316 316 private boolean isStaticParam(VarType t) { 317 317 Id name = t.getName(); 318 if (name.getApi ().isSome()) return false;319 else { // name.getApi ().isNone()318 if (name.getApiName().isSome()) return false; 319 else { // name.getApiName().isNone() 320 320 return _staticParamEnv.binding(name).isSome(); 321 321 } … … 325 325 List<BaseType> _extends = new ArrayList<BaseType>(); 326 326 Id name = t.getName(); 327 if (name.getApi ().isNone()) {327 if (name.getApiName().isNone()) { 328 328 Option<StaticParam> result = _staticParamEnv.binding(name); 329 329 if (result.isSome()) { … … 471 471 private boolean equivalent(StaticArg s, StaticArg t, SubtypeHistory h) { 472 472 if (isTypeArg(s) && isTypeArg(t)) { 473 return equivalent(((TypeArg)s).getType (), ((TypeArg)t).getType(), h);473 return equivalent(((TypeArg)s).getTypeArg(), ((TypeArg)t).getTypeArg(), h); 474 474 } else if (isOpArg(s) && isOpArg(t)) { 475 475 return nameString(((OpArg)s).getName().getOriginalName()).equals(((OpArg)t).getName()); … … 778 778 if (isVarType(s)) { 779 779 for (TraitTypeWhere _sup : traitIndex.extendsTypes()) { 780 BaseType sup = _sup.get Type();780 BaseType sup = _sup.getBaseType(); 781 781 if (subtype(sup, t, h)) return TRUE; 782 782 } … … 788 788 ((TraitType)s).getArgs()); 789 789 for (TraitTypeWhere _sup : traitIndex.extendsTypes()) { 790 BaseType sup = _sup.get Type();790 BaseType sup = _sup.getBaseType(); 791 791 if (subtype(subst.value(sup), t, h)) 792 792 return TRUE; -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TraitTable.java
r3071 r3123 43 43 Id simpleName = new Id(NodeFactory.makeSpan(name), name.getText()); 44 44 // TODO: Shouldn't qualified names only point to APIs? -- Dan 45 if (name.getApi ().isNone() ||46 currentCompilationUnit.ast().getName().equals(name.getApi ().unwrap())) {45 if (name.getApiName().isNone() || 46 currentCompilationUnit.ast().getName().equals(name.getApiName().unwrap())) { 47 47 result = currentCompilationUnit.typeConses().get(simpleName); 48 48 } 49 49 else { 50 ApiIndex api = globalEnv.api(name.getApi ().unwrap());50 ApiIndex api = globalEnv.api(name.getApiName().unwrap()); 51 51 if (api == null) { 52 52 return Option.none(); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeAnalyzer.java
r3114 r3123 350 350 List<BaseType> reduced = reduceDisjuncts(normalThrows.unwrap(), 351 351 _emptyHistory); 352 if (reduced.isEmpty()) { return new Effect(NodeFactory.makeSpan(e), e.isIo ()); }352 if (reduced.isEmpty()) { return new Effect(NodeFactory.makeSpan(e), e.isIoEffect()); } 353 353 else if (reduced.equals(e.getThrowsClause().unwrap())) { 354 354 return e; 355 355 } 356 356 else { 357 return new Effect(NodeFactory.makeSetSpan(e, reduced), Option.some(reduced), e.isIo ());357 return new Effect(NodeFactory.makeSetSpan(e, reduced), Option.some(reduced), e.isIoEffect()); 358 358 } 359 359 } … … 631 631 if (!f.isFalse()) { 632 632 // TODO: optimize substitution/normalization? 633 Type supT = sup.get Type();633 Type supT = sup.getBaseType(); 634 634 SubtypeHistory newH = containsVariable(supT, hidden) ? h.expand() : h; 635 635 Type supInstance = norm(subst.value(supT), newH); … … 1055 1055 @Override public ConstraintFormula forTypeArg(TypeArg a1) { 1056 1056 if (a2 instanceof TypeArg) { 1057 return equiv(a1.getType (), ((TypeArg) a2).getType(), history);1057 return equiv(a1.getTypeArg(), ((TypeArg) a2).getTypeArg(), history); 1058 1058 } 1059 1059 else { return FALSE; } … … 1061 1061 @Override public ConstraintFormula forIntArg(IntArg a1) { 1062 1062 if (a2 instanceof IntArg) { 1063 boolean result = a1.get Val().equals(((IntArg) a2).getVal());1063 boolean result = a1.getIntVal().equals(((IntArg) a2).getIntVal()); 1064 1064 return fromBoolean(result); 1065 1065 } … … 1068 1068 @Override public ConstraintFormula forBoolArg(BoolArg a1) { 1069 1069 if (a2 instanceof BoolArg) { 1070 boolean result = a1.getBool ().equals(((BoolArg) a2).getBool());1070 boolean result = a1.getBoolArg().equals(((BoolArg) a2).getBoolArg()); 1071 1071 return fromBoolean(result); 1072 1072 } … … 1082 1082 @Override public ConstraintFormula forDimArg(DimArg a1) { 1083 1083 if (a2 instanceof DimArg) { 1084 boolean result = a1.getDim ().equals(((DimArg) a2).getDim());1084 boolean result = a1.getDimArg().equals(((DimArg) a2).getDimArg()); 1085 1085 return fromBoolean(result); 1086 1086 } … … 1089 1089 @Override public ConstraintFormula forUnitArg(UnitArg a1) { 1090 1090 if (a2 instanceof UnitArg) { 1091 boolean result = a1.getUnit ().equals(((UnitArg) a2).getUnit());1091 boolean result = a1.getUnitArg().equals(((UnitArg) a2).getUnitArg()); 1092 1092 return fromBoolean(result); 1093 1093 } … … 1117 1117 /** Subtyping for Effects. */ 1118 1118 private ConstraintFormula sub(Effect s, Effect t, SubtypeHistory h) { 1119 if (!s.isIo () || t.isIo()) {1119 if (!s.isIoEffect() || t.isIoEffect()) { 1120 1120 List<BaseType> empty = Collections.<BaseType>emptyList(); 1121 1121 Type sThrows = makeUnion(IterUtil.<Type>relax(s.getThrowsClause().unwrap(empty))); -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeAnalyzerUtil.java
r3114 r3123 55 55 @Override public void forTypeParam(TypeParam p) { 56 56 typeSubs.put(p.getName(), 57 ((TypeArg) a).getType ());57 ((TypeArg) a).getTypeArg()); 58 58 } 59 59 @Override public void forOpParam(OpParam p) { … … 62 62 @Override public void forIntParam(IntParam p) { 63 63 intSubs.put(p.getName(), 64 ((IntArg) a).get Val());64 ((IntArg) a).getIntVal()); 65 65 } 66 66 @Override public void forNatParam(NatParam p) { 67 67 intSubs.put(p.getName(), 68 ((IntArg) a).get Val());68 ((IntArg) a).getIntVal()); 69 69 } 70 70 @Override public void forBoolParam(BoolParam p) { 71 71 boolSubs.put(p.getName(), 72 ((BoolArg) a).getBool ());72 ((BoolArg) a).getBoolArg()); 73 73 } 74 74 @Override public void forDimParam(DimParam p) { 75 75 dimSubs.put(p.getName(), 76 ((DimArg) a).getDim ());76 ((DimArg) a).getDimArg()); 77 77 } 78 78 @Override public void forUnitParam(UnitParam p) { 79 79 unitSubs.put(p.getName(), 80 ((UnitArg) a).getUnit ());80 ((UnitArg) a).getUnitArg()); 81 81 } 82 82 … … 158 158 private Boolean recurOnKeywords(List<KeywordType> ks) { 159 159 for (KeywordType k : ks) { 160 if (k.get Type().accept(this)) { return true; }160 if (k.getKeywordType().accept(this)) { return true; } 161 161 } 162 162 return false; … … 186 186 @Override public Boolean forBottomType(BottomType t) { return false; } 187 187 @Override public Boolean forVarType(VarType t) { 188 return t.getName().getApi ().isNone() && names.contains(t.getName());188 return t.getName().getApiName().isNone() && names.contains(t.getName()); 189 189 } 190 190 @Override public Boolean forTraitType(TraitType t) { … … 199 199 return recurOnList(t.getElements()); 200 200 } 201 @Override public Boolean forTypeArg(TypeArg t) { return t.getType ().accept(this); }201 @Override public Boolean forTypeArg(TypeArg t) { return t.getTypeArg().accept(this); } 202 202 @Override public Boolean forIntArg(IntArg t) { return false; } 203 203 @Override public Boolean forBoolArg(BoolArg t) { return false; } -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeChecker.java
r3122 r3123 590 590 // Map to list of supertypes 591 591 for( TraitTypeWhere ttw : index.extendsTypes() ) { 592 Type t = ttw.get Type();592 Type t = ttw.getBaseType(); 593 593 Type t_ = (Type)t.accept(new StaticTypeReplacer(trait_static_params, trait_static_args)); 594 594 new_supers.addAll(traitTypesCallable(t_)); … … 671 671 // we must visit the extended type with a static type replacer. 672 672 for( TraitTypeWhere ttw : trait_index.extendsTypes() ) { 673 Type t = (Type)ttw.get Type().accept(new StaticTypeReplacer(extended_type_params, extended_type_args));673 Type t = (Type)ttw.getBaseType().accept(new StaticTypeReplacer(extended_type_params, extended_type_args)); 674 674 new_supers.addAll(traitTypesCallable(t)); 675 675 } … … 744 744 // Map to list of supertypes 745 745 for( TraitTypeWhere ttw : trait_index.extendsTypes() ) { 746 new_supers.addAll(traitTypesCallable(ttw.get Type()));746 new_supers.addAll(traitTypesCallable(ttw.getBaseType())); 747 747 } 748 748 … … 858 858 List<Pair<FnRef, Type>> result = new ArrayList<Pair<FnRef, Type>>(overloadings.size()); 859 859 for( _RewriteFnRefOverloading overloading : overloadings ) { 860 result.add(Pair.make(overloading.getFn (), overloading.getTy()));860 result.add(Pair.make(overloading.getFnRef(), overloading.getTy())); 861 861 } 862 862 return result; … … 1060 1060 if(constraint.isSome()){ 1061 1061 TypeCheckerResult res=this.checkSubtype(element_result.type().unwrap(), 1062 ((TypeArg)that.getStaticArgs().get(0)).getType (), that,1063 element_result.type().unwrap()+" must be a subtype of "+((TypeArg)that.getStaticArgs().get(0)).getType ());1062 ((TypeArg)that.getStaticArgs().get(0)).getTypeArg(), that, 1063 element_result.type().unwrap()+" must be a subtype of "+((TypeArg)that.getStaticArgs().get(0)).getTypeArg()); 1064 1064 Type t=Types.makeArrayKType(1, that.getStaticArgs()); 1065 1065 Node new_node=new ArrayElement(that.getSpan(), that.isParenthesized(), Option.some(t), (List<StaticArg>) TypeCheckerResult.astFromResults(staticArgs_result), (Expr) element_result.ast()); … … 1094 1094 StaticArg arg = type.getArgs().get(i); 1095 1095 if(arg instanceof IntArg){ 1096 IntExpr iexpr = ((IntArg)arg).get Val();1096 IntExpr iexpr = ((IntArg)arg).getIntVal(); 1097 1097 if(iexpr instanceof NumberConstraint){ 1098 IntLiteralExpr dim = ((NumberConstraint) iexpr).get Val();1099 BigInteger n = dim.get Val();1098 IntLiteralExpr dim = ((NumberConstraint) iexpr).getIntVal(); 1099 BigInteger n = dim.getIntVal(); 1100 1100 dims.add(n); 1101 1101 } … … 1110 1110 Type t; 1111 1111 if(type.getArgs().get(0) instanceof TypeArg){ 1112 t = ((TypeArg)type.getArgs().get(0)).getType ();1112 t = ((TypeArg)type.getArgs().get(0)).getTypeArg(); 1113 1113 } 1114 1114 else{ … … 1206 1206 if(constraints.isSome()) { 1207 1207 // First arg MUST BE a TypeArg, and it must be a supertype of the elements 1208 Type declared_type = ((TypeArg)that.getStaticArgs().get(0)).getType ();1208 Type declared_type = ((TypeArg)that.getStaticArgs().get(0)).getTypeArg(); 1209 1209 all_results.add(this.checkSubtype(array_type, declared_type, that, "Array elements must be a subtype of explicity declared type" + declared_type + ".")); 1210 1210 //Check infered dims against explicit dims … … 1240 1240 @Override 1241 1241 public TypeCheckerResult forAsExpr(AsExpr that) { 1242 Type ascriptedType = that.get Type();1242 Type ascriptedType = that.getAnnType(); 1243 1243 TypeCheckerResult expr_result = that.getExpr().accept(this); 1244 1244 Type exprType = expr_result.type().isSome() ? expr_result.type().unwrap() : Types.BOTTOM; … … 1252 1252 @Override 1253 1253 public TypeCheckerResult forAsIfExpr(AsIfExpr that) { 1254 Type assumedType = that.get Type();1254 Type assumedType = that.getAnnType(); 1255 1255 TypeCheckerResult expr_result = that.getExpr().accept(this); 1256 1256 Type exprType = expr_result.type().isSome() ? expr_result.type().unwrap() : Types.BOTTOM; … … 1279 1279 1280 1280 List<TypeCheckerResult> lhs_results = new ArrayList<TypeCheckerResult>(that.getLhs().size()); 1281 List<OpRef> op_refs = that.get Opr().isSome() ? new ArrayList<OpRef>(that.getLhs().size()) : Collections.<OpRef>emptyList();1281 List<OpRef> op_refs = that.getAssignOp().isSome() ? new ArrayList<OpRef>(that.getLhs().size()) : Collections.<OpRef>emptyList(); 1282 1282 1283 1283 // Go through LHS, checking each one … … 1285 1285 for( Lhs lhs : that.getLhs() ) { 1286 1286 Type rhs_type = rhs_type_iter.next(); 1287 Pair<Option<OpRef>, TypeCheckerResult> p = checkLhsAssignment(lhs, rhs_type, that.get Opr());1287 Pair<Option<OpRef>, TypeCheckerResult> p = checkLhsAssignment(lhs, rhs_type, that.getAssignOp()); 1288 1288 lhs_results.add(p.second()); 1289 1289 … … 1293 1293 1294 1294 Assignment new_node; 1295 if( that.get Opr().isSome() ) {1295 if( that.getAssignOp().isSome() ) { 1296 1296 // Create a new Assignment, with an OpRef for each LHS 1297 1297 new_node = new Assignment(that.getSpan(), … … 1299 1299 Option.<Type>some(Types.VOID), 1300 1300 (List<Lhs>)TypeCheckerResult.astFromResults(lhs_results), 1301 that.get Opr(),1301 that.getAssignOp(), 1302 1302 (Expr)rhs_result.ast(), 1303 1303 Option.<List<OpRef>>some(op_refs)); … … 1309 1309 Option.<Type>some(Types.VOID), 1310 1310 (List<Lhs>)TypeCheckerResult.astFromResults(lhs_results), 1311 that.get Opr(),1311 that.getAssignOp(), 1312 1312 (Expr)rhs_result.ast()); 1313 1313 } … … 1332 1332 1333 1333 List<TypeCheckerResult> lhs_results = new ArrayList<TypeCheckerResult>(that.getLhs().size()); 1334 List<OpRef> op_refs = that.get Opr().isSome() ? new ArrayList<OpRef>(that.getLhs().size()) : Collections.<OpRef>emptyList();1334 List<OpRef> op_refs = that.getAssignOp().isSome() ? new ArrayList<OpRef>(that.getLhs().size()) : Collections.<OpRef>emptyList(); 1335 1335 1336 1336 // Go through LHS, checking each one … … 1338 1338 for( Lhs lhs : that.getLhs() ) { 1339 1339 Type rhs_type = rhs_type_iter.next(); 1340 Pair<Option<OpRef>, TypeCheckerResult> p = checkLhsAssignment(lhs, rhs_type, that.get Opr());1340 Pair<Option<OpRef>, TypeCheckerResult> p = checkLhsAssignment(lhs, rhs_type, that.getAssignOp()); 1341 1341 lhs_results.add(p.second()); 1342 1342 … … 1350 1350 Option.<Type>some(Types.VOID), 1351 1351 (List<Lhs>)TypeCheckerResult.astFromResults(lhs_results), 1352 that.get Opr(),1352 that.getAssignOp(), 1353 1353 (Expr)rhs_result.ast(), 1354 1354 Option.<List<OpRef>>some(op_refs)); … … 1363 1363 new_node = (Assignment)temp.second(); 1364 1364 if(!temp.first()){ 1365 String err = "No overloading for " + that.get Opr().unwrap();1365 String err = "No overloading for " + that.getAssignOp().unwrap(); 1366 1366 successful = new TypeCheckerResult(that, TypeError.make(err,that)); 1367 1367 } … … 1488 1488 "Type of right-hand side of assignment, " +rhs_type+ ", must be subtype of left-hand side, " + var_result.type() + "."); 1489 1489 1490 TypeEnv env = that.getVar ().getApi().isSome() ? returnTypeEnvForApi(that.getVar().getApi().unwrap()) : typeEnv;1491 Option<BindingLookup> bl = env.binding(that.getVar ());1490 TypeEnv env = that.getVarId().getApiName().isSome() ? returnTypeEnvForApi(that.getVarId().getApiName().unwrap()) : typeEnv; 1491 Option<BindingLookup> bl = env.binding(that.getVarId()); 1492 1492 if( bl.isNone() ) return bug("Inconsistent results from TypeEnv and typechecking VarRef"); 1493 1493 … … 1639 1639 public Triple<CaseClause, TypeCheckerResult, TypeCheckerResult> forCaseClause( 1640 1640 CaseClause that) { 1641 TypeCheckerResult match_result = that.getMatch ().accept(TypeChecker.this);1641 TypeCheckerResult match_result = that.getMatchClause().accept(TypeChecker.this); 1642 1642 TypeCheckerResult body_result = that.getBody().accept(TypeChecker.this); 1643 1643 CaseClause new_node = new CaseClause(that.getSpan(), (Expr)match_result.ast(), (Block)body_result.ast(), … … 1766 1766 private Pair<Type, TypeCheckerResult> forCaseClauseRewriteAndGetType(CaseClause clause, Option<TypeCheckerResult> param_result_, 1767 1767 Option<TypeCheckerResult> compare_result_, TypeCheckerResult equals_result, TypeCheckerResult in_result) { 1768 TypeCheckerResult match_result = recur(clause.getMatch ());1768 TypeCheckerResult match_result = recur(clause.getMatchClause()); 1769 1769 TypeCheckerResult block_result = recur(clause.getBody()); 1770 1770 … … 1840 1840 OpRef op = clause.getOp().unwrap(); 1841 1841 1842 TypeCheckerResult match_result = recur(clause.getMatch ());1842 TypeCheckerResult match_result = recur(clause.getMatchClause()); 1843 1843 TypeCheckerResult block_result = recur(clause.getBody()); 1844 1844 … … 1942 1942 private TypeCheckerResult forCatchClauseWithIdToBind(CatchClause that, 1943 1943 Id id_to_bind) { 1944 TypeCheckerResult match_result = that.getMatch ().accept(this);1944 TypeCheckerResult match_result = that.getMatchType().accept(this); 1945 1945 // type must be an exception 1946 TypeCheckerResult is_exn_result = checkSubtype(that.getMatch (), Types.EXCEPTION, that.getMatch(),1947 "Catch clauses must catch sub-types of Exception, but " + that.getMatch () + " is not.");1946 TypeCheckerResult is_exn_result = checkSubtype(that.getMatchType(), Types.EXCEPTION, that.getMatchType(), 1947 "Catch clauses must catch sub-types of Exception, but " + that.getMatchType() + " is not."); 1948 1948 1949 1949 // bind id and check the body 1950 LValue lval = NodeFactory.makeLValue(id_to_bind, that.getMatch ());1950 LValue lval = NodeFactory.makeLValue(id_to_bind, that.getMatchType()); 1951 1951 TypeChecker extend_tc = this.extend(Collections.singletonList(lval)); 1952 1952 TypeCheckerResult body_result = that.getBody().accept(extend_tc); … … 2006 2006 Option.<Type>some(Types.CHAR), 2007 2007 that.getText(), 2008 that.get Val());2008 that.getCharVal()); 2009 2009 return new TypeCheckerResult(new_node, Types.CHAR); 2010 2010 } … … 2069 2069 public TypeCheckerResult forDoFront(DoFront that) { 2070 2070 TypeCheckerResult bodyResult = 2071 that.isAtomic () ? forAtomic(2071 that.isAtomicBlock() ? forAtomic( 2072 2072 that.getExpr(), 2073 2073 errorMsg("A 'spawn' expression must not occur inside", … … 2092 2092 DoFront new_node = new DoFront(that.getSpan(), 2093 2093 (Option<Expr>)TypeCheckerResult.astFromResult(loc_result_), 2094 that.isAtomic (),2094 that.isAtomicBlock(), 2095 2095 (Block)bodyResult.ast()); 2096 2096 return TypeCheckerResult.compose(new_node, … … 2123 2123 @Override 2124 2124 public TypeCheckerResult forEnclosing(Enclosing that) { 2125 Option<APIName> api = that.getApi ();2125 Option<APIName> api = that.getApiName(); 2126 2126 TypeEnv env = api.isSome() ? returnTypeEnvForApi(api.unwrap()) : this.typeEnv; 2127 2127 … … 2709 2709 @Override 2710 2710 public TypeCheckerResult forId(Id name) { 2711 Option<APIName> apiName = name.getApi ();2711 Option<APIName> apiName = name.getApiName(); 2712 2712 if (apiName.isSome()) { 2713 2713 APIName api = apiName.unwrap(); … … 2722 2722 // Type was declared in that API, so it's not qualified; 2723 2723 // prepend it with the API. 2724 if (_namedType.getName().getApi ().isNone()) {2724 if (_namedType.getName().getApiName().isNone()) { 2725 2725 _type = NodeFactory.makeNamedType(api, (NamedType) type.unwrap()); 2726 2726 } … … 2757 2757 // For generalized 'if' we must introduce new bindings. 2758 2758 Pair<TypeCheckerResult, List<LValue>> result_and_binds = 2759 this.forGeneratorClauseGetBindings(that.getTest (), true);2759 this.forGeneratorClauseGetBindings(that.getTestClause(), true); 2760 2760 2761 2761 // Destruct result … … 2854 2854 @Override 2855 2855 public TypeCheckerResult forIntLiteralExpr(IntLiteralExpr that) { 2856 IntLiteralExpr new_node = new IntLiteralExpr(that.getSpan(), Option.<Type>some(Types.INT_LITERAL), that.getText(), that.get Val());2856 IntLiteralExpr new_node = new IntLiteralExpr(that.getSpan(), Option.<Type>some(Types.INT_LITERAL), that.getText(), that.getIntVal()); 2857 2857 return new TypeCheckerResult(new_node, Types.INT_LITERAL); 2858 2858 } … … 3378 3378 IterUtil.map(that.getExtendsClause(), new Lambda<TraitTypeWhere,TypeCheckerResult>(){ 3379 3379 public TypeCheckerResult value(TraitTypeWhere arg0) { 3380 return assertTrait(arg0.get Type(), that, "Objects can only extend traits.", arg0);3380 return assertTrait(arg0.getBaseType(), that, "Objects can only extend traits.", arg0); 3381 3381 }})); 3382 3382 … … 3455 3455 IterUtil.map(that.getExtendsClause(), new Lambda<TraitTypeWhere,TypeCheckerResult>() { 3456 3456 public TypeCheckerResult value(TraitTypeWhere arg0) { 3457 return assertTrait(arg0.get Type(), that, "Objects can only extend traits.", arg0);3457 return assertTrait(arg0.getBaseType(), that, "Objects can only extend traits.", arg0); 3458 3458 }})); 3459 3459 … … 3511 3511 @Override 3512 3512 public TypeCheckerResult forOp(Op that) { 3513 Option<APIName> api = that.getApi ();3513 Option<APIName> api = that.getApiName(); 3514 3514 3515 3515 Option<BindingLookup> binding; … … 3937 3937 IterUtil.map(that.getExtendsClause(), new Lambda<TraitTypeWhere,TypeCheckerResult>(){ 3938 3938 public TypeCheckerResult value(TraitTypeWhere arg0) { 3939 return assertTrait(arg0.get Type(), that, "Traits can only extend traits.", arg0);3939 return assertTrait(arg0.getBaseType(), that, "Traits can only extend traits.", arg0); 3940 3940 }})); 3941 3941 … … 4044 4044 4045 4045 // Check that all forbids are subtypes of exception 4046 List<TypeCheckerResult> forbids_exn = new ArrayList<TypeCheckerResult>(that.getForbid ().size());4047 for( Type t : that.getForbid () ) {4046 List<TypeCheckerResult> forbids_exn = new ArrayList<TypeCheckerResult>(that.getForbidClause().size()); 4047 for( Type t : that.getForbidClause() ) { 4048 4048 TypeCheckerResult r = 4049 4049 this.checkSubtype(t, Types.EXCEPTION, t,"All types in 'forbids' clause must be subtypes of " + … … 4125 4125 } 4126 4126 4127 final Type annotatedType = that.get Type();4127 final Type annotatedType = that.getAnnType(); 4128 4128 Type exprType = expr_result.type().unwrap(); 4129 4129 … … 4269 4269 private TypeCheckerResult forTypecaseClauseWithBindings(TypecaseClause clause, List<Id> to_bind, Type original_type) { 4270 4270 //Assumption: forTypeCase assures that original_type is a tuple of the same size as to_bind.size() 4271 List<TypeCheckerResult> match_result = recurOnListOfType(clause.getMatch ());4271 List<TypeCheckerResult> match_result = recurOnListOfType(clause.getMatchType()); 4272 4272 TypeChecker extend; 4273 4273 if(to_bind.size()==1){ 4274 4274 Type meet; 4275 if(clause.getMatch ().size()>1){4276 meet=this.subtypeChecker.meet(NodeFactory.makeTupleType(clause.getMatch ()),original_type);4275 if(clause.getMatchType().size()>1){ 4276 meet=this.subtypeChecker.meet(NodeFactory.makeTupleType(clause.getMatchType()),original_type); 4277 4277 } 4278 4278 else{ 4279 meet=this.subtypeChecker.meet(clause.getMatch ().get(0),original_type);4279 meet=this.subtypeChecker.meet(clause.getMatchType().get(0),original_type); 4280 4280 } 4281 4281 LValue bind = NodeFactory.makeLValue(to_bind.get(0), meet); 4282 4282 extend=this.extend(Collections.singletonList(bind)); 4283 4283 }else{ 4284 if(to_bind.size()!=clause.getMatch ().size()){4284 if(to_bind.size()!=clause.getMatchType().size()){ 4285 4285 return new TypeCheckerResult(clause, TypeError.make("Tuple sizes don't match",clause)); 4286 4286 } 4287 4287 else{ 4288 4288 List<LValue> binds=new ArrayList<LValue>(to_bind.size()); 4289 Iterator<Type> mitr=clause.getMatch ().iterator();4289 Iterator<Type> mitr=clause.getMatchType().iterator(); 4290 4290 assert(original_type instanceof TupleType); 4291 4291 TupleType tuple=(TupleType)original_type; … … 4395 4395 @Override 4396 4396 public TypeCheckerResult forWhile(While that) { 4397 Pair<TypeCheckerResult,List<LValue>> res = this.forGeneratorClauseGetBindings(that.getTest (), true);4397 Pair<TypeCheckerResult,List<LValue>> res = this.forGeneratorClauseGetBindings(that.getTestExpr(), true); 4398 4398 TypeChecker extended = this.extend(res.second()); 4399 4399 TypeCheckerResult body_result = that.getBody().accept(extended); … … 4472 4472 // } 4473 4473 4474 BaseType type_ = trait_.get Type();4474 BaseType type_ = trait_.getBaseType(); 4475 4475 4476 4476 if( h.hasExplored(type_) ) -
trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypesUtil.java
r3071 r3123 134 134 final Type fn_type, 135 135 final ArgList args, 136 final List<StaticArg> staticArgs, 136 final List<StaticArg> staticArgs, 137 137 final ConstraintFormula existingConstraint) { 138 138 // List of arrow types that statically match … … 196 196 } 197 197 }); 198 ConstraintFormula temp = pair.second().and(existingConstraint, checker.new SubtypeHistory()); 198 ConstraintFormula temp = pair.second().and(existingConstraint, checker.new SubtypeHistory()); 199 199 if(temp.isSatisfiable() ) { 200 200 matching_types.add(pair.first().unwrap()); … … 255 255 public static Option<Pair<Type,ConstraintFormula>> applicationType(final TypeAnalyzer checker, 256 256 final Type fn, 257 final ArgList args, 257 final ArgList args, 258 258 final ConstraintFormula existingConstraint) { 259 259 // Just a convenience method … … 372 372 public Boolean value() { return b; } 373 373 }; 374 374 375 375 ast.accept(new NodeDepthFirstVisitor_void() { 376 376 @Override … … 381 381 } 382 382 }); 383 383 384 384 return result_.value(); 385 385 } … … 393 393 return containsInferenceVarTypes(ast, null); 394 394 } 395 395 396 396 /** 397 397 * Attempts to apply the given static args to the given type, checking if the given type is … … 415 415 return Option.none(); 416 416 } 417 417 418 418 @Override 419 419 public Option<Pair<Type,ConstraintFormula>> forIntersectionType(IntersectionType that) { … … 436 436 public Option<Pair<Type,ConstraintFormula>> for_RewriteGenericArrowType( 437 437 _RewriteGenericArrowType that) { 438 438 439 439 Option<ConstraintFormula> constraints = StaticTypeReplacer.argsMatchParams(static_args,that.getStaticParams(), subtype_checker); 440 440 441 441 if(constraints.isSome()) { 442 442 _RewriteGenericArrowType temp = (_RewriteGenericArrowType) that.accept(new StaticTypeReplacer(that.getStaticParams(),static_args)); … … 464 464 new Lambda<TraitTypeWhere,Type>(){ 465 465 public Type value(TraitTypeWhere arg0) { 466 return arg0.get Type();466 return arg0.getBaseType(); 467 467 }})); 468 468 Type self_type = … … 484 484 return Pair.make(result.getNodeConstraints().isSatisfiable(), new_node); 485 485 } 486 486 487 487 /** 488 488 * Take a node with _InferenceVarType, and TypeCheckerResults, which containt … … 490 490 * in the node. 491 491 */ 492 public static Pair<Boolean,Node> closeConstraints(Node node, 492 public static Pair<Boolean,Node> closeConstraints(Node node, 493 493 TypeAnalyzer subtypeChecker, TypeCheckerResult... results) { 494 494 TypeCheckerResult result = TypeCheckerResult.compose(node, subtypeChecker, results); … … 499 499 public static List<StaticArg> staticArgsFromTypes(List<Type> types) { 500 500 if( types.isEmpty() ) return Collections.emptyList(); 501 501 502 502 List<StaticArg> result = new ArrayList<StaticArg>(types.size()); 503 503 for( Type ty : types ) { -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/BaseEnv.java
r3060 r3123 71 71 72 72 public Environment getHomeEnvironment(IdOrOpOrAnonymousName ioooan) { 73 Option<APIName> oapi = ioooan.getApi ();73 Option<APIName> oapi = ioooan.getApiName(); 74 74 if (oapi.isNone()) 75 75 return this; … … 439 439 return getTypeNull(name); // temp hack 440 440 } 441 441 442 442 public FType getRootTypeNull(String name) { 443 443 return getTypeNull(name); // temp hack 444 444 } 445 445 446 446 final public FType getTypeNull(Id name) { 447 447 String local = NodeUtil.nameSuffixString(name); 448 Option<APIName> opt_api = name.getApi ();448 Option<APIName> opt_api = name.getApiName(); 449 449 450 450 if (opt_api.isSome()) { … … 514 514 515 515 final public FValue getValueNull(VarRef vr) { 516 Id name = vr.getVar ();516 Id name = vr.getVarId(); 517 517 int l = vr.getLexicalDepth(); 518 518 return getValueNull(name, l); … … 528 528 //String s = NodeUtil.nameString(name); 529 529 String local = NodeUtil.nameSuffixString(name); 530 Option<APIName> opt_api = name.getApi ();530 Option<APIName> opt_api = name.getApiName(); 531 531 return getValueNullTail(name, l, local, opt_api); 532 532 } … … 536 536 // String s = NodeUtil.nameString(name); 537 537 String local = NodeUtil.nameSuffixString(name); 538 Option<APIName> opt_api = name.getApi ();538 Option<APIName> opt_api = name.getApiName(); 539 539 return getValueNullTail(name, l, local, opt_api); 540 540 … … 543 543 //String s = NodeUtil.nameString(name); 544 544 String local = NodeUtil.nameSuffixString(name); 545 Option<APIName> opt_api = name.getApi ();545 Option<APIName> opt_api = name.getApiName(); 546 546 return getValueTail(name, l, local, opt_api); 547 547 } … … 551 551 // String s = NodeUtil.nameString(name); 552 552 String local = NodeUtil.nameSuffixString(name); 553 Option<APIName> opt_api = name.getApi ();553 Option<APIName> opt_api = name.getApiName(); 554 554 return getValueTail(name, l, local, opt_api); 555 555 … … 788 788 } 789 789 } else if (negative_object_depth == 0) { 790 e = e.getTopLevel(); 790 e = e.getTopLevel(); 791 791 } else if (negative_object_depth < 0) { 792 792 // True only for MIN_VALUE -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/BuildTopLevelEnvironments.java
r3122 r3123 164 164 OverloadedFunction of = (OverloadedFunction) bindInto.getRootValue(s); 165 165 for (IdOrOpName fn : x.getFns()) { 166 Option<APIName> oapi = fn.getApi ();166 Option<APIName> oapi = fn.getApiName(); 167 167 FValue oapi_val = null; 168 168 -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/EvalType.java
r3122 r3123 334 334 @Override 335 335 public FType forBoolArg(BoolArg x) { 336 BoolExpr i = x.getBool ();336 BoolExpr i = x.getBoolArg(); 337 337 return i.accept(new NodeAbstractVisitor<FType>() { 338 338 private boolean boolify(BoolExpr ie) { … … 345 345 } 346 346 public FType forBoolConstant(BoolConstant b) { 347 return Bool.make(b.isBool ());347 return Bool.make(b.isBoolVal()); 348 348 } 349 349 public FType forBoolRef(BoolRef n) { … … 357 357 } 358 358 public FType forNotConstraint(NotConstraint n) { 359 return Bool.make(!boolify(n.getBool ()));359 return Bool.make(!boolify(n.getBoolVal())); 360 360 } 361 361 … … 386 386 387 387 public FType forBoolConstant(BoolConstant b) { 388 return Bool.make(b.isBool ());388 return Bool.make(b.isBoolVal()); 389 389 } 390 390 … … 427 427 @Override 428 428 public FType forIntArg(IntArg x) { 429 IntExpr i = x.get Val();429 IntExpr i = x.getIntVal(); 430 430 return i.accept(new NodeAbstractVisitor<FType>() { 431 431 private long longify(IntExpr ie) { … … 438 438 } 439 439 public FType forNumberConstraint(NumberConstraint n) { 440 return IntNat.make(n.get Val().getVal().intValue());440 return IntNat.make(n.getIntVal().getIntVal().intValue()); 441 441 } 442 442 public FType forIntRef(IntRef n) { … … 501 501 public FType forTypeArg(TypeArg x) { 502 502 try { 503 return x.getType ().accept(this);503 return x.getTypeArg().accept(this); 504 504 } 505 505 catch (FortressException pe) { … … 537 537 @Override 538 538 public FType forArrayType(ArrayType x) { 539 FType elt_type = x.get Type().accept(this);539 FType elt_type = x.getElemType().accept(this); 540 540 Indices indices = x.getIndices(); 541 541 … … 547 547 @Override 548 548 public FType forMatrixType(MatrixType x) { 549 FType elt_type = x.get Type().accept(this);549 FType elt_type = x.getElemType().accept(this); 550 550 List<ExtentRange> dimensions = x.getDimensions(); 551 551 List<TypeRange> typeRanges = new ArrayList<TypeRange>(); -
trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/Evaluator.java
r3111 r3123 218 218 final Expr expr = x.getExpr(); 219 219 FValue val = expr.accept(this); 220 Type ty = x.get Type();220 Type ty = x.getAnnType(); 221 221 FType fty = EvalType.getFType(ty, e); 222 222 if (val.type().subtypeOf(fty)) … … 230 230 final Expr expr = x.getExpr(); 231 231 FValue val = expr.accept(this); 232 Type ty = x.get Type();232 Type ty = x.getAnnType(); 233 233 FType fty = EvalType.getFType(ty, e); 234 234 if (val.type().subtypeOf(fty)) … … 242 242 // the operator case. Might this cause the world to break? 243 243 public FValue forAssignment(Assignment x) { 244 Option<OpRef> possOp = x.get Opr();244 Option<OpRef> possOp = x.getAssignOp(); 245 245 LHSToLValue getLValue = new LHSToLValue(this); 246 246 List<? extends Lhs> lhses = getLValue.inParallel(x.getLhs()); … … 370 370 FValue region = regionExp.accept(this); 371 371 } 372 if (f.isAtomic ())372 if (f.isAtomicBlock()) 373 373 return forAtomicExpr(new AtomicExpr(x.getSpan(), false, 374 374
