Changeset 3123

Show
Ignore:
Timestamp:
11/30/08 08:02:27 (12 months ago)
Author:
sukyoungryu
Message:

[ast refactoring] Renamed AST node fields: Use names (including field names) that are not Java reserved words, nor Scala reserved words, nor Fortress reserved words.

Location:
trunk/ProjectFortress
Files:
52 modified

Legend:

Unmodified
Added
Removed
  • trunk/ProjectFortress/astgen/Fortress.ast

    r3122 r3123  
    648648                 * expression annotated with a type 
    649649                 */ 
    650                 abstract TypeAnnotatedExpr(Expr expr, Type type); 
     650                abstract TypeAnnotatedExpr(Expr expr, Type annType); 
    651651                    /** 
    652652                     * type ascription expression 
     
    678678                 * opr, this node gives a separate OpRef for each Lhs. 
    679679                 */ 
    680                 Assignment(List<Lhs> lhs, Option<OpRef> opr, Expr rhs, 
     680                Assignment(List<Lhs> lhs, Option<OpRef> assignOp, Expr rhs, 
    681681                           Option<List<OpRef>> opsForLhs = Option.<List<OpRef>>none()); 
    682682                /** 
     
    786786                 */ 
    787787                Try(Block body, Option<Catch> catchClause = Option.<Catch>none(), 
    788                     List<BaseType> forbid = Collections.<BaseType>emptyList(), 
     788                    List<BaseType> forbidClause = Collections.<BaseType>emptyList(), 
    789789                    Option<Block> finallyClause = Option.<Block>none()); 
    790790                /** 
     
    828828                 * e.g.) while x < 10 do print x; x += 1 end 
    829829                 */ 
    830                 While(GeneratorClause test, Do body); 
     830                While(GeneratorClause testExpr, Do body); 
    831831                /** 
    832832                 * comprehension or accumulator 
     
    841841                     * e.g.) PROD[i <- 1:n] i 
    842842                     */ 
    843                     Accumulator(OpName opr, List<GeneratorClause> gens, Expr body); 
     843                    Accumulator(OpName accOp, List<GeneratorClause> gens, Expr body); 
    844844                    /** 
    845845                     * array comprehension 
     
    981981                                 * e.g.) 7 
    982982                                 */ 
    983                                 IntLiteralExpr(String text = in_val.toString(), 
    984                                                BigInteger val); 
     983                                IntLiteralExpr(String text = in_intVal.toString(), 
     984                                               BigInteger intVal); 
    985985                            /** 
    986986                             * char literal 
    987987                             * e.g.) 'c' 
    988988                             */ 
    989                             CharLiteralExpr(int val = in_text.charAt(0)); 
     989                            CharLiteralExpr(int charVal = in_text.charAt(0)); 
    990990                            /** 
    991991                             * string literal 
     
    10041004                         * e.g.) length 
    10051005                         */ 
    1006                         VarRef(Id var, int lexicalDepth=-2147483648) implements Lhs; 
     1006                        VarRef(Id varId, int lexicalDepth=-2147483648) implements Lhs; 
    10071007                        /** 
    10081008                         * A reference to a singleton object. Created at typechecking or disambiguation-time. 
     
    10491049                         * list from a FnRef into something else. 
    10501050                         */ 
    1051                         _RewriteFnRef(Expr fn, 
    1052                                           List<StaticArg> staticArgs 
    1053                                               = Collections.<StaticArg>emptyList()); 
     1051                        _RewriteFnRef(Expr fnExpr, 
     1052                                      List<StaticArg> staticArgs 
     1053                                          = Collections.<StaticArg>emptyList()); 
    10541054                        /** 
    10551055                         * named functional in functional applications 
     
    11671167                         * after inferring the implicit coercion invocations 
    11681168                         */ 
    1169                         CoercionInvocation(BaseType type, 
     1169                        CoercionInvocation(BaseType toType, 
    11701170                                           List<StaticArg> staticArgs 
    11711171                                               = Collections.<StaticArg>emptyList(), 
     
    12621262                     * e.g.) Time squared 
    12631263                     */ 
    1264                     OpDim(DimExpr val, Op op); 
     1264                    OpDim(DimExpr dimVal, Op op); 
    12651265                /** 
    12661266                 * base types: things that can be extended, excluded, thrown, etc. 
     
    13021302                     * abbreviated type 
    13031303                     */ 
    1304                     abstract AbbreviatedType(Type type); 
     1304                    abstract AbbreviatedType(Type elemType); 
    13051305                        /** 
    13061306                         * array type 
     
    13211321                         * e.g.) RR64 Length 
    13221322                         */ 
    1323                         TaggedDimType(DimExpr dim, 
    1324                                       Option<Expr> unit = Option.<Expr>none()); 
     1323                        TaggedDimType(DimExpr dimExpr, 
     1324                                      Option<Expr> unitExpr = Option.<Expr>none()); 
    13251325                        /** 
    13261326                         * type with unit 
     
    13281328                         * e.g.) RR64 meter 
    13291329                         */ 
    1330                         TaggedUnitType(Expr unit); 
     1330                        TaggedUnitType(Expr unitExpr); 
    13311331                /** 
    13321332                 * tuple-like types 
     
    14021402             */ 
    14031403            Effect(Option<List<BaseType>> throwsClause = Option.<List<BaseType>>none(), 
    1404                    boolean io = false); 
     1404                   boolean ioEffect = false); 
    14051405            /** 
    14061406             * static argument 
     
    14121412                 * e.g.) List[\ZZ64\] 
    14131413                 */ 
    1414                 TypeArg(Type type); 
     1414                TypeArg(Type typeArg); 
    14151415                /** 
    14161416                 * integer used as static argument 
     
    14181418                 * e.g.) m + n 
    14191419                 */ 
    1420                 IntArg(IntExpr val); 
     1420                IntArg(IntExpr intVal); 
    14211421                /** 
    14221422                 * boolean used as static argument 
     
    14241424                 * e.g.) ninf OR pinf 
    14251425                 */ 
    1426                 BoolArg(BoolExpr bool); 
     1426                BoolArg(BoolExpr boolArg); 
    14271427                /** 
    14281428                 * operator used as static argument 
     
    14361436                 * e.g.) Unity 
    14371437                 */ 
    1438                 DimArg(DimExpr dim); 
     1438                DimArg(DimExpr dimArg); 
    14391439                /** 
    14401440                 * unit used as static argument 
     
    14421442                 * e.g.) dimensionless 
    14431443                 */ 
    1444                 UnitArg(UnitExpr unit); 
     1444                UnitArg(UnitExpr unitArg); 
    14451445            /** 
    14461446             * static expression 
     
    14621462                         * e.g.) 8 
    14631463                         */ 
    1464                         NumberConstraint(IntLiteralExpr val); 
     1464                        NumberConstraint(IntLiteralExpr intVal); 
    14651465                        /** 
    14661466                         * integer identifier 
     
    15131513                         * e.g.) true 
    15141514                         */ 
    1515                         BoolConstant(boolean bool); 
     1515                        BoolConstant(boolean boolVal); 
    15161516                        /** 
    15171517                         * boolean identiier 
     
    15301530                         * e.g.) NOT ninf 
    15311531                         */ 
    1532                         NotConstraint(BoolExpr bool); 
     1532                        NotConstraint(BoolExpr boolVal); 
    15331533                        /** 
    15341534                         * binary boolean constraint 
     
    17181718             * e.g.) requires { n GE 0 } ensures { outcome GE 0 } 
    17191719             */ 
    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 = 
    17221722                         Option.<List<EnsuresClause>>none(), 
    1723                      Option<List<Expr>> invariants = Option.<List<Expr>>none()); 
     1723                     Option<List<Expr>> invariantsClause = Option.<List<Expr>>none()); 
    17241724            /** 
    17251725             * ensures clause used in contracts 
     
    18491849                    TypeParam(List<BaseType> extendsClause = 
    18501850                                  Collections.<BaseType>emptyList(), 
    1851                               boolean absorbs = false); 
     1851                              boolean absorbsParam = false); 
    18521852                   /** 
    18531853                    * unit parameter 
     
    18551855                    * e.g.) unit U absrbs unit 
    18561856                    */ 
    1857                     UnitParam(Option<Type> dim = Option.<Type>none(), 
    1858                               boolean absorbs = false); 
     1857                    UnitParam(Option<Type> dimParam = Option.<Type>none(), 
     1858                              boolean absorbsParam = false); 
    18591859            /** 
    18601860             * name used in declarations and references 
     
    18761876                 *              | opr EncloserPair 
    18771877                 */ 
    1878                 abstract IdOrOpOrAnonymousName(Option<APIName> api 
     1878                abstract IdOrOpOrAnonymousName(Option<APIName> apiName 
    18791879                                                   = Option.<APIName>none()); 
    18801880                    /** 
     
    19491949             * because different ops can be chosen for different clauses. 
    19501950             */ 
    1951             CaseClause(Expr match, Block body, 
     1951            CaseClause(Expr matchClause, Block body, 
    19521952                       Option<OpRef> op = Option.<OpRef>none()); 
    19531953            /** 
     
    19631963             * e.g.) IOException => throw ForbiddenException(e) 
    19641964             */ 
    1965             CatchClause(BaseType match, Block body); 
     1965            CatchClause(BaseType matchType, Block body); 
    19661966            /** 
    19671967             * block expression used in do expressions 
     
    19691969             * e.g.) at a.region(j) do w := a_j 
    19701970             */ 
    1971             DoFront(Option<Expr> loc = Option.<Expr>none(), boolean atomic = false, 
     1971            DoFront(Option<Expr> loc = Option.<Expr>none(), 
     1972                    boolean atomicBlock = false, 
    19721973                    Block expr); 
    19731974            /** 
     
    19771978             * e.g.) if x IN { 0, 1, 2 } then 0 
    19781979             */ 
    1979             IfClause(GeneratorClause test, Block body); 
     1980            IfClause(GeneratorClause testClause, Block body); 
    19801981            /** 
    19811982             * typecase clause used in typecase expressions 
     
    19851986             * e.g.) String => x.append("foo") 
    19861987             */ 
    1987             TypecaseClause(List<Type> match, Block body); 
     1988            TypecaseClause(List<Type> matchType, Block body); 
    19881989            /** 
    19891990             * array and matrix size 
     
    20122013             * e.g.) x = String 
    20132014             */ 
    2014             KeywordType(Id name, Type type); 
     2015            KeywordType(Id name, Type keywordType); 
    20152016            /** 
    20162017             * trait type with a where clause used in extends clauses 
     
    20182019             * e.g.) T[\ninf, nan\] where { ninf AND NOT nan } 
    20192020             */ 
    2020             TraitTypeWhere(BaseType type, 
     2021            TraitTypeWhere(BaseType baseType, 
    20212022                           Option<WhereClause> whereClause 
    20222023                               = Option.<WhereClause>none()); 
     
    21152116             * in the Printer and UnPrinter so be careful if Level is changed. 
    21162117             */ 
    2117             Level(Integer level, Object object); 
     2118            Level(Integer level, Object _object); 
    21182119            /* 
    21192120             * An overloading, and the type of that particular overloading. 
    21202121             */ 
    2121             _RewriteFnRefOverloading(FnRef fn, Type ty); 
     2122            _RewriteFnRefOverloading(FnRef fnRef, Type ty); 
    21222123            /** 
    21232124             * An operator overloading, and the tpye of that overloading. 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/Types.java

    r3114 r3123  
    271271                Map<Id, Type> result = new LinkedHashMap<Id, Type>(8); 
    272272                for (KeywordType k : _d.getKeywords()) { 
    273                     result.put(k.getName(), k.getType()); 
     273                    result.put(k.getName(), k.getKeywordType()); 
    274274                } 
    275275                return result; 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/DesugaringVisitor.java

    r3122 r3123  
    244244                VarRef obj = (VarRef)rewrite.getObj(); 
    245245                obj = ExprFactory.makeVarRef(obj, obj.getExprType(), 
    246                                              mangleName(obj.getVar())); 
     246                                             mangleName(obj.getVarId())); 
    247247                body = (Expr)forFieldRefOnly(rewrite, field.getIdType(), 
    248248                                             obj, rewrite.getField()); 
     
    289289                VarRef obj = (VarRef)rewrite.getObj(); 
    290290                obj = ExprFactory.makeVarRef(obj, obj.getExprType(), 
    291                                              mangleName(obj.getVar())); 
     291                                             mangleName(obj.getVarId())); 
    292292                assign = ExprFactory.makeMethodInvocation(rewrite.getSpan(), false, 
    293293                                                          Option.some(voidType), obj, 
     
    403403                        left.add((Lhs)lhs_that.accept(DesugaringVisitor.this)); 
    404404                        return ExprFactory.makeAssignment(span, voidType, left, 
    405                                                           that.getOpr(), rhs_result); 
     405                                                          that.getAssignOp(), rhs_result); 
    406406                    } 
    407407                    public Node forSubscriptExpr(SubscriptExpr lhs_that) { 
     
    409409                        left.add((Lhs)lhs_that.accept(DesugaringVisitor.this)); 
    410410                        return ExprFactory.makeAssignment(span, voidType, left, 
    411                                                           that.getOpr(), rhs_result); 
     411                                                          that.getAssignOp(), rhs_result); 
    412412                    } 
    413413                    public Node forFieldRef(FieldRef lhs_that) { 
    414414                        Expr obj = (Expr) lhs_that.getObj().accept(DesugaringVisitor.this); 
    415415                        Expr rhs = rhs_result; 
    416                         if ( that.getOpr().isSome() ) { 
     416                        if ( that.getAssignOp().isSome() ) { 
    417417                            Expr _lhs = (Expr)lhs_that.accept(DesugaringVisitor.this); 
    418418                            rhs = ExprFactory.makeOpExpr(span, lhs_that.getExprType(), 
    419                                                          that.getOpr().unwrap(), 
     419                                                         that.getAssignOp().unwrap(), 
    420420                                                         _lhs, rhs); 
    421421                        } 
     
    429429                            Expr obj = (Expr) lhs_that.getObj().accept(DesugaringVisitor.this); 
    430430                            Expr rhs = rhs_result; 
    431                             if ( that.getOpr().isSome() ) { 
     431                            if ( that.getAssignOp().isSome() ) { 
    432432                                Expr _lhs = (Expr)lhs_that.accept(DesugaringVisitor.this); 
    433433                                rhs = ExprFactory.makeOpExpr(span, lhs_that.getExprType(), 
    434                                                              that.getOpr().unwrap(), 
     434                                                             that.getAssignOp().unwrap(), 
    435435                                                             _lhs, rhs); 
    436436                            } 
     
    443443                            return ExprFactory.makeAssignment(span, voidType, 
    444444                                                              that.getLhs(), 
    445                                                               that.getOpr(), 
     445                                                              that.getAssignOp(), 
    446446                                                              rhs_result); 
    447447                    } 
     
    467467            */ 
    468468            boolean paren = that.isParenthesized(); 
    469             Option<OpRef> opr = that.getOpr(); 
     469            Option<OpRef> opr = that.getAssignOp(); 
    470470            List<Expr>   assigns   = new ArrayList<Expr>(); 
    471471            List<LValue> secondLhs = new ArrayList<LValue>(); 
     
    500500                              Id varResult) { 
    501501        // After disambiguation, the Id in a VarRef should have an empty API. 
    502         assert(varResult.getApi().isNone()); 
     502        assert(varResult.getApiName().isNone()); 
    503503 
    504504        if (fieldsInScope.contains(varResult)) { 
     
    523523                             Option<List<_RewriteFnRefOverloading>> overloadings_result) { 
    524524        // After disambiguation, the Id in a FnRef should have an empty API. 
    525         assert(fnResult.getApi().isNone()); 
     525        assert(fnResult.getApiName().isNone()); 
    526526 
    527527        if (fieldsInScope.contains(fnResult)) { 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/FreeNameCollection.java

    r2999 r3123  
    6464    private List<VarRef> freeMutableVarRefs = new LinkedList<VarRef>(); 
    6565 
    66     // free exit labels  
     66    // free exit labels 
    6767    private List<Exit> freeExitLabels = new LinkedList<Exit>(); 
    6868 
     
    9090        this.freeMutableVarRefs.addAll(other.freeMutableVarRefs); 
    9191        this.freeExitLabels.addAll(other.freeExitLabels); 
    92          
     92 
    9393        if( other.enclosingSelfType.isSome() ) { 
    9494            this.enclosingSelfType = 
     
    129129 
    130130        for(VarRef var : freeVarRefs) { 
    131             Option<StaticParam> spOp = typeEnv.staticParam( var.getVar() ); 
     131            Option<StaticParam> spOp = typeEnv.staticParam( var.getVarId() ); 
    132132            if( spOp.isNone() ) { // it's not a static param 
    133133                newFreeVarRefs.add(var); 
    134134            } else if( spOp.unwrap() instanceof BoolParam ) { 
    135                 this.add( new BoolRef(var.getSpan(), var.getVar()) ); 
     135                this.add( new BoolRef(var.getSpan(), var.getVarId()) ); 
    136136            } else if( spOp.unwrap() instanceof IntParam ) { 
    137                 this.add( new IntRef(var.getSpan(), var.getVar()) ); 
     137                this.add( new IntRef(var.getSpan(), var.getVarId()) ); 
    138138            } else if( spOp.unwrap() instanceof NatParam ) { 
    139                 this.add( new IntRef(var.getSpan(), var.getVar()) ); 
     139                this.add( new IntRef(var.getSpan(), var.getVarId()) ); 
    140140            } else { 
    141141                throw new DesugarerError( "Unexpected Static Param type " + 
     
    211211                this.freeIntRefs.equals( other.freeIntRefs ) && 
    212212                this.freeBoolRefs.equals( other.freeBoolRefs ) && 
    213                 this.freeVarTypes.equals( other.freeVarTypes ) &&  
     213                this.freeVarTypes.equals( other.freeVarTypes ) && 
    214214                this.freeMutableVarRefs.equals( other.freeMutableVarRefs ) && 
    215                 this.freeExitLabels.equals( other.freeExitLabels) );  
     215                this.freeExitLabels.equals( other.freeExitLabels) ); 
    216216    } 
    217217 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/FreeNameCollector.java

    r3122 r3123  
    269269            for(VarRef var : mutableVars) { 
    270270                Option<Node> declNodeOp = 
    271                     objExprTypeEnv.declarationSite( var.getVar() ); 
     271                    objExprTypeEnv.declarationSite( var.getVarId() ); 
    272272                        if(declNodeOp.isNone()) { 
    273273                            throw new DesugarerError( var.getSpan(), 
     
    402402        forVarRefDoFirst(that); 
    403403        recurOnOptionOfType(that.getExprType()); 
    404         recur(that.getVar()); 
     404        recur(that.getVarId()); 
    405405 
    406406                Debug.debug(Debug.Type.COMPILER, 
    407407                    DEBUG_LEVEL0, "FreeNameCollector visiting ", that); 
    408408 
    409         boolean isDecledInObjExpr = isDeclaredInObjExpr(that.getVar()); 
    410         boolean isDecledAtTopLevel = isDeclaredAtTopLevel(that.getVar()); 
     409        boolean isDecledInObjExpr = isDeclaredInObjExpr(that.getVarId()); 
     410        boolean isDecledAtTopLevel = isDeclaredAtTopLevel(that.getVarId()); 
    411411        boolean isShadowed = false; 
    412412 
    413413        if(enclosingTraitDecl.isSome()) { 
    414414            isShadowed = isShadowedInNode( enclosingTraitDecl.unwrap(), 
    415                                            that.getVar() ); 
     415                                           that.getVarId() ); 
    416416        } else if(enclosingObjectDecl.isSome()) { 
    417417            isShadowed = isShadowedInNode( enclosingObjectDecl.unwrap(), 
    418                                            that.getVar() ); 
     418                                           that.getVarId() ); 
    419419        } 
    420420 
     
    886886 
    887887        for(VarRef var : freeVarRefs) { 
    888             Option<Boolean> isMutable = typeEnv.mutable( var.getVar() ); 
     888            Option<Boolean> isMutable = typeEnv.mutable( var.getVarId() ); 
    889889            if( isMutable.isNone() ) { 
    890890                throw new DesugarerError("Binding for VarRef " + 
     
    978978        @Override 
    979979        public void forTraitTypeWhere(TraitTypeWhere that) { 
    980             BaseType baseType = that.getType(); 
     980            BaseType baseType = that.getBaseType(); 
    981981            if( (baseType instanceof NamedType) == false ) { 
    982982                throw new DesugarerError(that.getSpan(), 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/ObjectExpressionVisitor.java

    r3122 r3123  
    209209                VarRefContainer container = mutableVarRefContainerMap.get(var); 
    210210                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() ); 
    212212                // Use an empty span; the correct span will be filled in 
    213213                // later at the use site 
     
    542542                    } else { 
    543543                        throw new DesugarerError(objExpr.getSpan(), 
    544                             var.getVar() + " is mutable but not found in " 
     544                            var.getVarId() + " is mutable but not found in " 
    545545                            + "the mutableVarRefContainerMap!"); 
    546546                    } 
    547547                }  else { 
    548548                    VarRef newVar = 
    549                         ExprFactory.makeVarRef( var.getSpan(), var.getVar() ); 
     549                        ExprFactory.makeVarRef( var.getSpan(), var.getVarId() ); 
    550550                    exprs.add(newVar); 
    551551                } 
     
    735735                    } else { 
    736736                        throw new DesugarerError(target.getSpan(), 
    737                             var.getVar() + " is mutable but not found in " 
     737                            var.getVarId() + " is mutable but not found in " 
    738738                            + "the mutableVarRefContainerMap!"); 
    739739                    } 
     
    744744                    type = var.getExprType(); 
    745745                    param = NodeFactory.makeParam(var.getSpan(), 
    746                                                         var.getVar(), type); 
     746                                                        var.getVarId(), type); 
    747747                    params.add(param); 
    748748                } 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/PreDisambiguationDesugaringVisitor.java

    r3102 r3123  
    181181        public Node forAccumulator(Accumulator that) { 
    182182        return visitAccumulator(that.getSpan(), that.getGens(), 
    183                                 that.getOpr(), that.getBody(), 
     183                                that.getAccOp(), that.getBody(), 
    184184                                that.getStaticArgs()); 
    185185    } 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/VarRefContainer.java

    r3115 r3123  
    6868        String name = ObjectExpressionVisitor.MANGLE_CHAR + 
    6969            CONTAINER_DECL_PREFIX + "_" + uniqueSuffix + 
    70             "_" + origVar.getVar().getText(); 
     70            "_" + origVar.getVarId().getText(); 
    7171        return NodeFactory.makeId( origDeclNode.getSpan(), name ); 
    7272    } 
     
    7575        String name = ObjectExpressionVisitor.MANGLE_CHAR + 
    7676            CONTAINER_FIELD_PREFIX + "_" + uniqueSuffix + 
    77             "_" + origVar.getVar().getText(); 
     77            "_" + origVar.getVarId().getText(); 
    7878        return NodeFactory.makeId( origDeclNode.getSpan(), name ); 
    7979    } 
     
    131131        return ExprFactory.makeFieldRef( varRefSpan, 
    132132                                         this.containerVarRef(varRefSpan), 
    133                                          origVar.getVar() ); 
     133                                         origVar.getVarId() ); 
    134134    } 
    135135 
     
    150150        List<Modifier> mods = new LinkedList<Modifier>(); 
    151151        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); 
    153153        return param; 
    154154    } 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/ExprDisambiguator.java

    r3122 r3123  
    573573        for( TraitTypeWhere trait_ : extended_traits ) { 
    574574 
    575             BaseType type_ = trait_.getType(); 
     575            BaseType type_ = trait_.getBaseType(); 
    576576 
    577577            if( h.hasExplored(type_) ) 
     
    764764        public Node forTaggedDimType(TaggedDimType that) { 
    765765        return forTaggedDimTypeOnly(that, 
    766                                     (Type)that.getType().accept(this), 
    767                                     that.getDim(), 
    768                                     that.getUnit()); 
     766                                    (Type)that.getElemType().accept(this), 
     767                                    that.getDimExpr(), 
     768                                    that.getUnitExpr()); 
    769769    } 
    770770 
     
    775775        public Node forTaggedUnitType(TaggedUnitType that) { 
    776776        return forTaggedUnitTypeOnly(that, 
    777                                      (Type)that.getType().accept(this), 
    778                                      that.getUnit()); 
     777                                     (Type)that.getElemType().accept(this), 
     778                                     that.getUnitExpr()); 
    779779    } 
    780780 
     
    826826        ExprDisambiguator v = extendWithOutcome(that.getSpan()); 
    827827        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())); 
    831831    } 
    832832 
     
    850850        return forAccumulatorOnly(that, type_result, 
    851851                                  recurOnListOfStaticArg(that.getStaticArgs()), 
    852                                   (OpName)that.getOpr().accept(this), 
     852                                  (OpName)that.getAccOp().accept(this), 
    853853                                  pair.first(), 
    854854                                  (Expr)that.getBody().accept(extended_d)); 
     
    861861    @Override 
    862862        public Node forIfClause(IfClause that) { 
    863         GeneratorClause gen = that.getTest(); 
     863        GeneratorClause gen = that.getTestClause(); 
    864864        ExprDisambiguator e_d = this.extendWithVars(Useful.set(gen.getBind())); 
    865865 
    866866        return forIfClauseOnly(that, 
    867                                (GeneratorClause)that.getTest().accept(this), 
     867                               (GeneratorClause)that.getTestClause().accept(this), 
    868868                               (Block)that.getBody().accept(e_d)); 
    869869    } 
     
    874874    @Override 
    875875        public Node forWhile(While that) { 
    876         GeneratorClause gen = that.getTest(); 
     876        GeneratorClause gen = that.getTestExpr(); 
    877877        ExprDisambiguator e_d = this.extendWithVars(Useful.set(gen.getBind())); 
    878878 
    879879        Option<Type> type_result = recurOnOptionOfType(that.getExprType()); 
    880880        return forWhileOnly(that, type_result, 
    881                             (GeneratorClause)that.getTest().accept(this), 
     881                            (GeneratorClause)that.getTestExpr().accept(this), 
    882882                            (Do)that.getBody().accept(e_d)); 
    883883    } 
     
    961961    /** VarRefs can be made qualified or translated into FnRefs. */ 
    962962    @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(); 
    965965        ConsList<Id> fields = ConsList.empty(); 
    966966        Expr result = null; 
     
    10131013                Id newName = IterUtil.first(vars); 
    10141014 
    1015                 if (newName.getApi().isNone() && newName == name && fields.isEmpty()) { 
     1015                if (newName.getApiName().isNone() && newName == name && fields.isEmpty()) { 
    10161016                    // no change -- no need to recreate the VarRef 
    10171017                    return that; 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/NonterminalEnv.java

    r2746 r3123  
    9696        } 
    9797    } 
    98      
     98 
    9999    /* 
    100100    private void initializeNonterminals() { 
     
    134134     */ 
    135135    private APIName constructNonterminalApi(Id grammarName) { 
    136         Option<APIName> optApi = grammarName.getApi(); 
     136        Option<APIName> optApi = grammarName.getApiName(); 
    137137        APIName api; 
    138138        if (optApi.isSome()) 
     
    148148    /** 
    149149     * 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()}. 
    151151     */ 
    152152    public boolean hasQualifiedNonterminal(Id name) { 
    153153        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(); 
    155155        if (optApi.isNone()) 
    156156            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  
    9898        public Option<Id> handleNonterminalName(NonterminalEnv currentEnv, Id name) { 
    9999            // 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(); 
    102102                Option<APIName> realApiGrammarOpt = this.grammarName(originalApiGrammar); 
    103103                // Check that the qualifying part is a real grammar 
     
    123123                if (1 == names.size()) { 
    124124                    Id qname = IterUtil.first(names); 
    125                     return Option.some(qname);    
     125                    return Option.some(qname); 
    126126                } 
    127127                // If the nonterminal is not defined in the current grammar then look 
     
    143143                    //                          // We need to repatriating the nonterminal to this grammar 
    144144                    //                          Id currentName = currentEnv.getGrammarIndex().getName(); 
    145                     //                APIName currentApi = currentName.getApi().unwrap(); 
     145                    //                APIName currentApi = currentName.getApiName().unwrap(); 
    146146                    //                          Id qname = SyntaxAbstractionUtil.qualifyMemberName(currentApi, currentName.getText(), uqname); 
    147147                    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  
    491491 
    492492    public boolean hasQualifiedTypeCons(Id name) { 
    493         Option<APIName> optApi= name.getApi(); 
     493        Option<APIName> optApi= name.getApiName(); 
    494494        if (optApi.isNone()) { 
    495495            bug(name, "Expected to have an API name."); 
     
    504504 
    505505    public boolean hasQualifiedVariable(Id name) { 
    506         Option<APIName> optApi= name.getApi(); 
     506        Option<APIName> optApi= name.getApiName(); 
    507507        if (optApi.isNone()) 
    508508            bug(name, "Expected to have an API name."); 
     
    515515 
    516516    public boolean hasQualifiedFunction(Id name) { 
    517         Option<APIName> optApi= name.getApi(); 
     517        Option<APIName> optApi= name.getApiName(); 
    518518        if (optApi.isNone()) 
    519519            bug(name, "Expected to have an API name."); 
     
    526526 
    527527    public boolean hasQualifiedGrammar(Id name) { 
    528         Option<APIName> optApi= name.getApi(); 
     528        Option<APIName> optApi= name.getApiName(); 
    529529        if (optApi.isNone()) 
    530530            bug(name, "Expected to have an API name."); 
     
    537537 
    538538    public TypeConsIndex typeConsIndex(final Id name) { 
    539         Option<APIName> api = name.getApi(); 
     539        Option<APIName> api = name.getApiName(); 
    540540        APIName actualApi; 
    541541        // If no API in name or it's the current API, use its own typeCons. 
     
    566566    public Option<GrammarIndex> grammarIndex(final Id name) { 
    567567        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(); 
    570570            if (_filteredGlobalEnv.definesApi(n)) { 
    571571                return Option.some(_filteredGlobalEnv.api(n).grammars().get(uqname)); 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/TypeDisambiguator.java

    r3122 r3123  
    283283                                Thunk<Type> variableHandler, 
    284284                                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(); 
    287287            Option<APIName> realApiOpt = _env.apiName(originalApi); 
    288288            if (realApiOpt.isNone()) { 
     
    342342 
    343343            @Override public StaticArg forTypeArg(final TypeArg a) { 
    344                 final Type t = a.getType(); 
     344                final Type t = a.getTypeArg(); 
    345345                if (t instanceof VarType) { 
    346346                    final Span s = a.getSpan(); 
     
    482482 
    483483    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(); 
    486486            Option<APIName> realApiOpt = _env.apiName(originalApi); 
    487487            if (realApiOpt.isNone()) { 
     
    554554        @Override 
    555555        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(); 
    558558                        Option<StaticParam> param=this._env.hasTypeParam(name); 
    559559                        if(param.isSome()){ 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/FnDeclTypeEnv.java

    r3095 r3123  
    6666            if (var instanceof Id) { 
    6767                Id _var = (Id)var; 
    68                 if (_var.getApi().isSome()) 
     68                if (_var.getApiName().isSome()) 
    6969                    return binding(new Id(_var.getSpan(), _var.getText())); 
    7070            } 
     
    101101            if (var instanceof Id) { 
    102102                Id _var = (Id)var; 
    103                 if (_var.getApi().isSome()) 
     103                if (_var.getApiName().isSome()) 
    104104                    return declarationSite(new Id(_var.getSpan(), _var.getText())); 
    105105            } 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/FnTypeEnv.java

    r3122 r3123  
    103103                                        // Ugh.. 
    104104                                        TypeArg type_arg = (TypeArg)arg0; 
    105                                         VarType v = (VarType)type_arg.getType(); 
     105                                        VarType v = (VarType)type_arg.getTypeArg(); 
    106106                                        StaticParam p = new TypeParam(NodeFactory.makeSpan(v), v.getName()); 
    107107                                        StaticArg a = NodeFactory.makeTypeArg(NodeFactory.make_InferenceVarType(p.getSpan())); 
     
    142142                Span loc = _fn.declaringTrait().getSpan(); 
    143143                // 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()); 
    145145                Type selfType = makeTraitType(qualified_trait_name, 
    146146                                              staticParamsToArgs(_fn.staticParameters())); 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/StaticTypeReplacer.java

    r2968 r3123  
    107107 
    108108    private Node updateNode(Node that, Id name) { 
    109         if (name.getApi().isSome()) { return that; } 
     109        if (name.getApiName().isSome()) { return that; } 
    110110        StaticArg arg = parameterMap.get(name); 
    111111        if (arg == null) { return that; } 
     
    113113            // unwrap the StaticArg 
    114114            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.getVal(); } 
    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(); } 
    118118                @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(); } 
    121121            }); 
    122122        } 
     
    125125    // ----------- VISITOR METHODS --------------- 
    126126 
    127      
    128      
     127 
     128 
    129129    @Override 
    130130    public Node forVarType(VarType that) { 
     
    179179                else { 
    180180                        ConstraintFormula valid= ConstraintFormula.TRUE; 
    181                          
     181 
    182182                        Iterable<Pair<StaticParam,StaticArg>> zip = IterUtil.zip(static_params, static_args); 
    183183                        for(Pair<StaticParam,StaticArg> temp : zip){ 
    184184                                final StaticParam  param = temp.first(); 
    185                                 final StaticArg arg = temp.second();  
     185                                final StaticArg arg = temp.second(); 
    186186                                NodeDepthFirstVisitor<Option<ConstraintFormula>> outer = new NodeDepthFirstVisitor<Option<ConstraintFormula>>() { 
    187187                                        @Override 
     
    189189                                                return InterpreterBug.bug("Static param has been extended since argMatchParams was written"); 
    190190                                        } 
    191          
     191 
    192192                                        @Override 
    193193                                        public Option<ConstraintFormula> forBoolParam(BoolParam that) { 
     
    198198                                                return arg.accept(inner); 
    199199                                        } 
    200          
     200 
    201201                                        @Override 
    202202                                        public Option<ConstraintFormula> forDimParam(DimParam that) { 
     
    207207                                                return arg.accept(inner); 
    208208                                        } 
    209          
     209 
    210210                                        @Override 
    211211                                        public Option<ConstraintFormula> forIntParam(IntParam that) { 
     
    216216                                                return arg.accept(inner); 
    217217                                        } 
    218          
     218 
    219219                                        @Override 
    220220                                        public Option<ConstraintFormula> forNatParam(NatParam that) { 
     
    225225                                                return arg.accept(inner); 
    226226                                        } 
    227          
     227 
    228228                                        @Override 
    229229                                        public Option<ConstraintFormula> forTypeParam(final TypeParam param) { 
     
    232232                                                        @Override public Option<ConstraintFormula> forTypeArg(TypeArg arg) { 
    233233                                                                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)); 
    235235                                                        } 
    236236                                                }; 
    237237                                                return arg.accept(inner); 
    238238                                        } 
    239          
     239 
    240240                                        @Override 
    241241                                        public Option<ConstraintFormula> forUnitParam(UnitParam that) { 
     
    246246                                                return arg.accept(inner); 
    247247                                        } 
    248                                          
     248 
    249249                                        @Override 
    250250                                        public Option<ConstraintFormula> forOpParam(OpParam that) { 
     
    256256                                        } 
    257257                                }; 
    258                                  
     258 
    259259                                Option<ConstraintFormula> result = param.accept(outer); 
    260260                                if(result.isSome()){ 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/SubtypeChecker.java

    r3114 r3123  
    9696            ArrayType tt = (ArrayType)t; 
    9797            Span span = tt.getSpan(); 
    98             TypeArg elem = NodeFactory.makeTypeArg(tt.getType()); 
     98            TypeArg elem = NodeFactory.makeTypeArg(tt.getElemType()); 
    9999            IntArg zero = NodeFactory.makeIntArgVal("0"); 
    100100            List<ExtentRange> dims = tt.getIndices().getExtents(); 
     
    182182                    Id name = NodeFactory.makeId(span, WellKnownNames.fortressLibrary, "Matrix"); 
    183183                    return NodeFactory.makeTraitType(span, false, name, 
    184                                                      NodeFactory.makeTypeArg(tt.getType()), 
     184                                                     NodeFactory.makeTypeArg(tt.getElemType()), 
    185185                                                     first.getSize().unwrap(), 
    186186                                                     second.getSize().unwrap()); 
     
    210210                    if (isTypeArg(a)) 
    211211                        typeSubs.put(p.getName(), 
    212                                      ((TypeArg) a).getType()); 
     212                                     ((TypeArg) a).getTypeArg()); 
    213213                    else error("A type parameter is instantiated with a " + 
    214214                               "non-type argument."); 
     
    223223                    if (isIntArg(a)) 
    224224                        intSubs.put(p.getName(), 
    225                                     ((IntArg)a).getVal()); 
     225                                    ((IntArg)a).getIntVal()); 
    226226                    else error("An integer parameter is instantiated with a " + 
    227227                               "non-integer argument."); 
     
    230230                    if (isIntArg(a)) 
    231231                        intSubs.put(p.getName(), 
    232                                     ((IntArg)a).getVal()); 
     232                                    ((IntArg)a).getIntVal()); 
    233233                    else error("A nat parameter is instantiated with a " + 
    234234                               "non-nat argument."); 
     
    237237                    if (isBoolArg(a)) 
    238238                        boolSubs.put(p.getName(), 
    239                                      ((BoolArg)a).getBool()); 
     239                                     ((BoolArg)a).getBoolArg()); 
    240240                    else error("A bool parameter is instantiated with a " + 
    241241                               "non-bool argument."); 
     
    244244                    if (isDimArg(a)) 
    245245                        dimSubs.put(p.getName(), 
    246                                     ((DimArg)a).getDim()); 
     246                                    ((DimArg)a).getDimArg()); 
    247247                    else error("A dimension parameter is instantiated with a " + 
    248248                               "non-dimension argument."); 
     
    251251                    if (isUnitArg(a)) 
    252252                        unitSubs.put(p.getName(), 
    253                                      ((UnitArg)a).getUnit()); 
     253                                     ((UnitArg)a).getUnitArg()); 
    254254                    else error("A unit parameter is instantiated with a " + 
    255255                               "non-unit argument."); 
     
    316316    private boolean isStaticParam(VarType t) { 
    317317        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() 
    320320            return _staticParamEnv.binding(name).isSome(); 
    321321        } 
     
    325325        List<BaseType> _extends = new ArrayList<BaseType>(); 
    326326        Id name = t.getName(); 
    327         if (name.getApi().isNone()) { 
     327        if (name.getApiName().isNone()) { 
    328328            Option<StaticParam> result = _staticParamEnv.binding(name); 
    329329            if (result.isSome()) { 
     
    471471    private boolean equivalent(StaticArg s, StaticArg t, SubtypeHistory h) { 
    472472        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); 
    474474        } else if (isOpArg(s) && isOpArg(t)) { 
    475475            return nameString(((OpArg)s).getName().getOriginalName()).equals(((OpArg)t).getName()); 
     
    778778                    if (isVarType(s)) { 
    779779                        for (TraitTypeWhere _sup : traitIndex.extendsTypes()) { 
    780                             BaseType sup = _sup.getType(); 
     780                            BaseType sup = _sup.getBaseType(); 
    781781                            if (subtype(sup, t, h)) return TRUE; 
    782782                        } 
     
    788788                                          ((TraitType)s).getArgs()); 
    789789                            for (TraitTypeWhere _sup : traitIndex.extendsTypes()) { 
    790                                 BaseType sup = _sup.getType(); 
     790                                BaseType sup = _sup.getBaseType(); 
    791791                                if (subtype(subst.value(sup), t, h)) 
    792792                                    return TRUE; 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TraitTable.java

    r3071 r3123  
    4343        Id simpleName = new Id(NodeFactory.makeSpan(name), name.getText()); 
    4444        // 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())) { 
    4747            result = currentCompilationUnit.typeConses().get(simpleName); 
    4848        } 
    4949        else { 
    50             ApiIndex api = globalEnv.api(name.getApi().unwrap()); 
     50            ApiIndex api = globalEnv.api(name.getApiName().unwrap()); 
    5151            if (api == null) { 
    5252                return Option.none(); 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeAnalyzer.java

    r3114 r3123  
    350350                    List<BaseType> reduced = reduceDisjuncts(normalThrows.unwrap(), 
    351351                                                             _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()); } 
    353353                    else if (reduced.equals(e.getThrowsClause().unwrap())) { 
    354354                        return e; 
    355355                    } 
    356356                    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()); 
    358358                    } 
    359359                } 
     
    631631                        if (!f.isFalse()) { 
    632632                                // TODO: optimize substitution/normalization? 
    633                                 Type supT = sup.getType(); 
     633                                Type supT = sup.getBaseType(); 
    634634                                SubtypeHistory newH = containsVariable(supT, hidden) ? h.expand() : h; 
    635635                                Type supInstance = norm(subst.value(supT), newH); 
     
    10551055            @Override public ConstraintFormula forTypeArg(TypeArg a1) { 
    10561056                if (a2 instanceof TypeArg) { 
    1057                     return equiv(a1.getType(), ((TypeArg) a2).getType(), history); 
     1057                    return equiv(a1.getTypeArg(), ((TypeArg) a2).getTypeArg(), history); 
    10581058                } 
    10591059                else { return FALSE; } 
     
    10611061            @Override public ConstraintFormula forIntArg(IntArg a1) { 
    10621062                if (a2 instanceof IntArg) { 
    1063                     boolean result = a1.getVal().equals(((IntArg) a2).getVal()); 
     1063                    boolean result = a1.getIntVal().equals(((IntArg) a2).getIntVal()); 
    10641064                    return fromBoolean(result); 
    10651065                } 
     
    10681068            @Override public ConstraintFormula forBoolArg(BoolArg a1) { 
    10691069                if (a2 instanceof BoolArg) { 
    1070                     boolean result = a1.getBool().equals(((BoolArg) a2).getBool()); 
     1070                    boolean result = a1.getBoolArg().equals(((BoolArg) a2).getBoolArg()); 
    10711071                    return fromBoolean(result); 
    10721072                } 
     
    10821082            @Override public ConstraintFormula forDimArg(DimArg a1) { 
    10831083                if (a2 instanceof DimArg) { 
    1084                     boolean result = a1.getDim().equals(((DimArg) a2).getDim()); 
     1084                    boolean result = a1.getDimArg().equals(((DimArg) a2).getDimArg()); 
    10851085                    return fromBoolean(result); 
    10861086                } 
     
    10891089            @Override public ConstraintFormula forUnitArg(UnitArg a1) { 
    10901090                if (a2 instanceof UnitArg) { 
    1091                     boolean result = a1.getUnit().equals(((UnitArg) a2).getUnit()); 
     1091                    boolean result = a1.getUnitArg().equals(((UnitArg) a2).getUnitArg()); 
    10921092                    return fromBoolean(result); 
    10931093                } 
     
    11171117    /** Subtyping for Effects. */ 
    11181118    private ConstraintFormula sub(Effect s, Effect t, SubtypeHistory h) { 
    1119         if (!s.isIo() || t.isIo()) { 
     1119        if (!s.isIoEffect() || t.isIoEffect()) { 
    11201120            List<BaseType> empty = Collections.<BaseType>emptyList(); 
    11211121            Type sThrows = makeUnion(IterUtil.<Type>relax(s.getThrowsClause().unwrap(empty))); 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeAnalyzerUtil.java

    r3114 r3123  
    5555                @Override public void forTypeParam(TypeParam p) { 
    5656                    typeSubs.put(p.getName(), 
    57                                  ((TypeArg) a).getType()); 
     57                                 ((TypeArg) a).getTypeArg()); 
    5858                } 
    5959                @Override public void forOpParam(OpParam p) { 
     
    6262                @Override public void forIntParam(IntParam p) { 
    6363                    intSubs.put(p.getName(), 
    64                                 ((IntArg) a).getVal()); 
     64                                ((IntArg) a).getIntVal()); 
    6565                } 
    6666                @Override public void forNatParam(NatParam p) { 
    6767                    intSubs.put(p.getName(), 
    68                                 ((IntArg) a).getVal()); 
     68                                ((IntArg) a).getIntVal()); 
    6969                } 
    7070                @Override public void forBoolParam(BoolParam p) { 
    7171                    boolSubs.put(p.getName(), 
    72                                  ((BoolArg) a).getBool()); 
     72                                 ((BoolArg) a).getBoolArg()); 
    7373                } 
    7474                @Override public void forDimParam(DimParam p) { 
    7575                    dimSubs.put(p.getName(), 
    76                                 ((DimArg) a).getDim()); 
     76                                ((DimArg) a).getDimArg()); 
    7777                } 
    7878                @Override public void forUnitParam(UnitParam p) { 
    7979                    unitSubs.put(p.getName(), 
    80                                  ((UnitArg) a).getUnit()); 
     80                                 ((UnitArg) a).getUnitArg()); 
    8181                } 
    8282 
     
    158158            private Boolean recurOnKeywords(List<KeywordType> ks) { 
    159159                for (KeywordType k : ks) { 
    160                     if (k.getType().accept(this)) { return true; } 
     160                    if (k.getKeywordType().accept(this)) { return true; } 
    161161                } 
    162162                return false; 
     
    186186            @Override public Boolean forBottomType(BottomType t) { return false; } 
    187187            @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()); 
    189189            } 
    190190            @Override public Boolean forTraitType(TraitType t) { 
     
    199199                return recurOnList(t.getElements()); 
    200200            } 
    201             @Override public Boolean forTypeArg(TypeArg t) { return t.getType().accept(this); } 
     201            @Override public Boolean forTypeArg(TypeArg t) { return t.getTypeArg().accept(this); } 
    202202            @Override public Boolean forIntArg(IntArg t) { return false; } 
    203203            @Override public Boolean forBoolArg(BoolArg t) { return false; } 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeChecker.java

    r3122 r3123  
    590590                        // Map to list of supertypes 
    591591                        for( TraitTypeWhere ttw : index.extendsTypes() ) { 
    592                                 Type t = ttw.getType(); 
     592                                Type t = ttw.getBaseType(); 
    593593                                Type t_ = (Type)t.accept(new StaticTypeReplacer(trait_static_params, trait_static_args)); 
    594594                                new_supers.addAll(traitTypesCallable(t_)); 
     
    671671                        // we must visit the extended type with a static type replacer. 
    672672                        for( TraitTypeWhere ttw : trait_index.extendsTypes() ) { 
    673                                 Type t = (Type)ttw.getType().accept(new StaticTypeReplacer(extended_type_params, extended_type_args)); 
     673                                Type t = (Type)ttw.getBaseType().accept(new StaticTypeReplacer(extended_type_params, extended_type_args)); 
    674674                                new_supers.addAll(traitTypesCallable(t)); 
    675675                        } 
     
    744744                        // Map to list of supertypes 
    745745                        for( TraitTypeWhere ttw : trait_index.extendsTypes() ) { 
    746                                 new_supers.addAll(traitTypesCallable(ttw.getType())); 
     746                                new_supers.addAll(traitTypesCallable(ttw.getBaseType())); 
    747747                        } 
    748748 
     
    858858                List<Pair<FnRef, Type>> result = new ArrayList<Pair<FnRef, Type>>(overloadings.size()); 
    859859                for( _RewriteFnRefOverloading overloading : overloadings ) { 
    860                         result.add(Pair.make(overloading.getFn(), overloading.getTy())); 
     860                        result.add(Pair.make(overloading.getFnRef(), overloading.getTy())); 
    861861                } 
    862862                return result; 
     
    10601060                        if(constraint.isSome()){ 
    10611061                                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()); 
    10641064                                Type t=Types.makeArrayKType(1, that.getStaticArgs()); 
    10651065                                Node new_node=new ArrayElement(that.getSpan(), that.isParenthesized(), Option.some(t), (List<StaticArg>) TypeCheckerResult.astFromResults(staticArgs_result), (Expr) element_result.ast()); 
     
    10941094                                StaticArg arg = type.getArgs().get(i); 
    10951095                                if(arg instanceof IntArg){ 
    1096                                         IntExpr iexpr = ((IntArg)arg).getVal(); 
     1096                                        IntExpr iexpr = ((IntArg)arg).getIntVal(); 
    10971097                                        if(iexpr instanceof NumberConstraint){ 
    1098                                                 IntLiteralExpr dim = ((NumberConstraint) iexpr).getVal(); 
    1099                                                 BigInteger n = dim.getVal(); 
     1098                                                IntLiteralExpr dim = ((NumberConstraint) iexpr).getIntVal(); 
     1099                                                BigInteger n = dim.getIntVal(); 
    11001100                                                dims.add(n); 
    11011101                                        } 
     
    11101110                        Type t; 
    11111111                        if(type.getArgs().get(0) instanceof TypeArg){ 
    1112                                 t = ((TypeArg)type.getArgs().get(0)).getType(); 
     1112                                t = ((TypeArg)type.getArgs().get(0)).getTypeArg(); 
    11131113                        } 
    11141114                        else{ 
     
    12061206                        if(constraints.isSome()) { 
    12071207                                // 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(); 
    12091209                                all_results.add(this.checkSubtype(array_type, declared_type, that, "Array elements must be a subtype of explicity declared type" + declared_type + ".")); 
    12101210                                //Check infered dims against explicit dims 
     
    12401240        @Override 
    12411241        public TypeCheckerResult forAsExpr(AsExpr that) { 
    1242                 Type ascriptedType = that.getType(); 
     1242                Type ascriptedType = that.getAnnType(); 
    12431243                TypeCheckerResult expr_result = that.getExpr().accept(this); 
    12441244                Type exprType = expr_result.type().isSome() ? expr_result.type().unwrap() : Types.BOTTOM; 
     
    12521252        @Override 
    12531253        public TypeCheckerResult forAsIfExpr(AsIfExpr that) { 
    1254                 Type assumedType = that.getType(); 
     1254                Type assumedType = that.getAnnType(); 
    12551255                TypeCheckerResult expr_result = that.getExpr().accept(this); 
    12561256                Type exprType = expr_result.type().isSome() ? expr_result.type().unwrap() : Types.BOTTOM; 
     
    12791279 
    12801280                List<TypeCheckerResult> lhs_results = new ArrayList<TypeCheckerResult>(that.getLhs().size()); 
    1281                 List<OpRef> op_refs = that.getOpr().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(); 
    12821282 
    12831283                // Go through LHS, checking each one 
     
    12851285                for( Lhs lhs : that.getLhs() ) { 
    12861286                        Type rhs_type = rhs_type_iter.next(); 
    1287                         Pair<Option<OpRef>, TypeCheckerResult> p = checkLhsAssignment(lhs, rhs_type, that.getOpr()); 
     1287                        Pair<Option<OpRef>, TypeCheckerResult> p = checkLhsAssignment(lhs, rhs_type, that.getAssignOp()); 
    12881288                        lhs_results.add(p.second()); 
    12891289 
     
    12931293 
    12941294                Assignment new_node; 
    1295                 if( that.getOpr().isSome() ) { 
     1295                if( that.getAssignOp().isSome() ) { 
    12961296                        // Create a new Assignment, with an OpRef for each LHS 
    12971297                        new_node = new Assignment(that.getSpan(), 
     
    12991299                                                  Option.<Type>some(Types.VOID), 
    13001300                                                  (List<Lhs>)TypeCheckerResult.astFromResults(lhs_results), 
    1301                                                   that.getOpr(), 
     1301                                                  that.getAssignOp(), 
    13021302                                                  (Expr)rhs_result.ast(), 
    13031303                                                  Option.<List<OpRef>>some(op_refs)); 
     
    13091309                                        Option.<Type>some(Types.VOID), 
    13101310                                        (List<Lhs>)TypeCheckerResult.astFromResults(lhs_results), 
    1311                                         that.getOpr(), 
     1311                                        that.getAssignOp(), 
    13121312                                        (Expr)rhs_result.ast()); 
    13131313                } 
     
    13321332 
    13331333                List<TypeCheckerResult> lhs_results = new ArrayList<TypeCheckerResult>(that.getLhs().size()); 
    1334                 List<OpRef> op_refs = that.getOpr().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(); 
    13351335 
    13361336                // Go through LHS, checking each one 
     
    13381338                for( Lhs lhs : that.getLhs() ) { 
    13391339                        Type rhs_type = rhs_type_iter.next(); 
    1340                         Pair<Option<OpRef>, TypeCheckerResult> p = checkLhsAssignment(lhs, rhs_type, that.getOpr()); 
     1340                        Pair<Option<OpRef>, TypeCheckerResult> p = checkLhsAssignment(lhs, rhs_type, that.getAssignOp()); 
    13411341                        lhs_results.add(p.second()); 
    13421342 
     
    13501350                                                     Option.<Type>some(Types.VOID), 
    13511351                                                     (List<Lhs>)TypeCheckerResult.astFromResults(lhs_results), 
    1352                                                      that.getOpr(), 
     1352                                                     that.getAssignOp(), 
    13531353                                                     (Expr)rhs_result.ast(), 
    13541354                                                     Option.<List<OpRef>>some(op_refs)); 
     
    13631363                        new_node = (Assignment)temp.second(); 
    13641364                        if(!temp.first()){ 
    1365                                 String err = "No overloading for " + that.getOpr().unwrap(); 
     1365                                String err = "No overloading for " + that.getAssignOp().unwrap(); 
    13661366                                successful = new TypeCheckerResult(that, TypeError.make(err,that)); 
    13671367                        } 
     
    14881488                                                "Type of right-hand side of assignment, " +rhs_type+ ", must be subtype of left-hand side, " + var_result.type() + "."); 
    14891489 
    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()); 
    14921492                                if( bl.isNone() ) return bug("Inconsistent results from TypeEnv and typechecking VarRef"); 
    14931493 
     
    16391639                        public Triple<CaseClause, TypeCheckerResult, TypeCheckerResult> forCaseClause( 
    16401640                                        CaseClause that) { 
    1641                                 TypeCheckerResult match_result = that.getMatch().accept(TypeChecker.this); 
     1641                                TypeCheckerResult match_result = that.getMatchClause().accept(TypeChecker.this); 
    16421642                                TypeCheckerResult body_result = that.getBody().accept(TypeChecker.this); 
    16431643                                CaseClause new_node = new CaseClause(that.getSpan(), (Expr)match_result.ast(), (Block)body_result.ast(), 
     
    17661766        private Pair<Type, TypeCheckerResult> forCaseClauseRewriteAndGetType(CaseClause clause, Option<TypeCheckerResult> param_result_, 
    17671767                        Option<TypeCheckerResult> compare_result_, TypeCheckerResult equals_result, TypeCheckerResult in_result) { 
    1768                 TypeCheckerResult match_result = recur(clause.getMatch()); 
     1768                TypeCheckerResult match_result = recur(clause.getMatchClause()); 
    17691769                TypeCheckerResult block_result = recur(clause.getBody()); 
    17701770 
     
    18401840            OpRef op = clause.getOp().unwrap(); 
    18411841 
    1842                 TypeCheckerResult match_result = recur(clause.getMatch()); 
     1842                TypeCheckerResult match_result = recur(clause.getMatchClause()); 
    18431843                TypeCheckerResult block_result = recur(clause.getBody()); 
    18441844 
     
    19421942        private TypeCheckerResult forCatchClauseWithIdToBind(CatchClause that, 
    19431943                        Id id_to_bind) { 
    1944                 TypeCheckerResult match_result = that.getMatch().accept(this); 
     1944                TypeCheckerResult match_result = that.getMatchType().accept(this); 
    19451945                // 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."); 
    19481948 
    19491949                // 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()); 
    19511951                TypeChecker extend_tc = this.extend(Collections.singletonList(lval)); 
    19521952                TypeCheckerResult body_result = that.getBody().accept(extend_tc); 
     
    20062006                                Option.<Type>some(Types.CHAR), 
    20072007                                that.getText(), 
    2008                                 that.getVal()); 
     2008                                that.getCharVal()); 
    20092009                return new TypeCheckerResult(new_node, Types.CHAR); 
    20102010        } 
     
    20692069        public TypeCheckerResult forDoFront(DoFront that) { 
    20702070                TypeCheckerResult bodyResult = 
    2071                         that.isAtomic() ? forAtomic( 
     2071                        that.isAtomicBlock() ? forAtomic( 
    20722072                                        that.getExpr(), 
    20732073                                        errorMsg("A 'spawn' expression must not occur inside", 
     
    20922092                                        DoFront new_node = new DoFront(that.getSpan(), 
    20932093                                                        (Option<Expr>)TypeCheckerResult.astFromResult(loc_result_), 
    2094                                                         that.isAtomic(), 
     2094                                                        that.isAtomicBlock(), 
    20952095                                                        (Block)bodyResult.ast()); 
    20962096                                        return TypeCheckerResult.compose(new_node, 
     
    21232123        @Override 
    21242124        public TypeCheckerResult forEnclosing(Enclosing that) { 
    2125                 Option<APIName> api = that.getApi(); 
     2125                Option<APIName> api = that.getApiName(); 
    21262126                TypeEnv env = api.isSome() ? returnTypeEnvForApi(api.unwrap()) : this.typeEnv; 
    21272127 
     
    27092709        @Override 
    27102710        public TypeCheckerResult forId(Id name) { 
    2711                 Option<APIName> apiName = name.getApi(); 
     2711                Option<APIName> apiName = name.getApiName(); 
    27122712                if (apiName.isSome()) { 
    27132713                        APIName api = apiName.unwrap(); 
     
    27222722                                        // Type was declared in that API, so it's not qualified; 
    27232723                                        // prepend it with the API. 
    2724                                         if (_namedType.getName().getApi().isNone()) { 
     2724                                        if (_namedType.getName().getApiName().isNone()) { 
    27252725                                                _type = NodeFactory.makeNamedType(api, (NamedType) type.unwrap()); 
    27262726                                        } 
     
    27572757                // For generalized 'if' we must introduce new bindings. 
    27582758                Pair<TypeCheckerResult, List<LValue>> result_and_binds = 
    2759                         this.forGeneratorClauseGetBindings(that.getTest(), true); 
     2759                        this.forGeneratorClauseGetBindings(that.getTestClause(), true); 
    27602760 
    27612761                // Destruct result 
     
    28542854        @Override 
    28552855        public TypeCheckerResult forIntLiteralExpr(IntLiteralExpr that) { 
    2856                 IntLiteralExpr new_node = new IntLiteralExpr(that.getSpan(), Option.<Type>some(Types.INT_LITERAL), that.getText(), that.getVal()); 
     2856                IntLiteralExpr new_node = new IntLiteralExpr(that.getSpan(), Option.<Type>some(Types.INT_LITERAL), that.getText(), that.getIntVal()); 
    28572857                return new TypeCheckerResult(new_node, Types.INT_LITERAL); 
    28582858        } 
     
    33783378                                        IterUtil.map(that.getExtendsClause(), new Lambda<TraitTypeWhere,TypeCheckerResult>(){ 
    33793379                                                public TypeCheckerResult value(TraitTypeWhere arg0) { 
    3380                                                         return assertTrait(arg0.getType(), that, "Objects can only extend traits.", arg0); 
     3380                                                        return assertTrait(arg0.getBaseType(), that, "Objects can only extend traits.", arg0); 
    33813381                                                }})); 
    33823382 
     
    34553455                                IterUtil.map(that.getExtendsClause(), new Lambda<TraitTypeWhere,TypeCheckerResult>() { 
    34563456                                        public TypeCheckerResult value(TraitTypeWhere arg0) { 
    3457                                                 return assertTrait(arg0.getType(), that, "Objects can only extend traits.", arg0); 
     3457                                                return assertTrait(arg0.getBaseType(), that, "Objects can only extend traits.", arg0); 
    34583458                                        }})); 
    34593459 
     
    35113511        @Override 
    35123512        public TypeCheckerResult forOp(Op that) { 
    3513                 Option<APIName> api = that.getApi(); 
     3513                Option<APIName> api = that.getApiName(); 
    35143514 
    35153515                Option<BindingLookup> binding; 
     
    39373937                                IterUtil.map(that.getExtendsClause(), new Lambda<TraitTypeWhere,TypeCheckerResult>(){ 
    39383938                                        public TypeCheckerResult value(TraitTypeWhere arg0) { 
    3939                                                 return assertTrait(arg0.getType(), that, "Traits can only extend traits.", arg0); 
     3939                                                return assertTrait(arg0.getBaseType(), that, "Traits can only extend traits.", arg0); 
    39403940                                        }})); 
    39413941 
     
    40444044 
    40454045                // 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() ) { 
    40484048                        TypeCheckerResult r = 
    40494049                                this.checkSubtype(t, Types.EXCEPTION, t,"All types in 'forbids' clause must be subtypes of " + 
     
    41254125                } 
    41264126 
    4127                 final Type annotatedType = that.getType(); 
     4127                final Type annotatedType = that.getAnnType(); 
    41284128                Type exprType = expr_result.type().unwrap(); 
    41294129 
     
    42694269        private TypeCheckerResult forTypecaseClauseWithBindings(TypecaseClause clause, List<Id> to_bind, Type original_type) { 
    42704270                //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()); 
    42724272                TypeChecker extend; 
    42734273                if(to_bind.size()==1){ 
    42744274                        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); 
    42774277                        } 
    42784278                        else{ 
    4279                                 meet=this.subtypeChecker.meet(clause.getMatch().get(0),original_type); 
     4279                                meet=this.subtypeChecker.meet(clause.getMatchType().get(0),original_type); 
    42804280                        } 
    42814281                        LValue bind = NodeFactory.makeLValue(to_bind.get(0), meet); 
    42824282                        extend=this.extend(Collections.singletonList(bind)); 
    42834283                }else{ 
    4284                         if(to_bind.size()!=clause.getMatch().size()){ 
     4284                        if(to_bind.size()!=clause.getMatchType().size()){ 
    42854285                                return new TypeCheckerResult(clause, TypeError.make("Tuple sizes don't match",clause)); 
    42864286                        } 
    42874287                        else{ 
    42884288                                List<LValue> binds=new ArrayList<LValue>(to_bind.size()); 
    4289                                 Iterator<Type> mitr=clause.getMatch().iterator(); 
     4289                                Iterator<Type> mitr=clause.getMatchType().iterator(); 
    42904290                                assert(original_type instanceof TupleType); 
    42914291                                TupleType tuple=(TupleType)original_type; 
     
    43954395        @Override 
    43964396        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); 
    43984398                TypeChecker extended = this.extend(res.second()); 
    43994399                TypeCheckerResult body_result = that.getBody().accept(extended); 
     
    44724472                        //          } 
    44734473 
    4474                         BaseType type_ = trait_.getType(); 
     4474                        BaseType type_ = trait_.getBaseType(); 
    44754475 
    44764476                        if( h.hasExplored(type_) ) 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypesUtil.java

    r3071 r3123  
    134134            final Type fn_type, 
    135135            final ArgList args, 
    136             final List<StaticArg> staticArgs,  
     136            final List<StaticArg> staticArgs, 
    137137            final ConstraintFormula existingConstraint) { 
    138138        // List of arrow types that statically match 
     
    196196                    } 
    197197                }); 
    198             ConstraintFormula temp =  pair.second().and(existingConstraint, checker.new SubtypeHistory());  
     198            ConstraintFormula temp =  pair.second().and(existingConstraint, checker.new SubtypeHistory()); 
    199199            if(temp.isSatisfiable() ) { 
    200200                matching_types.add(pair.first().unwrap()); 
     
    255255    public static Option<Pair<Type,ConstraintFormula>> applicationType(final TypeAnalyzer checker, 
    256256            final Type fn, 
    257             final ArgList args,  
     257            final ArgList args, 
    258258            final ConstraintFormula existingConstraint) { 
    259259        // Just a convenience method 
     
    372372            public Boolean value() { return b; } 
    373373        }; 
    374          
     374 
    375375        ast.accept(new NodeDepthFirstVisitor_void() { 
    376376            @Override 
     
    381381            } 
    382382        }); 
    383          
     383 
    384384        return result_.value(); 
    385385    } 
     
    393393        return containsInferenceVarTypes(ast, null); 
    394394    } 
    395      
     395 
    396396    /** 
    397397     * Attempts to apply the given static args to the given type, checking if the given type is 
     
    415415                                return Option.none(); 
    416416                        } 
    417                          
     417 
    418418                        @Override 
    419419                        public Option<Pair<Type,ConstraintFormula>> forIntersectionType(IntersectionType that) { 
     
    436436                        public Option<Pair<Type,ConstraintFormula>> for_RewriteGenericArrowType( 
    437437                                        _RewriteGenericArrowType that) { 
    438                                  
     438 
    439439                                Option<ConstraintFormula> constraints = StaticTypeReplacer.argsMatchParams(static_args,that.getStaticParams(), subtype_checker); 
    440                                  
     440 
    441441                                if(constraints.isSome()) { 
    442442                                        _RewriteGenericArrowType temp = (_RewriteGenericArrowType) that.accept(new StaticTypeReplacer(that.getStaticParams(),static_args)); 
     
    464464                        new Lambda<TraitTypeWhere,Type>(){ 
    465465                public Type value(TraitTypeWhere arg0) { 
    466                         return arg0.getType(); 
     466                        return arg0.getBaseType(); 
    467467                }})); 
    468468        Type self_type = 
     
    484484        return Pair.make(result.getNodeConstraints().isSatisfiable(), new_node); 
    485485    } 
    486      
     486 
    487487    /** 
    488488     * Take a node with _InferenceVarType, and TypeCheckerResults, which containt 
     
    490490     * in the node. 
    491491     */ 
    492     public static Pair<Boolean,Node> closeConstraints(Node node,  
     492    public static Pair<Boolean,Node> closeConstraints(Node node, 
    493493            TypeAnalyzer subtypeChecker, TypeCheckerResult... results) { 
    494494        TypeCheckerResult result = TypeCheckerResult.compose(node, subtypeChecker, results); 
     
    499499    public static List<StaticArg> staticArgsFromTypes(List<Type> types) { 
    500500        if( types.isEmpty() ) return Collections.emptyList(); 
    501          
     501 
    502502        List<StaticArg> result = new ArrayList<StaticArg>(types.size()); 
    503503        for( Type ty : types ) { 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/BaseEnv.java

    r3060 r3123  
    7171 
    7272    public Environment getHomeEnvironment(IdOrOpOrAnonymousName ioooan) { 
    73         Option<APIName> oapi = ioooan.getApi(); 
     73        Option<APIName> oapi = ioooan.getApiName(); 
    7474        if (oapi.isNone()) 
    7575            return this; 
     
    439439        return getTypeNull(name); // temp hack 
    440440    } 
    441      
     441 
    442442    public FType getRootTypeNull(String name) { 
    443443        return getTypeNull(name); // temp hack 
    444444    } 
    445      
     445 
    446446    final public FType getTypeNull(Id name) { 
    447447        String local = NodeUtil.nameSuffixString(name); 
    448         Option<APIName> opt_api = name.getApi(); 
     448        Option<APIName> opt_api = name.getApiName(); 
    449449 
    450450        if (opt_api.isSome()) { 
     
    514514 
    515515    final public  FValue getValueNull(VarRef vr) { 
    516         Id name = vr.getVar(); 
     516        Id name = vr.getVarId(); 
    517517        int l = vr.getLexicalDepth(); 
    518518        return getValueNull(name, l); 
     
    528528        //String s = NodeUtil.nameString(name); 
    529529        String local = NodeUtil.nameSuffixString(name); 
    530         Option<APIName> opt_api = name.getApi(); 
     530        Option<APIName> opt_api = name.getApiName(); 
    531531        return getValueNullTail(name, l, local, opt_api); 
    532532    } 
     
    536536        // String s = NodeUtil.nameString(name); 
    537537        String local = NodeUtil.nameSuffixString(name); 
    538         Option<APIName> opt_api = name.getApi(); 
     538        Option<APIName> opt_api = name.getApiName(); 
    539539        return getValueNullTail(name, l, local, opt_api); 
    540540 
     
    543543          //String s = NodeUtil.nameString(name); 
    544544          String local = NodeUtil.nameSuffixString(name); 
    545           Option<APIName> opt_api = name.getApi(); 
     545          Option<APIName> opt_api = name.getApiName(); 
    546546          return getValueTail(name, l, local, opt_api); 
    547547      } 
     
    551551          // String s = NodeUtil.nameString(name); 
    552552          String local = NodeUtil.nameSuffixString(name); 
    553           Option<APIName> opt_api = name.getApi(); 
     553          Option<APIName> opt_api = name.getApiName(); 
    554554          return getValueTail(name, l, local, opt_api); 
    555555 
     
    788788            } 
    789789        } else if (negative_object_depth == 0) { 
    790             e = e.getTopLevel();  
     790            e = e.getTopLevel(); 
    791791        } else if (negative_object_depth < 0) { 
    792792            // True only for MIN_VALUE 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/BuildTopLevelEnvironments.java

    r3122 r3123  
    164164            OverloadedFunction of = (OverloadedFunction) bindInto.getRootValue(s); 
    165165            for (IdOrOpName fn : x.getFns()) { 
    166                 Option<APIName> oapi = fn.getApi(); 
     166                Option<APIName> oapi = fn.getApiName(); 
    167167                FValue oapi_val = null; 
    168168 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/EvalType.java

    r3122 r3123  
    334334    @Override 
    335335    public FType forBoolArg(BoolArg x) { 
    336         BoolExpr i = x.getBool(); 
     336        BoolExpr i = x.getBoolArg(); 
    337337        return i.accept(new NodeAbstractVisitor<FType>() { 
    338338            private boolean boolify(BoolExpr ie) { 
     
    345345            } 
    346346            public FType forBoolConstant(BoolConstant b) { 
    347                 return Bool.make(b.isBool()); 
     347                return Bool.make(b.isBoolVal()); 
    348348            } 
    349349            public FType forBoolRef(BoolRef n) { 
     
    357357            } 
    358358            public FType forNotConstraint(NotConstraint n) { 
    359                 return Bool.make(!boolify(n.getBool())); 
     359                return Bool.make(!boolify(n.getBoolVal())); 
    360360            } 
    361361 
     
    386386 
    387387    public FType forBoolConstant(BoolConstant b) { 
    388         return Bool.make(b.isBool()); 
     388        return Bool.make(b.isBoolVal()); 
    389389    } 
    390390 
     
    427427    @Override 
    428428    public FType forIntArg(IntArg x) { 
    429         IntExpr i = x.getVal(); 
     429        IntExpr i = x.getIntVal(); 
    430430        return i.accept(new NodeAbstractVisitor<FType>() { 
    431431            private long longify(IntExpr ie) { 
     
    438438            } 
    439439            public FType forNumberConstraint(NumberConstraint n) { 
    440                 return IntNat.make(n.getVal().getVal().intValue()); 
     440                return IntNat.make(n.getIntVal().getIntVal().intValue()); 
    441441            } 
    442442            public FType forIntRef(IntRef n) { 
     
    501501    public FType forTypeArg(TypeArg x) { 
    502502        try { 
    503             return x.getType().accept(this); 
     503            return x.getTypeArg().accept(this); 
    504504        } 
    505505        catch (FortressException pe) { 
     
    537537    @Override 
    538538    public FType forArrayType(ArrayType x) { 
    539         FType elt_type = x.getType().accept(this); 
     539        FType elt_type = x.getElemType().accept(this); 
    540540        Indices indices = x.getIndices(); 
    541541 
     
    547547    @Override 
    548548    public FType forMatrixType(MatrixType x) { 
    549         FType elt_type = x.getType().accept(this); 
     549        FType elt_type = x.getElemType().accept(this); 
    550550        List<ExtentRange> dimensions = x.getDimensions(); 
    551551        List<TypeRange> typeRanges = new ArrayList<TypeRange>(); 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/Evaluator.java

    r3111 r3123  
    218218        final Expr expr = x.getExpr(); 
    219219        FValue val = expr.accept(this); 
    220         Type ty = x.getType(); 
     220        Type ty = x.getAnnType(); 
    221221        FType fty = EvalType.getFType(ty, e); 
    222222        if (val.type().subtypeOf(fty)) 
     
    230230        final Expr expr = x.getExpr(); 
    231231        FValue val = expr.accept(this); 
    232         Type ty = x.getType(); 
     232        Type ty = x.getAnnType(); 
    233233        FType fty = EvalType.getFType(ty, e); 
    234234        if (val.type().subtypeOf(fty)) 
     
    242242    // the operator case. Might this cause the world to break? 
    243243    public FValue forAssignment(Assignment x) { 
    244         Option<OpRef> possOp = x.getOpr(); 
     244        Option<OpRef> possOp = x.getAssignOp(); 
    245245        LHSToLValue getLValue = new LHSToLValue(this); 
    246246        List<? extends Lhs> lhses = getLValue.inParallel(x.getLhs()); 
     
    370370                FValue region = regionExp.accept(this); 
    371371            } 
    372             if (f.isAtomic()) 
     372            if (f.isAtomicBlock()) 
    373373                return forAtomicExpr(new AtomicExpr(x.getSpan(), false, 
    374374