Changeset 3077

Show
Ignore:
Timestamp:
11/18/08 09:34:54 (12 months ago)
Author:
sukyoungryu
Message:

[ast] Merged FnDecl? and FnDef? to FnDecl?.

Location:
trunk
Files:
3 added
4 removed
38 modified

Legend:

Unmodified
Added
Removed
  • trunk/Library/FortressSyntax.fsi

    r2502 r3077  
    7575  native grammar LocalVarFnDecl 
    7676    LocalVarFnDecl : LetExpr 
    77     LocalFnDecl : FnDef 
     77    LocalFnDecl : FnDecl 
    7878    LocalVarDecl : LocalVarDecl 
    7979  end 
  • trunk/ProjectFortress/astgen/Fortress.ast

    r3074 r3077  
    456456            /** 
    457457             * functional declaration in components 
    458              */ 
    459             abstract FnDecl(); 
    460                 /** 
    461                  * FnDecl ::= FnMods? FnHeaderFront FnHeaderClause = Expr 
    462                  * e.g.) swap (x, y) = (y, x) 
    463                  */ 
    464                 FnDef(Expr body, Option<Id> implementsUnambiguousName = Option.<Id>none()); 
     458             * FnDecl ::= FnMods? FnHeaderFront FnHeaderClause = Expr 
     459             * e.g.) swap (x, y) = (y, x) 
     460             */ 
     461            FnDecl(Expr body, Option<Id> implementsUnambiguousName = Option.<Id>none()); 
    465462        /** 
    466463         * value parameter of functional declarations and object declarations 
     
    10211018                 * e.g.) localFn(x: ZZ32) = x + 2 
    10221019                 */ 
    1023                 LetFn(List<FnDef> fns); 
     1020                LetFn(List<FnDecl> fns); 
    10241021                /** 
    10251022                 * local variable declaration 
  • trunk/ProjectFortress/not_passing_yet/staticParamNotFound.fss

    r2965 r3077  
    4949end 
    5050 
    51 (* Nested FnDefs within the object decl which declares more static params *) 
     51(* Nested FnDecls within the object decl which declares more static params *) 
    5252object O4[\X extends String, S extends String\](x:X, s:S) 
    5353    foo[\Z1 extends ZZ32\](z1:Z1):Y = do 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/DesugaringVisitor.java

    r3074 r3077  
    254254                                             field.getType()); 
    255255        else 
    256             return NodeFactory.makeFnDef(span, mods, field.getName(), 
     256            return NodeFactory.makeFnDecl(span, mods, field.getName(), 
    257257                                         field.getType(), body); 
    258258    } 
     
    306306                                             Option.some(voidType)); 
    307307        else 
    308             return NodeFactory.makeFnDef(span, mods, name, params, 
     308            return NodeFactory.makeFnDecl(span, mods, name, params, 
    309309                                         Option.some(voidType), assign); 
    310310    } 
     
    630630 
    631631    @Override 
    632     public Node forFnDefOnly(FnDef that, List<Modifier> mods_result, 
     632    public Node forFnDeclOnly(FnDecl that, List<Modifier> mods_result, 
    633633                             IdOrOpOrAnonymousName name_result, 
    634634                             List<StaticParam> staticParams_result, 
     
    642642                             Option<Id> implementsUnambiguousName_result) 
    643643    { 
    644         return new FnDef(that.getSpan(), removeGetterSetterMod(mods_result), 
     644        return new FnDecl(that.getSpan(), removeGetterSetterMod(mods_result), 
    645645                         name_result, staticParams_result, params_result, 
    646646                         returnType_result, throwsClause_result, 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/FreeNameCollector.java

    r3071 r3077  
    4242    private TypeCheckerOutput typeCheckerOutput; 
    4343    // A stack keeping track of all nodes that can create new scope 
    44     // TraitDecl, ObjectDecl, FnDef, FnExpr, IfClause, For, LetFn, LocalVarDecl, 
     44    // TraitDecl, ObjectDecl, FnDecl, FnExpr, IfClause, For, LetFn, LocalVarDecl, 
    4545    // Label, Catch, Typecase, GeneratedExpr, While, and ObjectExpr 
    4646    private Stack<Node> scopeStack; 
     
    154154 
    155155    @Override 
    156     public void forFnDef(FnDef that) { 
    157         scopeStack.push(that); 
    158         super.forFnDef(that); 
     156    public void forFnDecl(FnDecl that) { 
     157        scopeStack.push(that); 
     158        super.forFnDecl(that); 
    159159        scopeStack.pop(); 
    160160    } 
     
    323323    public void forExit(Exit that) { 
    324324            // Not in object expression; we are done. 
    325             if( objExprStack.isEmpty() ) {  
     325            if( objExprStack.isEmpty() ) { 
    326326                super.forExit(that); 
    327327                return; 
    328328            } 
    329             
     329 
    330330        forExitDoFirst(that); 
    331331 
    332         // figure out the exit label name;  
     332        // figure out the exit label name; 
    333333        // there should be one assigned in Exit._target by the 
    334         // ExprDisambiguator already; if it's not found, throw an error  
     334        // ExprDisambiguator already; if it's not found, throw an error 
    335335        Option<Id> targetOp = that.getTarget(); 
    336336        Id target = null; 
     
    342342            ObjectExpr innerMostObjExpr = null; 
    343343            for(int i=scopeStack.size()-1; i>=0; i++) { 
    344                 Node n = scopeStack.get(i);  
     344                Node n = scopeStack.get(i); 
    345345                if(n instanceof Label) { 
    346                     innerMostLabel = (Label) n;  
     346                    innerMostLabel = (Label) n; 
    347347                    break; 
    348348                } else if(n instanceof ObjectExpr) { 
    349                     innerMostObjExpr = (ObjectExpr) n;  
     349                    innerMostObjExpr = (ObjectExpr) n; 
    350350                } 
    351351            } 
    352352 
    353             if(innerMostObjExpr == null) {  
     353            if(innerMostObjExpr == null) { 
    354354                // the label is not captured because it's defined within the 
    355355                // inner-most object expr; no need to handle this. 
    356356                    super.forExit(that); 
    357357                    return; 
    358             }  
     358            } 
    359359 
    360360            // this label _is_ captured 
    361361            target = innerMostLabel.getName();  */ 
    362             throw new DesugarerError( that.getSpan(),  
     362            throw new DesugarerError( that.getSpan(), 
    363363                        "Exit target label is not disambiguated!" ); 
    364364        } 
    365          
    366         // check wither the target label is declared within obj expr or free  
     365 
     366        // check wither the target label is declared within obj expr or free 
    367367        Label label = null; 
    368368        ObjectExpr innerMostObjExpr = null; 
    369369 
    370370        for(int i=scopeStack.size()-1; i>=0; i--) { 
    371             Node n = scopeStack.get(i);  
     371            Node n = scopeStack.get(i); 
    372372            if(n instanceof Label) { 
    373                 label = (Label) n;  
     373                label = (Label) n; 
    374374                if( label.getName().equals(target) ) { 
    375375                    // label found before hitting the inner most obj 
    376376                    // expr, so it is not free 
    377                     break;  
    378                 }  
     377                    break; 
     378                } 
    379379            } else if(n instanceof ObjectExpr) { 
    380380                // found the obj expr before finding the label, so it's free 
     
    410410 
    411411        if(enclosingTraitDecl.isSome()) { 
    412             isShadowed = isShadowedInNode( enclosingTraitDecl.unwrap(),  
     412            isShadowed = isShadowedInNode( enclosingTraitDecl.unwrap(), 
    413413                                           that.getVar() ); 
    414414        } else if(enclosingObjectDecl.isSome()) { 
    415             isShadowed = isShadowedInNode( enclosingObjectDecl.unwrap(),  
     415            isShadowed = isShadowedInNode( enclosingObjectDecl.unwrap(), 
    416416                                           that.getVar() ); 
    417417        } 
     
    10001000 
    10011001        @Override 
    1002         public void forFnDef(FnDef that) { 
     1002        public void forFnDecl(FnDecl that) { 
    10031003            IdOrOpOrAnonymousName name = that.getName(); 
    10041004            if(name instanceof Id) { 
     
    10061006            } else { 
    10071007                throw new DesugarerError(that.getSpan(), "Unexpected type " + 
    1008                         "for FnDef name " + that.getName() + " when " + 
     1008                        "for FnDecl name " + that.getName() + " when " + 
    10091009                        "when parsing decls for object expr at " + 
    10101010                        root.getSpan() ); 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/ObjectExpressionVisitor.java

    r3026 r3077  
    4545    // Type info passed down from the type checking phase 
    4646    private TypeCheckerOutput typeCheckerOutput; 
    47     /*  
     47    /* 
    4848     * A list of newly created ObjectDecls (i.e. lifted obj expressions and 
    4949     * objectDecls for boxed mutable var refs they capture) 
     
    225225        } 
    226226 
    227         /*  
     227        /* 
    228228         * if rewriteList == null, returnValue = that; otherwise, 
    229229         * returnValue is updated by the MutableVarRefRewriteVisitor. 
     
    254254 
    255255    @Override 
    256         public Node forFnDef(FnDef that) { 
    257         scopeStack.push(that); 
    258         Node returnValue = super.forFnDef(that); 
     256        public Node forFnDecl(FnDecl that) { 
     257        scopeStack.push(that); 
     258        Node returnValue = super.forFnDecl(that); 
    259259        scopeStack.pop(); 
    260260        return returnValue; 
     
    385385         * A map mapping from Exit node to its corresponding exitFnParam info 
    386386         * that we created when lifting the ObjectExpr - we need the param Id 
    387          * and type to make the FnRef in ExitRewriter  
     387         * and type to make the FnRef in ExitRewriter 
    388388         * We use the Exit's span and target label id as the key instead of 
    389          * just the Exit node itself, because by this point, the Exit may  
    390          * have been rewritten and may not be the same if its return  
     389         * just the Exit node itself, because by this point, the Exit may 
     390         * have been rewritten and may not be the same if its return 
    391391         * expression captured mutable variables (they would be boxed). 
    392392         * We only store the function id and type pair as value because 
     
    394394         * would have to dig those info out again. 
    395395         */ 
    396         final Map<Pair<Span,Id>, Pair<Id,Type>>  
     396        final Map<Pair<Span,Id>, Pair<Id,Type>> 
    397397            exitFnParamMap = new HashMap<Pair<Span,Id>, Pair<Id,Type>>(); 
    398398 
     
    404404         * Anonymous inner class that rewrites the Exit node which captured 
    405405         * the free label inside ObjectExpr into a call to the Exit function 
    406          * that passed into lifted ObjectDecl as a param  
     406         * that passed into lifted ObjectDecl as a param 
    407407         */ 
    408408        NodeUpdateVisitor rewriter = new NodeUpdateVisitor() { 
    409                 @Override  
     409                @Override 
    410410                public Node forExit(Exit that) { 
    411411                    Span span = that.getSpan(); 
    412412                    Id labelId = unwrapIfSomeElseError( that.getTarget(), 
    413                                     that.getSpan(),  
     413                                    that.getSpan(), 
    414414                                    "Exit target label is not disambiguated!" ); 
    415415                    Pair<Span,Id> exitKey = new Pair<Span,Id>(span, labelId); 
     
    421421                        Id fnName = exitFnInfo.first(); 
    422422                        FnRef fnRef = ExprFactory.makeFnRef(fnName); 
    423                         exprs.add(fnRef);  
    424                         exprs.add( unwrapIfSomeElseAlternative(returnExpr,  
     423                        exprs.add(fnRef); 
     424                        exprs.add( unwrapIfSomeElseAlternative(returnExpr, 
    425425                                     ExprFactory.makeVoidLiteralExpr(span)) ); 
    426426 
     
    510510        } 
    511511 
    512         // Handle static params from the enclosing nested FnDef 
     512        // Handle static params from the enclosing nested FnDecl 
    513513        for(Node n : scopeStack) { 
    514             if(n instanceof FnDef) { 
    515                 sParams = ((FnDef) n).getStaticParams(); 
     514            if(n instanceof FnDecl) { 
     515                sParams = ((FnDecl) n).getStaticParams(); 
    516516                for(StaticParam sp : sParams) { 
    517                     args.add( makeStaticArgFromStaticParam(sp) );  
     517                    args.add( makeStaticArgFromStaticParam(sp) ); 
    518518                } 
    519519            } 
     
    571571            /* Make the argument for each exit label captured: 
    572572             *     fn(e:exitWithType) : exitWithType => exit foo with e  OR 
    573              *     fn() : () => exit foo  
     573             *     fn() : () => exit foo 
    574574             * Actually, this is a "cheat".  The fn should really have 
    575575             * BottomType as its return type, but since BottomType cannot be 
     
    578578             */ 
    579579            for(Exit exit : freeExitLabels) { 
    580                 Span exitSpan = exit.getSpan();  
     580                Span exitSpan = exit.getSpan(); 
    581581                exitFnExprParams = new LinkedList<Param>(); 
    582                 exitWithId = NodeFactory.makeId( exitSpan,  
     582                exitWithId = NodeFactory.makeId( exitSpan, 
    583583                                MANGLE_CHAR+EXIT_WITH_PARAM ); 
    584584 
     
    589589                        VarRef var = ExprFactory.makeVarRef(exitSpan, 
    590590                                            exitWithId, exitWithTypeOp); 
    591                         exitFnBody = ExprFactory.makeExit(exitSpan,  
     591                        exitFnBody = ExprFactory.makeExit(exitSpan, 
    592592                            exit.getExprType(), exit.getTarget(), var); 
    593                         exitFnExprParams.add(  
     593                        exitFnExprParams.add( 
    594594                            NodeFactory.makeNormalParam(exitSpan, 
    595595                                exitWithId, exitWithTypeOp) ); 
     
    598598                                    "Exit with expr of an unknown type!" ); 
    599599                    } 
    600                     exitFnRetTypeOp = exitWithTypeOp;  
     600                    exitFnRetTypeOp = exitWithTypeOp; 
    601601                } else { 
    602                     exitFnBody = exit;  
    603                     exitFnRetTypeOp = Option.<Type>some(  
     602                    exitFnBody = exit; 
     603                    exitFnRetTypeOp = Option.<Type>some( 
    604604                                        NodeFactory.makeVoidType(exitSpan) ); 
    605                 }  
    606  
    607                 exitFnExpr = ExprFactory.makeFnExpr( exitSpan,  
     605                } 
     606 
     607                exitFnExpr = ExprFactory.makeFnExpr( exitSpan, 
    608608                                exitFnExprParams, exitFnRetTypeOp, exitFnBody ); 
    609609                exprs.add(exitFnExpr); 
     
    651651        } 
    652652 
    653         params = makeParamsForLiftedObj(target, freeNames,  
     653        params = makeParamsForLiftedObj(target, freeNames, 
    654654                                        enclosingSelf, exitFnParamMap); 
    655655        /* Use default value for modifiers, where clauses, 
     
    702702        } 
    703703 
    704         // Handle static params from the enclosing nested FnDef 
     704        // Handle static params from the enclosing nested FnDecl 
    705705        for(Node n : scopeStack) { 
    706             if(n instanceof FnDef) { 
    707                 sParams = ((FnDef) n).getStaticParams(); 
    708                 sParamsCopy.addAll(sParams);  
     706            if(n instanceof FnDecl) { 
     707                sParams = ((FnDecl) n).getStaticParams(); 
     708                sParamsCopy.addAll(sParams); 
    709709            } 
    710710        } 
     
    743743                    // FIXME: what span should I use? 
    744744                    type = var.getExprType(); 
    745                     param = NodeFactory.makeNormalParam(var.getSpan(),  
     745                    param = NodeFactory.makeNormalParam(var.getSpan(), 
    746746                                                        var.getVar(), type); 
    747747                    params.add(param); 
     
    774774                if(retExpr.isSome()) { 
    775775                    retType = unwrapIfSomeElseError( 
    776                                 retExpr.unwrap().getExprType(),  
    777                                 exitSpan,  
     776                                retExpr.unwrap().getExprType(), 
     777                                exitSpan, 
    778778                                "Exit with expr of an unknown type!" ); 
    779779                } else { // exit with no expr 
     
    783783                exitFnType = NodeFactory.makeArrowType( exitSpan, retType, retType ); 
    784784                type = Option.<Type>some(exitFnType); 
    785                 Id exitFnId = NodeFactory.makeId(exitSpan,  
     785                Id exitFnId = NodeFactory.makeId(exitSpan, 
    786786                        MANGLE_CHAR + EXIT_FUNC_PREFIX + "_" + exitIndex); 
    787787                param = NodeFactory.makeNormalParam(exitSpan, exitFnId, type); 
     
    815815        Id enclosingParamId = NodeFactory.makeId(paramSpan, 
    816816                MANGLE_CHAR + ENCLOSING_PREFIX + "_" + objExprNestingLevel); 
    817         param = NodeFactory.makeNormalParam(paramSpan,  
     817        param = NodeFactory.makeNormalParam(paramSpan, 
    818818                                        enclosingParamId, enclosingSelfType); 
    819819 
     
    821821    } 
    822822 
    823     /*  
     823    /* 
    824824     * Generate a map mapping from mutable VarRef to its coresponding 
    825825     * container info (i.e. its boxed ObjectDecl, the new VarDecl to create 
     
    892892        return uniqueId++; 
    893893    } 
    894          
     894 
    895895    /* Static helper methods for handling Option<T> */ 
    896896    private static <T> T 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/ExprDisambiguator.java

    r3074 r3077  
    4646import com.sun.fortress.nodes.Exit; 
    4747import com.sun.fortress.nodes.Expr; 
    48 import com.sun.fortress.nodes.FnDef; 
     48import com.sun.fortress.nodes.FnDecl; 
    4949import com.sun.fortress.nodes.FnExpr; 
    5050import com.sun.fortress.nodes.FnRef; 
     
    432432 
    433433            @Override 
    434             public Set<Id> forFnDef(FnDef that) { 
     434            public Set<Id> forFnDecl(FnDecl that) { 
    435435                return Collections.emptySet(); 
    436436            } 
     
    464464 
    465465            @Override 
    466             public Set<IdOrOpOrAnonymousName> forFnDef(FnDef that) { 
     466            public Set<IdOrOpOrAnonymousName> forFnDecl(FnDecl that) { 
    467467                if (NodeUtil.isSetterOrGetter(that.getMods())) { 
    468468                    accessors.add(that.getName()); 
     
    510510 
    511511//             @Override 
    512 //             public Set<Id> forFnDef(FnDef that) { 
     512//             public Set<Id> forFnDecl(FnDecl that) { 
    513513//                 return Collections.emptySet(); 
    514514//             } 
     
    541541 
    542542//             @Override 
    543 //             public Set<IdOrOpOrAnonymousName> forFnDef(FnDef that) { 
     543//             public Set<IdOrOpOrAnonymousName> forFnDecl(FnDecl that) { 
    544544//                 if( isSetterOrGetter(that.getMods()) ) 
    545545//                     accessors.add(that.getName()); 
     
    900900 
    901901        // No need to recur on the name, as we will not modify it and we have already checked 
    902         // for shadowing in forObjectDecl. Also, if this FnDef is a getter, we allow it 
     902        // for shadowing in forObjectDecl. Also, if this FnDecl is a getter, we allow it 
    903903        // to share its name with a field, so blindly checking for shadowing at this point 
    904904        // doesn't work. 
     
    917917 
    918918    /** 
    919      * When recurring on a FnDef, we first need to extend the 
     919     * When recurring on a FnDecl, we first need to extend the 
    920920     * environment with all the newly bound static parameters that 
    921921     * can be used in an expression context, along with all function 
     
    923923     * TODO: Handle variables bound in where clauses. 
    924924     */ 
    925     @Override public Node forFnDef(FnDef that) { 
     925    @Override public Node forFnDecl(FnDecl that) { 
    926926        Set<Id> staticExprVars = extractStaticExprVars(that.getStaticParams()); 
    927927        Set<Id> params = extractParamNames(that.getParams()); 
     
    930930 
    931931        // No need to recur on the name, as we will not modify it and we have already checked 
    932         // for shadowing in forObjectDecl. Also, if this FnDef is a getter, we allow it 
     932        // for shadowing in forObjectDecl. Also, if this FnDecl is a getter, we allow it 
    933933        // to share its name with a field, so blindly checking for shadowing at this point 
    934934        // doesn't work. 
    935         return forFnDefOnly(that, 
     935        return forFnDeclOnly(that, 
    936936                            v.recurOnListOfModifier(that.getMods()), 
    937937                            (IdOrOpOrAnonymousName) that.getName(), 
     
    11361136        Set<IdOrOpOrAnonymousName> definedNames = extractDefinedFnNames(that.getFns()); 
    11371137        ExprDisambiguator v = extendWithLocalFns(definedNames); 
    1138         List<FnDef> fnsResult = v.recurOnListOfFnDef(that.getFns()); 
     1138        List<FnDecl> fnsResult = v.recurOnListOfFnDecl(that.getFns()); 
    11391139        List<Expr> bodyResult = v.recurOnListOfExpr(that.getBody()); 
    11401140        Option<Type> type_result = recurOnOptionOfType(that.getExprType()); 
     
    11431143 
    11441144 
    1145     private Set<IdOrOpOrAnonymousName> extractDefinedFnNames(Iterable<FnDef> fnDefs) { 
     1145    private Set<IdOrOpOrAnonymousName> extractDefinedFnNames(Iterable<FnDecl> fnDefs) { 
    11461146        Set<IdOrOpOrAnonymousName> result = new HashSet<IdOrOpOrAnonymousName>(); 
    1147         for (FnDef fd : fnDefs) { result.add(fd.getName()); } 
     1147        for (FnDecl fd : fnDefs) { result.add(fd.getName()); } 
    11481148        // multiple instances of the same name are allowed 
    11491149        return result; 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/TypeDisambiguator.java

    r3074 r3077  
    4444import com.sun.fortress.nodes.Effect; 
    4545import com.sun.fortress.nodes.Expr; 
    46 import com.sun.fortress.nodes.FnDef; 
     46import com.sun.fortress.nodes.FnDecl; 
    4747import com.sun.fortress.nodes.GrammarDef; 
    4848import com.sun.fortress.nodes.GrammarMemberDecl; 
     
    231231     * environment with all the newly bound static parameters. 
    232232     */ 
    233     @Override public Node forFnDef(final FnDef that) { 
     233    @Override public Node forFnDecl(final FnDecl that) { 
    234234        TypeDisambiguator v = this.extend(that.getStaticParams()); 
    235235 
    236         return forFnDefOnly(that, 
     236        return forFnDeclOnly(that, 
    237237                v.recurOnListOfModifier(that.getMods()), 
    238238                (IdOrOpOrAnonymousName) that.getName().accept(v), 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/index/DeclaredFunction.java

    r2455 r3077  
    2525import com.sun.fortress.nodes.Expr; 
    2626import com.sun.fortress.nodes.FnAbsDeclOrDecl; 
    27 import com.sun.fortress.nodes.FnDef; 
     27import com.sun.fortress.nodes.FnDecl; 
    2828import com.sun.fortress.nodes.Node; 
    2929import com.sun.fortress.nodes.NodeDepthFirstVisitor; 
     
    5252                        } 
    5353                        @Override 
    54                         public Option<Expr> forFnDef(FnDef that) { 
     54                        public Option<Expr> forFnDecl(FnDecl that) { 
    5555                                return Option.some(that.getBody()); 
    5656                        } 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/index/DeclaredMethod.java

    r2455 r3077  
    2525import com.sun.fortress.nodes.Expr; 
    2626import com.sun.fortress.nodes.FnAbsDeclOrDecl; 
    27 import com.sun.fortress.nodes.FnDef; 
     27import com.sun.fortress.nodes.FnDecl; 
    2828import com.sun.fortress.nodes.Id; 
    2929import com.sun.fortress.nodes.Node; 
     
    5757                        } 
    5858                        @Override 
    59                         public Option<Expr> forFnDef(FnDef that) { 
     59                        public Option<Expr> forFnDecl(FnDecl that) { 
    6060                                return Option.some(that.getBody()); 
    6161                        } 
    6262                }); 
    6363        } 
    64          
     64 
    6565        @Override 
    6666        public List<Param> parameters() { 
     
    8383        @Override 
    8484        public Functional instantiate(List<StaticParam> params, List<StaticArg> args) { 
    85                 FnAbsDeclOrDecl replaced_decl =  
     85                FnAbsDeclOrDecl replaced_decl = 
    8686                        (FnAbsDeclOrDecl)_ast.accept(new StaticTypeReplacer(params,args)); 
    8787                return new DeclaredMethod(replaced_decl,_declaringTrait); 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/index/FunctionalMethod.java

    r2455 r3077  
    2525import com.sun.fortress.nodes.Expr; 
    2626import com.sun.fortress.nodes.FnAbsDeclOrDecl; 
    27 import com.sun.fortress.nodes.FnDef; 
     27import com.sun.fortress.nodes.FnDecl; 
    2828import com.sun.fortress.nodes.Id; 
    2929import com.sun.fortress.nodes.Node; 
     
    6262                        } 
    6363                        @Override 
    64                         public Option<Expr> forFnDef(FnDef that) { 
     64                        public Option<Expr> forFnDecl(FnDecl that) { 
    6565                                return Option.some(that.getBody()); 
    6666                        } 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/InferenceVarInserter.java

    r3074 r3077  
    2323import com.sun.fortress.nodes.Contract; 
    2424import com.sun.fortress.nodes.Expr; 
    25 import com.sun.fortress.nodes.FnDef; 
     25import com.sun.fortress.nodes.FnDecl; 
    2626import com.sun.fortress.nodes.Id; 
    2727import com.sun.fortress.nodes.IdOrOpOrAnonymousName; 
     
    8888 
    8989    @Override 
    90         public Node forFnDefOnly(FnDef that, List<Modifier> mods_result, 
     90        public Node forFnDeclOnly(FnDecl that, List<Modifier> mods_result, 
    9191                        IdOrOpOrAnonymousName name_result, 
    9292                        List<StaticParam> staticParams_result, List<Param> params_result, 
     
    101101                                        returnType_result; 
    102102 
    103                 return super.forFnDefOnly(that, mods_result, name_result, staticParams_result, 
     103                return super.forFnDeclOnly(that, mods_result, name_result, staticParams_result, 
    104104                                params_result, new_ret_type, throwsClause_result, where_result, 
    105105                                contract_result, unambiguousName_result, body_result, implementsUnambiguousName_result); 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeChecker.java

    r3071 r3077  
    530530        } 
    531531 
    532         public TypeChecker extendWithFnDefs(Relation<IdOrOpOrAnonymousName, ? extends FnDef> fns) { 
     532        public TypeChecker extendWithFnDecls(Relation<IdOrOpOrAnonymousName, ? extends FnDecl> fns) { 
    533533                return new TypeChecker(table, 
    534                                 typeEnv.extendWithFnDefs(fns), 
     534                                typeEnv.extendWithFnDecls(fns), 
    535535                                compilationUnit, 
    536536                                subtypeChecker, 
     
    696696                                                                                if(arg0 instanceof TypeParam){ 
    697697                                                                                        Set<BaseType> bounds = CollectUtil.asSet(((TypeParam)arg0).getExtendsClause()); 
    698                                                                                         Type ivt = NodeFactory.make_InferenceVarType(method_name.getSpan());    
    699                                                                                         ConstraintFormula constraint=TypeChecker.this.subtypeChecker.subtype(ivt, NodeFactory.makeIntersectionType(bounds));           
     698                                                                                        Type ivt = NodeFactory.make_InferenceVarType(method_name.getSpan()); 
     699                                                                                        ConstraintFormula constraint=TypeChecker.this.subtypeChecker.subtype(ivt, NodeFactory.makeIntersectionType(bounds)); 
    700700                                                                                        all_results.add(new TypeCheckerResult(that, Option.<Type>none(), constraint)); 
    701701                                                                                        return new TypeArg(NodeFactory.makeSpan(ivt), ivt); 
     
    12231223                else{ 
    12241224                        List<StaticArg> sargs = that.getStaticArgs(); 
    1225                         Option<ConstraintFormula> constraints = StaticTypeReplacer.argsMatchParams(sargs, trait_index.staticParameters(), this.subtypeChecker);  
     1225                        Option<ConstraintFormula> constraints = StaticTypeReplacer.argsMatchParams(sargs, trait_index.staticParameters(), this.subtypeChecker); 
    12261226                        if(constraints.isSome()) { 
    12271227                                // First arg MUST BE a TypeArg, and it must be a supertype of the elements 
     
    23032303 
    23042304        @Override 
    2305         public TypeCheckerResult forFnDef(FnDef that) { 
     2305        public TypeCheckerResult forFnDecl(FnDecl that) { 
    23062306                TypeChecker newChecker = this.extend(that.getStaticParams(), that.getParams(), that.getWhere()); 
    23072307 
     
    23382338                } 
    23392339 
    2340                 FnDef new_node = new FnDef(that.getSpan(), 
     2340                FnDecl new_node = new FnDecl(that.getSpan(), 
    23412341                                that.getMods(), 
    23422342                                that.getName(), 
     
    26842684                Type lhstype; 
    26852685                // Now create the bindings 
    2686          
     2686 
    26872687                if( bindings_count == 1 ){ 
    26882688                        // Just one binding 
     
    29422942        @Override 
    29432943        public TypeCheckerResult forLetFn(LetFn that) { 
    2944                 Relation<IdOrOpOrAnonymousName, FnDef> fnDefs = new IndexedRelation<IdOrOpOrAnonymousName, FnDef>(false); 
    2945                 for (FnDef fnDef : that.getFns()) { 
     2944                Relation<IdOrOpOrAnonymousName, FnDecl> fnDefs = new IndexedRelation<IdOrOpOrAnonymousName, FnDecl>(false); 
     2945                for (FnDecl fnDef : that.getFns()) { 
    29462946                        fnDefs.add(fnDef.getName(), fnDef); 
    29472947                } 
    29482948 
    2949                 TypeChecker newChecker = this.extendWithFnDefs(fnDefs); 
    2950                 List<TypeCheckerResult> fn_results = newChecker.recurOnListOfFnDef(that.getFns()); 
     2949                TypeChecker newChecker = this.extendWithFnDecls(fnDefs); 
     2950                List<TypeCheckerResult> fn_results = newChecker.recurOnListOfFnDecl(that.getFns()); 
    29512951 
    29522952                // A LetFn is like a let. It has a body, and it's type is the type of the body 
     
    29612961                                                body_type, 
    29622962                                                (List<Expr>)TypeCheckerResult.astFromResults(body_results), 
    2963                                                 (List<FnDef>)TypeCheckerResult.astFromResults(fn_results)); 
     2963                                                (List<FnDecl>)TypeCheckerResult.astFromResults(fn_results)); 
    29642964 
    29652965                                TypeCheckerResult result = 
     
    37663766                                                Option.<Type>some(new IntersectionType(NodeFactory.makeSetSpan("impossible", arrow_types), arrow_types)); 
    37673767 
    3768                                         constraints = accumulated_constraints;         
     3768                                        constraints = accumulated_constraints; 
    37693769                                        new_node = new OpRef(that.getSpan(), 
    37703770                                                        that.isParenthesized(), 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeEnv.java

    r3071 r3077  
    5050import com.sun.fortress.nodes.Enclosing; 
    5151import com.sun.fortress.nodes.FnAbsDeclOrDecl; 
    52 import com.sun.fortress.nodes.FnDef; 
     52import com.sun.fortress.nodes.FnDecl; 
    5353import com.sun.fortress.nodes.Id; 
    5454import com.sun.fortress.nodes.IdOrOpOrAnonymousName; 
     
    109109 
    110110        //Iterate over top level types, adding each to component-level environment 
    111          
     111 
    112112        typeEnv = typeEnv.extendWithTypeConses(cu.typeConses()); 
    113          
    114          
     113 
     114 
    115115        return typeEnv; 
    116116    } 
     
    229229        return NodeFactory.makeIdFromLast(id); 
    230230    } 
    231      
     231 
    232232    static Enclosing removeApi(Enclosing id) { 
    233233        return NodeFactory.makeEnclosing(id.getSpan(), id.getOpen(), id.getClose()); 
    234234    } 
    235      
     235 
    236236    static Op removeApi(Op id) { 
    237237        return NodeFactory.makeOp(id.getSpan(), id.getText(), id.getFixity()); 
    238238    } 
    239      
     239 
    240240    static IdOrOpOrAnonymousName removeApi(IdOrOpOrAnonymousName id) { 
    241241        return id.accept(new NodeDepthFirstVisitor<IdOrOpOrAnonymousName>(){ 
    242                         @Override  
     242                        @Override 
    243243                        public IdOrOpOrAnonymousName forEnclosing(Enclosing that) { 
    244244                                return NodeFactory.makeEnclosing(that.getSpan(), that.getOpen(), that.getClose()); 
     
    259259        }); 
    260260    } 
    261      
     261 
    262262    /** 
    263263     * Return a BindingLookup that binds the given IdOrOpOrAnonymousName to a type 
     
    271271     */ 
    272272    public abstract Option<StaticParam> staticParam(IdOrOpOrAnonymousName id); 
    273      
     273 
    274274    /** 
    275275     * Return the {@code Node} that declared the given id, or None if the id does not 
     
    277277     * functions have multiple declaration sites. You can tell if an id is a function 
    278278     * or not by calling type() on the same id. 
    279      *  
     279     * 
    280280     * @exception IllegalArgumentException If var is a function, since functions have 
    281281     * multiple declaration sites. 
    282282     */ 
    283283    public abstract Option<Node> declarationSite(IdOrOpOrAnonymousName var); 
    284      
     284 
    285285    /** 
    286286     * Return the type of the given IdOrOpOrAnonymousName (if the given IdOrOpOrAnonymousName is in 
     
    394394    } 
    395395 
    396     public final TypeEnv extendWithFnDefs(Relation<IdOrOpOrAnonymousName, ? extends FnDef> fns) { 
     396    public final TypeEnv extendWithFnDecls(Relation<IdOrOpOrAnonymousName, ? extends FnDecl> fns) { 
    397397        if (fns.size() == 0) { return this; } 
    398         else { return new FnDefTypeEnv(fns, this); } 
     398        else { return new FnDeclTypeEnv(fns, this); } 
    399399    } 
    400400 
     
    413413        else { return new StaticParamTypeEnv(params,this); } 
    414414    } 
    415      
     415 
    416416    public final TypeEnv extendWithTypeConses(Map<Id, TypeConsIndex> typeConses) { 
    417417        if (typeConses.isEmpty()) { 
     
    509509        public List<Modifier> getMods() { return mods; } 
    510510 
    511         public boolean isMutable() {  
    512             if( mutable )  
     511        public boolean isMutable() { 
     512            if( mutable ) 
    513513                return true; 
    514514 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/Driver.java

    r3047 r3077  
    7373import com.sun.fortress.nodes.FnAbsDeclOrDecl; 
    7474import com.sun.fortress.nodes.FnDecl; 
    75 import com.sun.fortress.nodes.FnDef; 
    7675import com.sun.fortress.nodes.GrammarDecl; 
    7776import com.sun.fortress.nodes.GrammarDef; 
     
    132131 
    133132    public static ArrayList<ComponentWrapper> components; 
    134   
     133 
    135134    public static void reset() { 
    136135        components = null; 
    137136        libraryComponentWrapper = null; 
    138137    } 
    139      
     138 
    140139    public static Environment evalComponent(ComponentIndex p, 
    141140                                            FortressRepository fr) 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/BuildEnvironments.java

    r3053 r3077  
    272272 
    273273 
    274     private void forFnDef1(FnDef x) { 
     274    private void forFnDecl1(FnDecl x) { 
    275275        List<StaticParam> optStaticParams = x.getStaticParams(); 
    276276        String fname = NodeUtil.nameAsMethod(x); 
     
    289289    } 
    290290 
    291    private void forFnDef2(FnDef x) { 
     291   private void forFnDecl2(FnDecl x) { 
    292292   } 
    293293 
    294294   // Overridden in BuildTraitEnvironment 
    295    protected void forFnDef3(FnDef x) { 
     295   protected void forFnDecl3(FnDecl x) { 
    296296       List<StaticParam> optStaticParams = x.getStaticParams(); 
    297297       String fname = NodeUtil.nameAsMethod(x); 
     
    300300   } 
    301301 
    302    private void forFnDef4(FnDef x) { 
     302   private void forFnDecl4(FnDecl x) { 
    303303   } 
    304304 
     
    306306     * (non-Javadoc) 
    307307     * 
    308      * @see com.sun.fortress.interpreter.nodes.NodeVisitor#forFnDef(com.sun.fortress.interpreter.nodes.FnDef) 
    309      */ 
    310     @Override 
    311     public Boolean forFnDef(FnDef x) { 
     308     * @see com.sun.fortress.interpreter.nodes.NodeVisitor#forFnDecl(com.sun.fortress.interpreter.nodes.FnDecl) 
     309     */ 
     310    @Override 
     311    public Boolean forFnDecl(FnDecl x) { 
    312312        switch (getPass()) { 
    313         case 1: forFnDef1(x); break; 
    314         case 2: forFnDef2(x); break; 
    315         case 3: forFnDef3(x); break; 
    316         case 4: forFnDef4(x); break; 
     313        case 1: forFnDecl1(x); break; 
     314        case 2: forFnDecl2(x); break; 
     315        case 3: forFnDecl3(x); break; 
     316        case 4: forFnDecl4(x); break; 
    317317        } 
    318318       return null; 
     
    796796        return bug("BuildEnvironments.forAbsTraitDecl should not be called"); 
    797797    } 
    798      
     798 
    799799    /* 
    800800     * (non-Javadoc) 
     
    874874    public void finishTrait(TraitAbsDeclOrDecl x, FTypeTrait ftt, Environment interior) { 
    875875        List<BaseType> extends_ = NodeUtil.getTypes(x.getExtendsClause()); 
    876         // TODO What if I don't  
     876        // TODO What if I don't 
    877877        // interior = interior.extendAt(x); 
    878878 
     
    10941094     * (non-Javadoc) 
    10951095     * 
    1096      * @see com.sun.fortress.interpreter.nodes.NodeVisitor#forFnDef(com.sun.fortress.interpreter.nodes.AbsFnDecl) 
     1096     * @see com.sun.fortress.interpreter.nodes.NodeVisitor#forFnDecl(com.sun.fortress.interpreter.nodes.AbsFnDecl) 
    10971097     */ 
    10981098    @Override 
     
    11001100        return bug("BuildEnvironments.forAbsFnDecl should not be called"); 
    11011101    } 
    1102      
     1102 
    11031103    /* 
    11041104     * (non-Javadoc) 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/BuildLetEnvironments.java

    r2649 r3077  
    3333import com.sun.fortress.nodes.NodeAbstractVisitor; 
    3434import com.sun.fortress.nodes.Expr; 
    35 import com.sun.fortress.nodes.FnDef; 
     35import com.sun.fortress.nodes.FnDecl; 
    3636import com.sun.fortress.nodes.IdOrOpOrAnonymousName; 
    3737import com.sun.fortress.nodes.LValue; 
     
    6161    @Override 
    6262    public FValue forLetFn(LetFn x) { 
    63         List<FnDef> fns = x.getFns(); 
     63        List<FnDecl> fns = x.getFns(); 
    6464        List<Expr> body = x.getBody(); 
    6565 
    6666        for (int i = 0; i < fns.size(); i++) { 
    67             FnDef fn = fns.get(i); 
     67            FnDecl fn = fns.get(i); 
    6868 
    6969            IdOrOpOrAnonymousName name = fn.getName(); 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/BuildTestEnvironments.java

    r2896 r3077  
    6565    } 
    6666 
    67     public Boolean forFnDef(FnDef x) { 
    68         Debug.debug( Debug.Type.INTERPRETER, 2, "ForFnDef ", x); 
     67    public Boolean forFnDecl(FnDecl x) { 
     68        Debug.debug( Debug.Type.INTERPRETER, 2, "ForFnDecl ", x); 
    6969        List<StaticParam> optStaticParams = x.getStaticParams(); 
    7070        String fname = NodeUtil.nameAsMethod(x); 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/BuildTraitEnvironment.java

    r2969 r3077  
    2828import com.sun.fortress.interpreter.evaluator.values.Simple_fcn; 
    2929import com.sun.fortress.nodes.AbsFnDecl; 
    30 import com.sun.fortress.nodes.FnDef; 
     30import com.sun.fortress.nodes.FnDecl; 
    3131import com.sun.fortress.nodes.FnAbsDeclOrDecl; 
    3232import com.sun.fortress.nodes.Id; 
     
    9494    } 
    9595 
    96     protected void forFnDef3(FnDef x) { 
     96    protected void forFnDecl3(FnDecl x) { 
    9797        List<StaticParam> staticParams = x.getStaticParams(); 
    9898        String fname = NodeUtil.nameAsMethod(x); 
     
    124124     * (non-Javadoc) 
    125125     * 
    126      * @see com.sun.fortress.interpreter.nodes.NodeVisitor#forFnDef(com.sun.fortress.interpreter.nodes.AbsFnDecl) 
     126     * @see com.sun.fortress.interpreter.nodes.NodeVisitor#forFnDecl(com.sun.fortress.interpreter.nodes.AbsFnDecl) 
    127127     */ 
    128128    @Override 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/EvalVarsEnvironment.java

    r2713 r3077  
    2424import com.sun.fortress.nodes.Component; 
    2525import com.sun.fortress.nodes.DimUnitDecl; 
    26 import com.sun.fortress.nodes.FnDef; 
     26import com.sun.fortress.nodes.FnDecl; 
    2727import com.sun.fortress.nodes.ImportApi; 
    2828import com.sun.fortress.nodes.ImportNames; 
     
    6969 
    7070    /* (non-Javadoc) 
    71      * @see com.sun.fortress.interpreter.evaluator.BuildEnvironments#forFnDef(com.sun.fortress.interpreter.nodes.AbsFnDecl) 
     71     * @see com.sun.fortress.interpreter.evaluator.BuildEnvironments#forFnDecl(com.sun.fortress.interpreter.nodes.AbsFnDecl) 
    7272     */ 
    7373    @Override 
     
    7878 
    7979    /* (non-Javadoc) 
    80      * @see com.sun.fortress.interpreter.evaluator.BuildEnvironments#forFnDef(com.sun.fortress.interpreter.nodes.FnDef) 
     80     * @see com.sun.fortress.interpreter.evaluator.BuildEnvironments#forFnDecl(com.sun.fortress.interpreter.nodes.FnDecl) 
    8181     */ 
    8282    @Override 
    83     public Boolean forFnDef(FnDef x) { 
     83    public Boolean forFnDecl(FnDecl x) { 
    8484        return null; 
    8585 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/EvaluatorBase.java

    r2741 r3077  
    131131 
    132132        GenericFunctionOrMethod bar = (GenericFunctionOrMethod) appliedThing; 
    133         // FnAbsDeclOrDecl fndod = bar.getFnDefOrDecl(); 
     133        // FnAbsDeclOrDecl fndod = bar.getFnDeclOrDecl(); 
    134134        List<StaticParam> tparams = bar.getStaticParams(); 
    135135        List<Param> params = bar.getParams(); 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/ScoutVisitor.java

    r1649 r3077  
    2828import com.sun.fortress.nodes.FnAbsDeclOrDecl; 
    2929import com.sun.fortress.nodes.FnDecl; 
    30 import com.sun.fortress.nodes.FnDef; 
     30import com.sun.fortress.nodes.FnDecl; 
    3131import com.sun.fortress.nodes.VarType; 
    3232import com.sun.fortress.nodes.TraitType; 
     
    120120 
    121121    /* (non-Javadoc) 
    122      * @see com.sun.fortress.nodes.NodeAbstractVisitor_void#forFnDef(com.sun.fortress.nodes.FnDef) 
    123      */ 
    124     @Override 
    125     public void forFnDef(FnDef that) { 
    126         // TODO Auto-generated method stub 
    127         super.forFnDef(that); 
    128     } 
    129  
    130     /* (non-Javadoc) 
    131122     * @see com.sun.fortress.nodes.NodeAbstractVisitor_void#forVarType(com.sun.fortress.nodes.VarType) 
    132123     */ 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/types/FTraitOrObject.java

    r2996 r3077  
    3939import com.sun.fortress.nodes.AbsDeclOrDecl; 
    4040import com.sun.fortress.nodes.AbstractNode; 
    41 import com.sun.fortress.nodes.FnDef; 
     41import com.sun.fortress.nodes.FnDecl; 
    4242import com.sun.fortress.nodes.StaticArg; 
    4343import com.sun.fortress.nodes.TraitType; 
     
    456456        } 
    457457        Applicable a = mc.getDef(); 
    458         if (a instanceof FnDef) { 
     458        if (a instanceof FnDecl) { 
    459459            thisSupplies.putItem(s, mo); 
    460460        } else { 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/values/Constructor.java

    r2973 r3077  
    4242import com.sun.fortress.interpreter.glue.WellKnownNames; 
    4343import com.sun.fortress.nodes.AbsDeclOrDecl; 
    44 import com.sun.fortress.nodes.FnDef; 
     44import com.sun.fortress.nodes.FnDecl; 
    4545import com.sun.fortress.nodes.GenericWithParams; 
    4646import com.sun.fortress.nodes.IdOrOpOrAnonymousName; 
     
    451451            MethodClosure pdm = (MethodClosure) sf; 
    452452            Applicable a = pdm.getDef(); 
    453             if (a instanceof FnDef || a instanceof NativeApp) return; 
     453            if (a instanceof FnDecl || a instanceof NativeApp) return; 
    454454            if (a.at().equals(sf.at())) { 
    455455                error(cfn, errorMsg("Object ",cfn.stringName(), 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/values/FGenericFunction.java

    r3003 r3077  
    5353    FnAbsDeclOrDecl fndef; 
    5454 
    55   
     55 
    5656     /* (non-Javadoc) 
    5757      * @see com.sun.fortress.interpreter.evaluator.values.SingleFcn#getDomain() 
     
    134134    } 
    135135 
    136     public FnAbsDeclOrDecl getFnDefOrDecl() { 
     136    public FnAbsDeclOrDecl getFnDeclOrDecl() { 
    137137        return fndef; 
    138138    } 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/values/GenericFunctionalMethod.java

    r2649 r3077  
    4747        // BUG IS HERE, NEED TO instantiate the selfParameterType! ; 
    4848 
    49         FTraitOrObjectOrGeneric instantiatedSelfType = ((FTypeGeneric) selfParameterType).make(args, getFnDefOrDecl()); 
     49        FTraitOrObjectOrGeneric instantiatedSelfType = ((FTypeGeneric) selfParameterType).make(args, getFnDeclOrDecl()); 
    5050 
    5151        FunctionalMethod cl = FType.anyAreSymbolic(args) ? 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/rewrite/DesugarerVisitor.java

    r3073 r3077  
    7272import com.sun.fortress.nodes.FieldRef; 
    7373import com.sun.fortress.nodes.FnAbsDeclOrDecl; 
    74 import com.sun.fortress.nodes.FnDef; 
     74import com.sun.fortress.nodes.FnDecl; 
    7575import com.sun.fortress.nodes.FnExpr; 
    7676import com.sun.fortress.nodes.For; 
     
    602602        immediateDef = null; 
    603603 
    604         boolean savedFnDefIsMethod = atTopLevelInsideTraitOrObject; 
     604        boolean savedFnDeclIsMethod = atTopLevelInsideTraitOrObject; 
    605605        int savedObjectNestingDepth = objectNestingDepth; 
    606606        int savedLexicalNestingDepth = lexicalNestingDepth; 
     
    627627        visibleGenericParameters = savedVisibleGenerics; 
    628628        usedGenericParameters = savedUsedGenerics; 
    629         atTopLevelInsideTraitOrObject = savedFnDefIsMethod; 
     629        atTopLevelInsideTraitOrObject = savedFnDeclIsMethod; 
    630630        objectNestingDepth = savedObjectNestingDepth; 
    631631        lexicalNestingDepth = savedLexicalNestingDepth; 
     
    782782 
    783783    @Override 
    784     public Node forFnDef(FnDef fndef) { 
     784    public Node forFnDecl(FnDecl fndef) { 
    785785        if (atTopLevelInsideTraitOrObject) { 
    786786            rewrites_put(WellKnownNames.defaultSelfName, new SelfRewrite()); 
     
    822822 
    823823            // Remove the original contract, add the translation 
    824             FnDef f = new FnDef(fndef.getSpan(), fndef.getMods(), 
     824            FnDecl f = new FnDecl(fndef.getSpan(), fndef.getMods(), 
    825825                                fndef.getName(), 
    826826                                fndef.getStaticParams(), fndef.getParams(), 
     
    855855        AbstractNode n; 
    856856 
    857     // TODO Contracts, properties, not handled here.  See forFnDef for details. 
     857    // TODO Contracts, properties, not handled here.  See forFnDecl for details. 
    858858 
    859859        // Strip the contract, we don't know what to do with it, 
     
    957957        lexicalNestingDepth++; 
    958958        // defined var is no longer eligible for rewrite. 
    959         List<FnDef> defs = lf.getFns(); 
     959        List<FnDecl> defs = lf.getFns(); 
    960960        defsToLocals(defs); 
    961961        // All the function names are in scope in the function 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/rewrite/IsAnArrowName.java

    r2798 r3077  
    1919import com.sun.fortress.nodes.AbsFnDecl; 
    2020import com.sun.fortress.nodes.ArrowType; 
    21 import com.sun.fortress.nodes.FnDef; 
     21import com.sun.fortress.nodes.FnDecl; 
    2222import com.sun.fortress.nodes.LValueBind; 
    2323import com.sun.fortress.nodes.Node; 
     
    6262 
    6363    /* (non-Javadoc) 
    64      * @see com.sun.fortress.nodes.NodeAbstractVisitor#forFnDef(com.sun.fortress.nodes.FnDef) 
     64     * @see com.sun.fortress.nodes.NodeAbstractVisitor#forFnDecl(com.sun.fortress.nodes.FnDecl) 
    6565     */ 
    6666    @Override 
    67     public ArrowOrFunctional forFnDef(FnDef that) { 
     67    public ArrowOrFunctional forFnDecl(FnDecl that) { 
    6868     // Return "is a self method" 
    6969        return NodeUtil.selfParameterIndex(that) >= 0 ? ArrowOrFunctional.FUNCTIONAL : ArrowOrFunctional.NEITHER; 
  • trunk/ProjectFortress/src/com/sun/fortress/nodes_util/ApiMaker.java

    r3067 r3077  
    8080                } 
    8181 
    82                 @Override public Boolean forFnDef(FnDef that) { 
     82                @Override public Boolean forFnDecl(FnDecl that) { 
    8383                    return new Boolean(containsPrivate(that.getMods())); 
    8484                } 
     
    173173    } 
    174174 
    175     public Option<Node> forFnDef(FnDef that) { 
     175    public Option<Node> forFnDecl(FnDecl that) { 
    176176        if ( ! isPrivate(that) ) { 
    177177            if ( that.getReturnType().isNone() ) 
  • trunk/ProjectFortress/src/com/sun/fortress/nodes_util/NodeFactory.java

    r3071 r3077  
    4848        return new Span(sl,sl); 
    4949    } 
    50      
     50 
    5151    /** 
    52      *  
     52     * 
    5353     * @param start 
    5454     * @return  the span from a node. 
     
    5656        return node.getSpan(); 
    5757    } 
    58      
     58 
    5959    /** 
    60      *  
     60     * 
    6161     * @param start 
    6262     * @param finish 
     
    6565        return new Span(start.getBegin(), finish.getEnd()); 
    6666    } 
    67      
     67 
    6868    /** 
    69      *  
     69     * 
    7070     * @param start 
    7171     * @param finish 
     
    7575        return makeSpan(start.getSpan(), finish.getSpan()); 
    7676    } 
    77      
     77 
    7878    /** 
    79      *  
     79     * 
    8080     * @param start 
    8181     * @param l 
     
    8686        return makeSpan(start, s == 0 ? start : l.get(s-1)); 
    8787    } 
    88       
     88 
    8989     /** 
    90       *  
     90      * 
    9191      * @param start 
    9292      * @param l 
     
    9797        return makeSpan(s == 0 ? finish : l.get(0), finish); 
    9898    } 
    99            
     99 
    100100     /** 
    101       *  
     101      * 
    102102      * @param start 
    103103      * @param l 
     
    112112     * more like a set of spans ought to be used.  Even though this is not yet 
    113113     * implemented, the name is provided to allow expression of intent. 
    114      *  
     114     * 
    115115     * @param start 
    116116     * @param l 
     
    124124      * more like a set of spans ought to be used.  Even though this is not yet 
    125125      * implemented, the name is provided to allow expression of intent. 
    126       *  
     126      * 
    127127      * @param start 
    128128      * @param l 
     
    136136     * more like a set of spans ought to be used.  Even though this is not yet 
    137137     * implemented, the name is provided to allow expression of intent. 
    138      *  
     138     * 
    139139     * @param l 
    140140     * @return the span encompassing the spans the first and last nodes of the list. 
     
    143143        return makeSpan(ifEmpty, l); 
    144144    } 
    145      
     145 
    146146    public static AbsFnDecl makeAbsFnDecl(Span span, List<Modifier> mods, 
    147147                                          Id name, Option<Type> type) { 
     
    672672 
    673673    /** 
    674      * Alternatively, you can invoke the FnDef constructor without a selfName 
     674     * Alternatively, you can invoke the FnDecl constructor without a selfName 
    675675     */ 
    676     public static FnDef makeFnDecl(Span s, List<Modifier> mods, 
     676    public static FnDecl makeFnDecl(Span s, List<Modifier> mods, 
    677677                                   IdOrOpOrAnonymousName name, 
    678678                                   List<StaticParam> staticParams, 
     
    683683                                   Option<Contract> contract, 
    684684                                   Expr body) { 
    685         return new FnDef(s, mods, name, staticParams, params, returnType, 
     685        return new FnDecl(s, mods, name, staticParams, params, returnType, 
    686686                         throwss, where, contract, body); 
    687687    } 
    688688 
    689     public static FnDef makeFnDef(Span span, List<Modifier> mods, 
     689    public static FnDecl makeFnDecl(Span span, List<Modifier> mods, 
    690690                                  Id name, Option<Type> type, Expr body) { 
    691         return makeFnDef(span, mods, name, Collections.<Param>emptyList(), type, 
     691        return makeFnDecl(span, mods, name, Collections.<Param>emptyList(), type, 
    692692                         body); 
    693693    } 
    694694 
    695     public static FnDef makeFnDef(Span span, List<Modifier> mods, 
     695    public static FnDecl makeFnDecl(Span span, List<Modifier> mods, 
    696696                                  Id name, List<Param> params, 
    697697                                  Option<Type> type, Expr body) { 
    698         return new FnDef(span, mods, name, Collections.<StaticParam>emptyList(), 
     698        return new FnDecl(span, mods, name, Collections.<StaticParam>emptyList(), 
    699699                         params, type, Option.<List<BaseType>>none(), 
    700700                         Option.<WhereClause>none(), Option.<Contract>none(), 
  • trunk/ProjectFortress/src/com/sun/fortress/nodes_util/NodeUtil.java

    r3073 r3077  
    150150 
    151151    public static Option<Expr> getBody(Applicable def) { 
    152         if (def instanceof FnDef) { return Option.some(((FnDef)def).getBody()); } 
     152        if (def instanceof FnDecl) { return Option.some(((FnDecl)def).getBody()); } 
    153153        else if (def instanceof FnExpr) { return Option.some(((FnExpr)def).getBody()); } 
    154154        else { return Option.none(); } 
  • trunk/ProjectFortress/src/com/sun/fortress/parser/LocalDecl.rats

    r3016 r3077  
    7575private LetExpr LocalVarFnDecl = 
    7676     a1:LocalFnDecl a2s:(br LocalFnDecl)* 
    77      { List<FnDef> fns = FortressUtil.mkList(a1, a2s.list()); 
     77     { List<FnDecl> fns = FortressUtil.mkList(a1, a2s.list()); 
    7878       yyValue = new LetFn(createSpan(yyStart,yyCount), false, 
    7979                           FortressUtil.emptyExprs(), fns); 
     
    8282 
    8383/* LocalFnDecl ::= Mods? NamedFnHeaderFront FnHeaderClause w = w NoNewlineExpr */ 
    84 private FnDef LocalFnDecl = 
     84private FnDecl LocalFnDecl = 
    8585     a1:Mods? a2:NamedFnHeaderFront a3:FnHeaderClause w equals w a4:NoNewlineExpr 
    8686     { if (a1 == null) a1 = FortressUtil.emptyModifiers(); 
  • trunk/ProjectFortress/src/com/sun/fortress/parser_util/FortressUtil.java

    r3071 r3077  
    9292 
    9393    private static Effect effect = new Effect(NodeFactory.makeSpan("singleton")); 
    94      
     94 
    9595    public static Effect emptyEffect() { 
    9696        return effect; 
     
    618618    } 
    619619 
    620     public static FnDef mkFnDecl(Span span, List<Modifier> mods, 
     620    public static FnDecl mkFnDecl(Span span, List<Modifier> mods, 
    621621                                 FnHeaderFront fhf, 
    622622                                 FnHeaderClause fhc, Expr expr) { 
     
    630630    } 
    631631 
    632     public static FnDef mkFnDecl(Span span, List<Modifier> mods, IdOrOpOrAnonymousName name, 
     632    public static FnDecl mkFnDecl(Span span, List<Modifier> mods, IdOrOpOrAnonymousName name, 
    633633                                 List<StaticParam> sparams, List<Param> params, 
    634634                                 FnHeaderClause fhc, Expr expr) { 
  • trunk/ProjectFortress/src/com/sun/fortress/parser_util/SyntaxChecker.java

    r3072 r3077  
    243243    } 
    244244 
    245     public void forFnDefOnly(FnDef that) { 
     245    public void forFnDeclOnly(FnDecl that) { 
    246246        if ( NodeUtil.isGetter(that) ) { 
    247247            if ( ! that.getParams().isEmpty() ) 
  • trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/phases/Transform.java

    r3071 r3077  
    128128     * LValueBind    ( only for LocalVarDecl ) - done 
    129129     * UnpastingBind ( only for LocalVarDecl ) - done 
    130      * FnDef         ( only for local function decls ) - done 
     130     * FnDecl        ( only for local function decls ) - done 
    131131     * NormalParam   ( only for FnExpr and local function decls ) - done 
    132132     * VarargsParam  ( only for FnExpr and local function decls ) - done 
     
    138138     *    For - done 
    139139     *    While - done 
    140      *    Accumulator -  
    141      *    GeneratedExpr  
    142      *    ArrayComprehensionClause  
     140     *    Accumulator - 
     141     *    GeneratedExpr 
     142     *    ArrayComprehensionClause 
    143143     *    IfClause - done 
    144144     */ 
     
    336336            Option<Type> exprType_result = recurOnOptionOfType(that.getExprType()); 
    337337            List<Expr> body_result = recurOnListOfExpr(that.getBody()); 
    338             List<FnDef> fns_result = Useful.applyToAll(that.getFns(), new Fn<FnDef, FnDef>(){ 
    339                 public FnDef apply(FnDef fn){ 
    340                     return (FnDef) fn.accept( new TemplateUpdateVisitor(){ 
    341                             public Node forFnDefOnly(FnDef that, List<Modifier> mods_result, IdOrOpOrAnonymousName name_result, List<StaticParam> staticParams_result, List<Param> params_result, Option<Type> returnType_result, Option<List<BaseType>> throwsClause_result, Option<WhereClause> where_result, Option<Contract> contract_result, Expr body_result) { 
     338            List<FnDecl> fns_result = Useful.applyToAll(that.getFns(), new Fn<FnDecl, FnDecl>(){ 
     339                public FnDecl apply(FnDecl fn){ 
     340                    return (FnDecl) fn.accept( new TemplateUpdateVisitor(){ 
     341                            public Node forFnDeclOnly(FnDecl that, List<Modifier> mods_result, IdOrOpOrAnonymousName name_result, List<StaticParam> staticParams_result, List<Param> params_result, Option<Type> returnType_result, Option<List<BaseType>> throwsClause_result, Option<WhereClause> where_result, Option<Contract> contract_result, Expr body_result) { 
    342342                                List<Param> new_params_result = Useful.applyToAll(params_result, renameParam); 
    343343                                if ( name_result instanceof Id) { 
     
    345345                                    Id generatedId = generateId(old); 
    346346                                    extendSyntaxEnvironment(old, generatedId); 
    347                                     return new FnDef(that.getSpan(), mods_result, generatedId, staticParams_result, new_params_result, returnType_result, throwsClause_result, where_result, contract_result, body_result); 
     347                                    return new FnDecl(that.getSpan(), mods_result, generatedId, staticParams_result, new_params_result, returnType_result, throwsClause_result, where_result, contract_result, body_result); 
    348348                                } else { 
    349                                     return new FnDef(that.getSpan(), mods_result, name_result, staticParams_result, 
     349                                    return new FnDecl(that.getSpan(), mods_result, name_result, staticParams_result, 
    350350                                                     new_params_result, returnType_result, throwsClause_result, 
    351351                                                     where_result, contract_result, body_result); 
  • trunk/ProjectFortress/src/com/sun/fortress/tools/FortressAstToConcrete.java

    r3074 r3077  
    778778 
    779779 
    780     @Override public String forFnDefOnly(FnDef that, 
     780    @Override public String forFnDeclOnly(FnDecl that, 
    781781                                         List<String> mods_result, 
    782782                                         final String name_result, 
  • trunk/ProjectFortress/static_tests/syntax_abstraction/transformer/SyntaxExtends.fsi

    r2957 r3077  
    2424  grammar A extends { Declaration, D } 
    2525    Decl |List[\Decl\]:= 
    26       some Thing  
     26      some Thing 
    2727        do 
    28           fnDef : FnDef = FnDef(emptyList[\Modifier\](),  
     28          fnDef : FnDecl = FnDecl(emptyList[\Modifier\](), 
    2929                     Id(Nothing[\APIName\], "some" Thing.in_text), 
    3030                     emptyList[\StaticParam\](), 
     
    3636                     "foo", 
    3737                     StringLiteralExpr("some " Thing.in_text)) 
    38           ls : List[\FnDef\] = emptyList[\FnDef\](1) 
     38          ls : List[\FnDecl\] = emptyList[\FnDecl\](1) 
    3939          ls.addRight(fnDef) 
    4040        end 
     
    6363      thingC1 <[ thingC1 ]> 
    6464 
    65     Gnu :Expr:=  
     65    Gnu :Expr:= 
    6666      Thing do Thing.in_text end 
    6767 
  • trunk/ProjectFortress/tests/objectCC_staticParams.fss

    r2999 r3077  
    6464end 
    6565 
    66 (* Nested FnDefs within the object decl which declares more static params *) 
    67 (* Local functions with generatics are not supported at the moment;  
     66(* Nested FnDecls within the object decl which declares more static params *) 
     67(* Local functions with generatics are not supported at the moment; 
    6868   remove the comments when they are. 
    6969object O3[\X extends String, S extends String\](x:X, s:S) 
     
    7575end *) 
    7676 
    77 (* Nested FnDefs within the object decl which declares more static params *) 
    78 (* Local functions with generatics are not supported at the moment;  
     77(* Nested FnDecls within the object decl which declares more static params *) 
     78(* Local functions with generatics are not supported at the moment; 
    7979   remove the comments when they are. 
    8080object O4[\X extends String, S extends String\](x:X, s:S) 
     
    9898    assert( o1.s, t.a(), "t.a() failed." ) 
    9999 
    100 (* Local functions with generatics are not supported at the moment;  
     100(* Local functions with generatics are not supported at the moment; 
    101101   remove the comments when they are. 
    102102