Changeset 3082

Show
Ignore:
Timestamp:
11/19/08 08:38:20 (12 months ago)
Author:
sukyoungryu
Message:

[ast] Eliminated nodes: LValueBind, Unpasting, UnpastingBind?, and UnpastingSplit?

Location:
trunk/ProjectFortress
Files:
39 modified

Legend:

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

    r3081 r3082  
    349349         * variable declaration in components or APIs 
    350350         */ 
    351         abstract VarAbsDeclOrDecl(List<LValueBind> lhs) implements AbsDeclOrDecl; 
     351        abstract VarAbsDeclOrDecl(List<LValue> lhs) implements AbsDeclOrDecl; 
    352352            /** 
    353353             * variable declaration in APIs 
     
    375375        /** 
    376376         * left-hand side of variable declaration 
    377          */ 
    378         abstract LValue(); 
    379             /** 
    380              * e.g.) var x: ZZ32 
    381              * Name must be unqualified. 
    382              */ 
    383             LValueBind(Id name, Option<Type> type = Option.<Type>none(), 
    384                        List<Modifier> mods = Collections.<Modifier>emptyList(), 
    385                        boolean mutable = false) implements Lhs, ImplicitGetterSetter; 
    386             /** 
    387              * left-hand side of matrix unpasting 
    388              * Unpasting ::= [ UnpastingElems ] 
    389              */ 
    390             abstract Unpasting(); 
    391                 /** 
    392                  * simple unpasting 
    393                  * Names must be unqualified. 
    394                  * UnpastingElem ::= BindId ([ UnpastingDim ])? 
    395                  *                 | Unpasting 
    396                  * UnpastingDim ::= ExtentRange (BY ExtentRange)+ 
    397                  * e.g.) squareShape[m BY m] 
    398                  */ 
    399                 UnpastingBind(Id name, List<ExtentRange> dim); 
    400                 /** 
    401                  * complex unpasting 
    402                  * UnpastingElems ::= UnpastingElem RectSeparator UnpastingElems 
    403                  *                  | UnpastingElem 
    404                  * e.g.) squareShape[m BY m]  rest 
    405                  */ 
    406                 UnpastingSplit(List<Unpasting> elems, int dim); 
     377         * e.g.) var x: ZZ32 
     378         * Name must be unqualified. 
     379         */ 
     380        LValue(Id name, Option<Type> type = Option.<Type>none(), 
     381               List<Modifier> mods = Collections.<Modifier>emptyList(), 
     382               boolean mutable = false) implements Lhs, ImplicitGetterSetter; 
    407383        /** 
    408384         * Overloading specification 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/IndexBuilder.java

    r3076 r3082  
    387387    private void buildVariables(VarAbsDeclOrDecl ast, 
    388388            Map<Id, Variable> variables) { 
    389         for (LValueBind b : ast.getLhs()) { 
     389        for (LValue b : ast.getLhs()) { 
    390390            variables.put(b.getName(), new DeclaredVariable(b)); 
    391391        } 
     
    400400            Map<Id, Method> getters, 
    401401            Map<Id, Method> setters) { 
    402         for (LValueBind b : ast.getLhs()) { 
     402        for (LValue b : ast.getLhs()) { 
    403403            ModifierSet mods = extractModifiers(b.getMods()); 
    404404            // TODO: check for correct modifiers? 
     
    422422            Map<Id, Method> getters, 
    423423            Map<Id, Method> setters) { 
    424         for (LValueBind b : ast.getLhs()) { 
     424        for (LValue b : ast.getLhs()) { 
    425425            ModifierSet mods = extractModifiers(b.getMods()); 
    426426            // TODO: check for correct modifiers? 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/DesugaringVisitor.java

    r3077 r3082  
    9797 
    9898    private boolean mutable(ImplicitGetterSetter field) { 
    99         if ( field instanceof LValueBind ) 
    100             return ((LValueBind)field).isMutable(); 
     99        if ( field instanceof LValue ) 
     100            return ((LValue)field).isMutable(); 
    101101 
    102102        for (Modifier mod : field.getMods()) { 
     
    179179        for (Decl decl: decls) { 
    180180            if (decl instanceof VarAbsDeclOrDecl) { 
    181                 for (LValueBind binding : (((VarAbsDeclOrDecl)decl).getLhs())) { 
     181                for (LValue binding : (((VarAbsDeclOrDecl)decl).getLhs())) { 
    182182                    newScope.add(binding.getName()); 
    183183                } 
     
    197197        for (Decl decl: decls) { 
    198198            if (decl instanceof VarAbsDeclOrDecl) { 
    199                 for (LValueBind binding : (((VarAbsDeclOrDecl)decl).getLhs())) { 
     199                for (LValue binding : (((VarAbsDeclOrDecl)decl).getLhs())) { 
    200200                    newScope.add(binding.getName()); 
    201201                } 
     
    331331            decl.accept(new NodeAbstractVisitor_void() { 
    332332                public void forVarAbsDeclOrDecl(VarAbsDeclOrDecl decl) { 
    333                     for (LValueBind binding : decl.getLhs()) { 
     333                    for (LValue binding : decl.getLhs()) { 
    334334                        if (! hidden(binding) && 
    335335                            ! hasExplicitGetter(binding.getName(), decls)) { 
     
    355355            decl.accept(new NodeAbstractVisitor_void() { 
    356356                public void forVarAbsDeclOrDecl(VarAbsDeclOrDecl dec) { 
    357                     for (LValueBind binding : dec.getLhs()) { 
     357                    for (LValue binding : dec.getLhs()) { 
    358358                        if (! hidden(binding) && 
    359359                            ! hasExplicitGetter(binding.getName(), decls)) { 
     
    374374        return new NodeUpdateVisitor() { 
    375375            public Node forVarDecl(VarDecl that) { 
    376                 List<LValueBind> newLVals = new ArrayList<LValueBind>(); 
    377  
    378                 for (LValueBind lval : that.getLhs()) { 
     376                List<LValue> newLVals = new ArrayList<LValue>(); 
     377 
     378                for (LValue lval : that.getLhs()) { 
    379379                    // System.err.println(mangleName(lval.getName())); 
    380380                    newLVals.add(NodeFactory.makeLValue(lval, mangleName(lval.getName()))); 
     
    383383            } 
    384384            public Node forAbsVarDecl(AbsVarDecl that) { 
    385                 List<LValueBind> newLVals = new ArrayList<LValueBind>(); 
    386  
    387                 for (LValueBind lval : that.getLhs()) { 
     385                List<LValue> newLVals = new ArrayList<LValue>(); 
     386 
     387                for (LValue lval : that.getLhs()) { 
    388388                    newLVals.add(NodeFactory.makeLValue(lval, mangleName(lval.getName()))); 
    389389                } 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/FreeNameCollector.java

    r3077 r3082  
    7070     *        pair.first is the VarRef 
    7171     *        pair.second is the decl node where the VarRef is declared 
    72      *            (which is either a Param, LValueBind, or LocalVarDecl) 
     72     *            (which is either a Param, LValue, or LocalVarDecl) 
    7373     * 
    7474     * IMPORTANT: Need to use Pair of String & Span as key! 
     
    286286                    declSite = declNode; 
    287287                } else if( declNode instanceof Param || 
    288                            declNode instanceof LValueBind ) { 
     288                           declNode instanceof LValue ) { 
    289289                    if( enclosingObjectDecl.isNone() ) { 
    290290                            throw new DesugarerError( var.getSpan(), 
     
    666666            List<LValue> lhs = cast.getLhs(); 
    667667            for(LValue lvalue : lhs) { 
    668                 if ( lvalue instanceof LValueBind ) 
    669                     name += ( "_" + ((LValueBind) lvalue).getName().getText() ); 
    670                 else // lvalue instanceof Unpasting 
    671                     throw new DesugarerError("Unpasting is not yet supported."); 
     668                name += ( "_" + lvalue.getName().getText() ); 
    672669            } 
    673670            return new Pair<String,Span>( name, cast.getSpan() ); 
     
    991988        @Override 
    992989        public void forVarDecl(VarDecl that) { 
    993             recurOnListOfLValueBind(that.getLhs()); 
     990            recurOnListOfLValue(that.getLhs()); 
    994991        } 
    995992 
    996993        @Override 
    997         public void forLValueBind(LValueBind that) { 
     994        public void forLValue(LValue that) { 
    998995            decledNames.add(that.getName()); 
    999996        } 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/MutableVarRefRewriteVisitor.java

    r2714 r3082  
    2626import com.sun.fortress.nodes.Expr; 
    2727import com.sun.fortress.nodes.FieldRef; 
    28 import com.sun.fortress.nodes.LValueBind; 
     28import com.sun.fortress.nodes.LValue; 
    2929import com.sun.fortress.nodes.LocalVarDecl; 
    3030import com.sun.fortress.nodes.Node; 
     
    3939 
    4040public class MutableVarRefRewriteVisitor extends NodeUpdateVisitor { 
    41     // The root of the subtree in AST which we are trying to rewrite  
     41    // The root of the subtree in AST which we are trying to rewrite 
    4242    // This root can only be either ObjectDecl or LocalVarDecl, which can 
    4343    // declare mutable variables captured by ObjectExpr 
     
    4545    // A map mapping from VarRefs to its corresponding boxed type 
    4646    private Map<VarRef, VarRefContainer> mutableVarRefContainerMap; 
    47     // A list of varRefs that are declared directly under entryNode and  
    48     // need to be rewriten into its corresponding boxed type; note that  
    49     // mutableVarRefContainerMap.keySet() is a superset of varRefsToRewrite  
     47    // A list of varRefs that are declared directly under entryNode and 
     48    // need to be rewriten into its corresponding boxed type; note that 
     49    // mutableVarRefContainerMap.keySet() is a superset of varRefsToRewrite 
    5050    private List<VarRef> varRefsToRewrite; 
    5151 
    52     public MutableVarRefRewriteVisitor(Node entryNode,  
     52    public MutableVarRefRewriteVisitor(Node entryNode, 
    5353                Map<VarRef, VarRefContainer> mutableVarRefContainerMap, 
    5454                List<VarRef> varRefsToRewrite) { 
     
    6060    @Override 
    6161    public Node forObjectDecl(ObjectDecl that) { 
    62         if( entryNode instanceof ObjectDecl &&  
    63             (that.equals(entryNode) == false ||  
     62        if( entryNode instanceof ObjectDecl && 
     63            (that.equals(entryNode) == false || 
    6464             entryNode.getSpan().equals(that.getSpan()) == false) ) { 
    6565            throw new DesugarerError("Wrong entry node for the rewriting " + 
    66                 "pass!  Expected: " + entryNode + " (" + entryNode.getSpan() +  
     66                "pass!  Expected: " + entryNode + " (" + entryNode.getSpan() + 
    6767                "); " + "found: " + that + " (" + that.getSpan() + ")."); 
    6868        } 
    69          
     69 
    7070        List<Decl> decls_result = recurOnListOfDecl( that.getDecls() ); 
    7171 
     
    7373            VarRefContainer container = mutableVarRefContainerMap.get(var); 
    7474            if( container == null ) { 
    75                 throw new DesugarerError(var.getSpan(),  
    76                         "VarRefContainer for " + var +  
     75                throw new DesugarerError(var.getSpan(), 
     76                        "VarRefContainer for " + var + 
    7777                        " is not found in map while rewriting " + that); 
    7878            } 
     
    8181            if( origDeclNode instanceof Param ) { 
    8282                decls_result.add( 0, container.containerField() ); 
    83             } else if( origDeclNode instanceof LValueBind ) { 
     83            } else if( origDeclNode instanceof LValue ) { 
    8484                insertAfterOrigDecl(decls_result, container); 
    8585            } else { 
     
    102102            return super.forLocalVarDecl(that); 
    103103        } 
    104          
     104 
    105105        LocalVarDecl newLocalVarDecl = null; 
    106106        List<Expr> body_result = recurOnListOfExpr( that.getBody() ); 
     
    109109            VarRefContainer container = mutableVarRefContainerMap.get(var); 
    110110            if( container == null ) { 
    111                 throw new DesugarerError(var.getSpan(),  
    112                         "VarRefContainer for " + var +  
     111                throw new DesugarerError(var.getSpan(), 
     112                        "VarRefContainer for " + var + 
    113113                        " is not found in map while rewriting " + that); 
    114114            } 
    115115 
    116 // Why does this sanity check fail?   
     116// Why does this sanity check fail? 
    117117// It fails because this LocalVarDecl may have been rewritten if it refers 
    118118// to any var declared in ObjectDecl which is also captured by the object 
     
    121121//            Node origDeclNode = container.origDeclNode(); 
    122122//            if( origDeclNode.equals(that) == false ) { 
    123 //                throw new DesugarerError(that.getSpan(),  
     123//                throw new DesugarerError(that.getSpan(), 
    124124//                    "Unexpected node in rewriteList when rewriting " + that); 
    125125//            } else { 
    126126                if( newLocalVarDecl == null ) { 
    127                     newLocalVarDecl =  
     127                    newLocalVarDecl = 
    128128                        container.containerLocalVarDecl(body_result); 
    129129                } else { 
    130130                    List<Expr> newBody = new ArrayList<Expr>(1); 
    131131                    newBody.add(newLocalVarDecl); 
    132                     newLocalVarDecl =  
     132                    newLocalVarDecl = 
    133133                        container.containerLocalVarDecl(newBody); 
    134134                } 
     
    139139        new_body_result.add(newLocalVarDecl); 
    140140 
    141         return super.forLocalVarDeclOnly( that, that.getExprType(),  
     141        return super.forLocalVarDeclOnly( that, that.getExprType(), 
    142142                            new_body_result, that.getLhs(), that.getRhs() ); 
    143143    } 
    144144 
    145     @Override  
     145    @Override 
    146146    public Node forVarRef(VarRef that) { 
    147147        if( varRefsToRewrite.contains(that) ) { 
     
    152152        } 
    153153    } 
    154      
    155     private void insertAfterOrigDecl(List<Decl> decl_result,  
     154 
     155    private void insertAfterOrigDecl(List<Decl> decl_result, 
    156156                                     VarRefContainer container) { 
    157157        int indexToInsert = 0; 
     
    159159            indexToInsert = indexToInsert + 1; 
    160160            if(decl instanceof VarDecl) { 
    161                 VarDecl cast = (VarDecl) decl;  
    162                 List<LValueBind> lhs = cast.getLhs(); 
     161                VarDecl cast = (VarDecl) decl; 
     162                List<LValue> lhs = cast.getLhs(); 
    163163                if( lhs.contains(container.origDeclNode()) ) { 
    164164                    decl_result.add(indexToInsert, container.containerField()); 
     
    176176 
    177177} 
    178  
    179  
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/ObjectExpressionVisitor.java

    r3078 r3082  
    8585     *        pair.first is the varRef 
    8686     *        pair.second is the decl node where the varRef is declared 
    87      *              (which is either a Param, LValueBind, or LocalVarDecl) 
     87     *              (which is either a Param, LValue, or LocalVarDecl) 
    8888     * 
    8989     * IMPORTANT: Need to use Pair of String & Span as key! 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/desugarer/VarRefContainer.java

    r2714 r3082  
    2727import com.sun.fortress.nodes.Id; 
    2828import com.sun.fortress.nodes.LValue; 
    29 import com.sun.fortress.nodes.LValueBind; 
    3029import com.sun.fortress.nodes.LocalVarDecl; 
    3130import com.sun.fortress.nodes.Modifier; 
     
    5958 
    6059    public VarRefContainer(VarRef origVar, 
    61                            Node origDeclNode,  
     60                           Node origDeclNode, 
    6261                           String uniqueSuffix) { 
    6362        this.origVar = origVar; 
     
    113112 
    114113    public VarDecl containerField() { 
    115         List<LValueBind> lhs = new LinkedList<LValueBind>(); 
     114        List<LValue> lhs = new LinkedList<LValue>(); 
    116115        // set the field to be immutable 
    117         lhs.add( new LValueBind(origDeclNode.getSpan(), containerVarId(), 
    118                                 containerType(), false) ); 
     116        lhs.add( new LValue(origDeclNode.getSpan(), containerVarId(), 
     117                            containerType(), false) ); 
    119118        VarDecl field = new VarDecl( origDeclNode.getSpan(), 
    120119                                     lhs, makeCallToContainerObj() ); 
     
    131130    public FieldRef containerFieldRef(Span varRefSpan) { 
    132131        return ExprFactory.makeFieldRef( varRefSpan, 
    133                                          this.containerVarRef(varRefSpan),  
     132                                         this.containerVarRef(varRefSpan), 
    134133                                         origVar.getVar() ); 
    135134    } 
     
    138137        List<LValue> lhs = new LinkedList<LValue>(); 
    139138        // set the field to be immutable 
    140         lhs.add( new LValueBind(origDeclNode.getSpan(), containerVarId(), 
    141                                 containerType(), false) ); 
     139        lhs.add( new LValue(origDeclNode.getSpan(), containerVarId(), 
     140                            containerType(), false) ); 
    142141        LocalVarDecl ret = ExprFactory.makeLocalVarDecl( origDeclNode.getSpan(), 
    143142                            lhs, makeCallToContainerObj(), bodyExprs ); 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/ExprDisambiguator.java

    r3077 r3082  
    5959import com.sun.fortress.nodes.IntParam; 
    6060import com.sun.fortress.nodes.LValue; 
    61 import com.sun.fortress.nodes.LValueBind; 
    6261import com.sun.fortress.nodes.Label; 
    6362import com.sun.fortress.nodes.LetFn; 
     
    8786import com.sun.fortress.nodes.UnitDecl; 
    8887import com.sun.fortress.nodes.UnitParam; 
    89 import com.sun.fortress.nodes.UnpastingBind; 
    90 import com.sun.fortress.nodes.UnpastingSplit; 
    9188import com.sun.fortress.nodes.VarDecl; 
    9289import com.sun.fortress.nodes.VarRef; 
     
    354351        for (LValue lv : lvalues) { 
    355352            boolean valid = true; 
    356             if (lv instanceof LValueBind) { 
    357                 Id id = ((LValueBind)lv).getName(); 
    358                 valid = (result.add(id) || id.getText().equals("_")); 
    359             } 
    360             else if (lv instanceof UnpastingBind) { 
    361                 Id id = ((UnpastingBind)lv).getName(); 
    362                 valid = (result.add(id) || id.getText().equals("_")); 
    363             } 
    364             else { // lv instanceof UnpastingSplit 
    365                 extractDefinedVarNames(((UnpastingSplit)lv).getElems(), result); 
    366             } 
     353            Id id = lv.getName(); 
     354            valid = (result.add(id) || id.getText().equals("_")); 
    367355            if (!valid) { error("Duplicate local variable name", lv); } 
    368356        } 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/environments/TopLevelEnvGen.java

    r3078 r3082  
    275275                if (v instanceof DeclaredVariable) { 
    276276                    DeclaredVariable dv = (DeclaredVariable) v; 
    277                     LValueBind lvb = dv.ast(); 
     277                    LValue lvb = dv.ast(); 
    278278                    idString = WellKnownNames.tempForUnderscore(lvb.getName()); 
    279279                } else { 
     
    346346                    // The interpreter rewrites a temporary for multiple assignment. 
    347347                    VarDecl vd = (VarDecl) decl; 
    348                     List<LValueBind> lhs = vd.getLhs(); 
     348                    List<LValue> lhs = vd.getLhs(); 
    349349                    if (lhs.size() > 1) { 
    350350                        String idString = WellKnownNames.tempTupleName(vd); 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/index/DeclaredVariable.java

    r1083 r3082  
    1818package com.sun.fortress.compiler.index; 
    1919 
    20 import com.sun.fortress.nodes.LValueBind; 
     20import com.sun.fortress.nodes.LValue; 
    2121 
    2222public class DeclaredVariable extends Variable { 
    23      
    24     private final LValueBind _ast; 
    25      
    26     public DeclaredVariable(LValueBind ast) { _ast = ast; } 
    27      
    28     public LValueBind ast() { return _ast; } 
     23 
     24    private final LValue _ast; 
     25 
     26    public DeclaredVariable(LValue ast) { _ast = ast; } 
     27 
     28    public LValue ast() { return _ast; } 
    2929} 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/InferenceVarInserter.java

    r3077 r3082  
    2626import com.sun.fortress.nodes.Id; 
    2727import com.sun.fortress.nodes.IdOrOpOrAnonymousName; 
    28 import com.sun.fortress.nodes.LValueBind; 
     28import com.sun.fortress.nodes.LValue; 
    2929import com.sun.fortress.nodes.Modifier; 
    3030import com.sun.fortress.nodes.Node; 
     
    4848 
    4949        @Override 
    50         public Node forLValueBindOnly(LValueBind that, Id name_result, 
     50        public Node forLValueOnly(LValue that, Id name_result, 
    5151                        Option<Type> type_result, List<Modifier> mods_result) { 
    5252                if( type_result.isNone() ) { 
    5353                        Option<Type> new_type = Option.<Type>some(NodeFactory.make_InferenceVarType(that.getName().getSpan())); 
    54                         return new LValueBind(that.getSpan(),name_result,new_type,mods_result,that.isMutable()); 
     54                        return new LValue(that.getSpan(),name_result,new_type,mods_result,that.isMutable()); 
    5555                } 
    5656                else { 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/LValueTypeEnv.java

    r2466 r3082  
    2626 
    2727import com.sun.fortress.nodes.IdOrOpOrAnonymousName; 
    28 import com.sun.fortress.nodes.LValueBind; 
     28import com.sun.fortress.nodes.LValue; 
    2929import com.sun.fortress.nodes.Node; 
    3030import com.sun.fortress.nodes.StaticParam; 
     
    3535 
    3636class LValueTypeEnv extends TypeEnv { 
    37     private final LValueBind[] entries; 
     37    private final LValue[] entries; 
    3838    private final TypeEnv parent; 
    39      
    40     LValueTypeEnv(LValueBind[] _entries, TypeEnv _parent) { 
     39 
     40    LValueTypeEnv(LValue[] _entries, TypeEnv _parent) { 
    4141        entries = _entries; 
    4242        parent = _parent; 
    4343    } 
    4444 
    45     LValueTypeEnv(List<LValueBind> _entries, TypeEnv _parent) { 
    46         entries = _entries.toArray(new LValueBind[_entries.size()]); 
     45    LValueTypeEnv(List<LValue> _entries, TypeEnv _parent) { 
     46        entries = _entries.toArray(new LValue[_entries.size()]); 
    4747        parent = _parent; 
    4848    } 
    4949 
    50     private Option<LValueBind> findLVal(IdOrOpOrAnonymousName var) { 
     50    private Option<LValue> findLVal(IdOrOpOrAnonymousName var) { 
    5151        IdOrOpOrAnonymousName no_api_var = removeApi(var); 
    52          
    53         for (LValueBind entry : entries) { 
     52 
     53        for (LValue entry : entries) { 
    5454            if (var.equals(entry.getName()) || no_api_var.equals(entry.getName())) { 
    5555                return some(entry); 
     
    5858        return none(); 
    5959    } 
    60      
     60 
    6161    /** 
    6262     * Return a BindingLookup that binds the given IdOrOpOrAnonymousName to a type 
     
    6464     */ 
    6565    public Option<BindingLookup> binding(IdOrOpOrAnonymousName var) { 
    66         Option<LValueBind> lval = findLVal(var); 
    67          
     66        Option<LValue> lval = findLVal(var); 
     67 
    6868        if( lval.isSome() ) 
    6969                return some(new BindingLookup(lval.unwrap())); 
     
    7575    public List<BindingLookup> contents() { 
    7676        List<BindingLookup> result = new ArrayList<BindingLookup>(); 
    77         for (LValueBind entry : entries) { 
     77        for (LValue entry : entries) { 
    7878            result.add(new BindingLookup(entry)); 
    7979        } 
     
    8484        @Override 
    8585        public Option<Node> declarationSite(IdOrOpOrAnonymousName var) { 
    86                 Option<LValueBind> lval = findLVal(var); 
     86                Option<LValue> lval = findLVal(var); 
    8787 
    8888                if( lval.isSome() ) 
     
    9494        @Override 
    9595        public TypeEnv replaceAllIVars(Map<_InferenceVarType, Type> ivars) { 
    96                 LValueBind[] new_entries = new LValueBind[entries.length]; 
    97                  
     96                LValue[] new_entries = new LValue[entries.length]; 
     97 
    9898                InferenceVarReplacer rep = new InferenceVarReplacer(ivars); 
    99                  
     99 
    100100                for( int i = 0; i<entries.length; i++ ) { 
    101                         new_entries[i] = (LValueBind)entries[i].accept(rep); 
     101                        new_entries[i] = (LValue)entries[i].accept(rep); 
    102102                } 
    103                  
     103 
    104104                return new LValueTypeEnv(new_entries, parent.replaceAllIVars(ivars)); 
    105105        } 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/LocalVarTypeEnv.java

    r2466 r3082  
    4242    } 
    4343 
    44     private Option<LValueBind> findLVal(IdOrOpOrAnonymousName var) { 
     44    private Option<LValue> findLVal(IdOrOpOrAnonymousName var) { 
    4545        IdOrOpOrAnonymousName no_api_var = removeApi(var); 
    4646 
    4747        for (LValue lval : decl.getLhs()) { 
    48                 if (lval instanceof LValueBind) { 
    49                         LValueBind _lval = (LValueBind) lval; 
    50                         if (_lval.getName().equals(var) || _lval.getName().equals(no_api_var)) { 
    51                                 return some(_lval); 
    52                         } 
    53                 } else { 
    54                         return NI.nyi(); 
    55                 } 
     48            if (lval.getName().equals(var) || lval.getName().equals(no_api_var)) { 
     49                return some(lval); 
     50            } 
    5651        } 
    5752        return none(); 
    5853    } 
    59      
     54 
    6055    /** 
    6156     * Return a BindingLookup that binds the given IdOrOpOrAnonymousName to a type 
     
    6358     */ 
    6459    public Option<BindingLookup> binding(IdOrOpOrAnonymousName var) { 
    65         Option<LValueBind> lval = findLVal(var); 
    66          
     60        Option<LValue> lval = findLVal(var); 
     61 
    6762        if(lval.isSome()) 
    6863                return some(new BindingLookup(lval.unwrap())); 
     
    7570        List<BindingLookup> result = new ArrayList<BindingLookup>(); 
    7671        for (LValue lval : decl.getLhs()) { 
    77             if (lval instanceof LValueBind) { 
    78                 result.add(new BindingLookup((LValueBind) lval)); 
    79             } else { 
    80                 return NI.nyi(); 
    81             } 
     72            result.add(new BindingLookup( lval)); 
    8273        } 
    8374        result.addAll(parent.contents()); 
     
    8778        @Override 
    8879        public Option<Node> declarationSite(IdOrOpOrAnonymousName var) { 
    89                 Option<LValueBind> lval = findLVal(var); 
    90                  
     80                Option<LValue> lval = findLVal(var); 
     81 
    9182                if(lval.isSome()) 
    9283                        return Option.<Node>some(decl); 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeChecker.java

    r3078 r3082  
    132132        } 
    133133        static private Type getTypeOfLValue(LValue lval) { 
    134                 // TODO Implement unpasting 
    135                 return 
    136                 lval.accept(new NodeDepthFirstVisitor<Type>(){ 
    137                         @Override 
    138                         public Type forLValueBind(LValueBind that) { 
    139                                 // All types must exist by the typechecker 
    140                                 return that.getType().unwrap(); 
    141                         } 
    142                 }); 
     134            return lval.getType().unwrap(); 
    143135        } 
    144136        private static boolean isExprMI(MathItem item) { 
     
    156148        } 
    157149 
    158         private static Type typeFromLValueBinds(List<LValueBind> bindings) { 
     150        private static Type typeFromLValues(List<LValue> bindings) { 
    159151                List<Type> results = new ArrayList<Type>(); 
    160152 
    161                 for (LValueBind binding: bindings) { 
     153                for (LValue binding: bindings) { 
    162154                        if (binding.getType().isSome()) { 
    163155                                results.add(binding.getType().unwrap()); 
     
    460452        } 
    461453 
    462         private TypeChecker extend(List<LValueBind> bindings) { 
     454        private TypeChecker extend(List<LValue> bindings) { 
    463455                return new TypeChecker(table, 
    464456                                typeEnv.extendWithLValues(bindings), 
     
    631623                                                else if( field instanceof DeclaredVariable ) { 
    632624                                                        DeclaredVariable var = (DeclaredVariable)field; 
    633                                                         LValueBind bind = var.ast(); 
     625                                                        LValue bind = var.ast(); 
    634626                                                        return Option.some(bind.getType().unwrap()); 
    635627                                                } 
     
    14181410                        } 
    14191411 
    1420                         @Override public Pair<TypeCheckerResult, Type> forLValueBind(LValueBind that) { 
     1412                        @Override public Pair<TypeCheckerResult, Type> forLValue(LValue that) { 
    14211413                                if( !that.isMutable() ) { 
    14221414                                        String err = "Left-hand side of assignment must be mutable."; 
     
    19631955 
    19641956                // bind id and check the body 
    1965                 LValueBind lval = NodeFactory.makeLValue(id_to_bind, that.getMatch()); 
     1957                LValue lval = NodeFactory.makeLValue(id_to_bind, that.getMatch()); 
    19661958                TypeChecker extend_tc = this.extend(Collections.singletonList(lval)); 
    19671959                TypeCheckerResult body_result = that.getBody().accept(extend_tc); 
     
    25732565        @Override 
    25742566        public TypeCheckerResult forFor(For that) { 
    2575                 Pair<List<TypeCheckerResult>,List<LValueBind>> pair = recurOnListsOfGeneratorClauseBindings(that.getGens()); 
     2567                Pair<List<TypeCheckerResult>,List<LValue>> pair = recurOnListsOfGeneratorClauseBindings(that.getGens()); 
    25762568                Option<TypeCheckerResult> type_result = recurOnOptionOfType(that.getExprType()); 
    25772569                TypeChecker extend = this.extend(pair.second()); 
     
    26062598        @Override 
    26072599        public TypeCheckerResult forGeneratedExpr(GeneratedExpr that) { 
    2608                 Pair<List<TypeCheckerResult>,List<LValueBind>> pair = recurOnListsOfGeneratorClauseBindings(that.getGens()); 
     2600                Pair<List<TypeCheckerResult>,List<LValue>> pair = recurOnListsOfGeneratorClauseBindings(that.getGens()); 
    26092601                TypeChecker extend = this.extend(pair.second()); 
    26102602                TypeCheckerResult body_result = that.getExpr().accept(extend); 
     
    26302622        } 
    26312623 
    2632         private Pair<TypeCheckerResult, List<LValueBind>> forGeneratorClauseGetBindings(GeneratorClause that, 
     2624        private Pair<TypeCheckerResult, List<LValue>> forGeneratorClauseGetBindings(GeneratorClause that, 
    26332625                        boolean mustBeCondition) { 
    26342626                TypeCheckerResult init_result = that.getInit().accept(this); 
    2635                 final Pair<TypeCheckerResult, List<LValueBind>> p = forGeneratorClauseOnlyGetBindings(that, init_result, mustBeCondition); 
     2627                final Pair<TypeCheckerResult, List<LValue>> p = forGeneratorClauseOnlyGetBindings(that, init_result, mustBeCondition); 
    26362628 
    26372629                if( postInference ) { 
    26382630                        Boolean ok = true; 
    2639                         List<LValueBind> closed_binds = new ArrayList<LValueBind>(); 
    2640                         for(LValueBind b : p.second()){ 
     2631                        List<LValue> closed_binds = new ArrayList<LValue>(); 
     2632                        for(LValue b : p.second()){ 
    26412633                                Pair<Boolean,Node> temp = TypesUtil.closeConstraints(b, subtypeChecker, p.first()); 
    2642                                 closed_binds.add((LValueBind)temp.second()); 
     2634                                closed_binds.add((LValue)temp.second()); 
    26432635                                ok&=temp.first(); 
    26442636                        } 
     
    26552647        } 
    26562648 
    2657         private Pair<TypeCheckerResult, List<LValueBind>> forGeneratorClauseOnlyGetBindings(GeneratorClause that, 
     2649        private Pair<TypeCheckerResult, List<LValue>> forGeneratorClauseOnlyGetBindings(GeneratorClause that, 
    26582650                        TypeCheckerResult init_result, boolean mustBeCondition) { 
    26592651 
     
    26702662 
    26712663                        return Pair.make(TypeCheckerResult.compose(new_node, subtypeChecker, init_result, bool_result), 
    2672                                         Collections.<LValueBind>emptyList()); 
     2664                                        Collections.<LValue>emptyList()); 
    26732665                } 
    26742666 
     
    26762668                int bindings_count = that.getBind().size(); 
    26772669 
    2678                 List<LValueBind> result_bindings; 
     2670                List<LValue> result_bindings; 
    26792671                Type lhstype; 
    26802672                // Now create the bindings 
     
    26832675                        // Just one binding 
    26842676                        lhstype = NodeFactory.make_InferenceVarType(that.getBind().get(0).getSpan()); 
    2685                         LValueBind lval = NodeFactory.makeLValue(that.getBind().get(0), lhstype); 
     2677                        LValue lval = NodeFactory.makeLValue(that.getBind().get(0), lhstype); 
    26862678                        result_bindings = Collections.singletonList(lval); 
    26872679                } 
     
    26962688                        // Now just create the lvalues with the newly created inference variable type 
    26972689                        Iterator<Id> id_iter = that.getBind().iterator(); 
    2698                         result_bindings = new ArrayList<LValueBind>(bindings_count); 
     2690                        result_bindings = new ArrayList<LValue>(bindings_count); 
    26992691                        for( Type inference_var : inference_vars ) { 
    27002692                                result_bindings.add(NodeFactory.makeLValue(id_iter.next(), inference_var)); 
     
    27762768        private Pair<TypeCheckerResult, Option<Type>> forIfClauseWithType(IfClause that) { 
    27772769                // For generalized 'if' we must introduce new bindings. 
    2778                 Pair<TypeCheckerResult, List<LValueBind>> result_and_binds = 
     2770                Pair<TypeCheckerResult, List<LValue>> result_and_binds = 
    27792771                        this.forGeneratorClauseGetBindings(that.getTest(), true); 
    27802772 
    27812773                // Destruct result 
    27822774                TypeCheckerResult test_result = result_and_binds.first(); 
    2783                 List<LValueBind> bindings = result_and_binds.second(); 
     2775                List<LValue> bindings = result_and_binds.second(); 
    27842776 
    27852777                // Check body with new bindings 
     
    42794271                                meet=this.subtypeChecker.meet(clause.getMatch().get(0),original_type); 
    42804272                        } 
    4281                         LValueBind bind = NodeFactory.makeLValue(to_bind.get(0), meet); 
     4273                        LValue bind = NodeFactory.makeLValue(to_bind.get(0), meet); 
    42824274                        extend=this.extend(Collections.singletonList(bind)); 
    42834275                }else{ 
     
    42864278                        } 
    42874279                        else{ 
    4288                                 List<LValueBind> binds=new ArrayList<LValueBind>(to_bind.size()); 
     4280                                List<LValue> binds=new ArrayList<LValue>(to_bind.size()); 
    42894281                                Iterator<Type> mitr=clause.getMatch().iterator(); 
    42904282                                assert(original_type instanceof TupleType); 
     
    43104302        @Override 
    43114303        public TypeCheckerResult forVarDecl(VarDecl that) { 
    4312                 List<LValueBind> lhs = that.getLhs(); 
     4304                List<LValue> lhs = that.getLhs(); 
    43134305                Expr init = that.getInit(); 
    43144306 
     
    43174309                TypeCheckerResult subtype_result; 
    43184310                if (lhs.size() == 1) { // We have a single variable binding, not a tuple binding 
    4319                         LValueBind var = lhs.get(0); 
     4311                        LValue var = lhs.get(0); 
    43204312                        Option<Type> varType = var.getType(); 
    43214313                        if (varType.isSome()) { 
     
    43384330                        } 
    43394331                } else { // lhs.size() >= 2 
    4340                         Type varType = typeFromLValueBinds(lhs); 
     4332                        Type varType = typeFromLValues(lhs); 
    43414333                        if (initResult.type().isNone()) { 
    43424334                                // The right hand side could not be typed, which must have resulted in a 
     
    43904382        @Override 
    43914383        public TypeCheckerResult forWhile(While that) { 
    4392                 Pair<TypeCheckerResult,List<LValueBind>> res = this.forGeneratorClauseGetBindings(that.getTest(), true); 
     4384                Pair<TypeCheckerResult,List<LValue>> res = this.forGeneratorClauseGetBindings(that.getTest(), true); 
    43934385                TypeChecker extended = this.extend(res.second()); 
    43944386                TypeCheckerResult body_result = that.getBody().accept(extended); 
     
    46224614        // Finally, return all of the bindings so that they can be put in scope in some larger expression, like the 
    46234615        // body of a for loop, for example. 
    4624         private Pair<List<TypeCheckerResult>, List<LValueBind>> recurOnListsOfGeneratorClauseBindings(List<GeneratorClause> gens) { 
     4616        private Pair<List<TypeCheckerResult>, List<LValue>> recurOnListsOfGeneratorClauseBindings(List<GeneratorClause> gens) { 
    46254617                if( gens.isEmpty() ) 
    4626                         return Pair.make(Collections.<TypeCheckerResult>emptyList(), Collections.<LValueBind>emptyList()); 
     4618                        return Pair.make(Collections.<TypeCheckerResult>emptyList(), Collections.<LValue>emptyList()); 
    46274619                else if( gens.size() == 1 ) { 
    4628                         Pair<TypeCheckerResult,List<LValueBind>> pair = forGeneratorClauseGetBindings(IterUtil.first(gens), false); 
     4620                        Pair<TypeCheckerResult,List<LValue>> pair = forGeneratorClauseGetBindings(IterUtil.first(gens), false); 
    46294621                        return Pair.make(Collections.singletonList(pair.first()), pair.second()); 
    46304622                } 
    46314623                else { 
    4632                         Pair<TypeCheckerResult,List<LValueBind>> pair = forGeneratorClauseGetBindings(IterUtil.first(gens), false); 
     4624                        Pair<TypeCheckerResult,List<LValue>> pair = forGeneratorClauseGetBindings(IterUtil.first(gens), false); 
    46334625                        TypeChecker new_checker = this.extend(pair.second()); 
    46344626                        // recur 
    4635                         Pair<List<TypeCheckerResult>, List<LValueBind>> recur_result = 
     4627                        Pair<List<TypeCheckerResult>, List<LValue>> recur_result = 
    46364628                                new_checker.recurOnListsOfGeneratorClauseBindings(CollectUtil.makeList(IterUtil.skipFirst(gens))); 
    46374629                        return Pair.make( Useful.cons(pair.first(), recur_result.first()), 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeEnv.java

    r3077 r3082  
    5858import com.sun.fortress.nodes.IntersectionType; 
    5959import com.sun.fortress.nodes.KeywordType; 
    60 import com.sun.fortress.nodes.LValueBind; 
     60import com.sun.fortress.nodes.LValue; 
    6161import com.sun.fortress.nodes.LocalVarDecl; 
    6262import com.sun.fortress.nodes.Modifier; 
     
    119119     * Construct a new TypeEnv from the given bindings. 
    120120     */ 
    121     public static TypeEnv make(LValueBind... entries) { 
     121    public static TypeEnv make(LValue... entries) { 
    122122        return EmptyTypeEnv.ONLY.extend(entries); 
    123123    } 
     
    369369     * compiler to distinguish them from other variants with the same _erased_ signature. 
    370370     */ 
    371     public final TypeEnv extend(LValueBind... entries) { 
     371    public final TypeEnv extend(LValue... entries) { 
    372372        if (entries.length == 0) { return this; } 
    373373        else { return new LValueTypeEnv(entries, this); } 
    374374    } 
    375375 
    376     public final TypeEnv extendWithLValues(List<LValueBind> entries) { 
     376    public final TypeEnv extendWithLValues(List<LValue> entries) { 
    377377        if (entries.size() == 0) { return this; } 
    378378        else { return new LValueTypeEnv(entries, this); } 
     
    437437    /** 
    438438     * A wrapper around the binding found in the TypeEnv.  Since some bindings 
    439      * do not have an Id to be indexed, there is no way to create the LValueBind 
     439     * do not have an Id to be indexed, there is no way to create the LValue 
    440440     * node to represent the binding.  In the case of operators, for example, 
    441441     * only a IdOrOpOrAnonymousName exists, so the BindingLookup exports the same methods 
    442      * that LValueBind does, since an LValueBind cannot be created. 
     442     * that LValue does, since an LValue cannot be created. 
    443443     */ 
    444444    public static class BindingLookup { 
     
    449449        private final boolean mutable; 
    450450 
    451         public BindingLookup(LValueBind binding) { 
     451        public BindingLookup(LValue binding) { 
    452452            var = binding.getName(); 
    453453            type = binding.getType(); 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/Driver.java

    r3078 r3082  
    8181import com.sun.fortress.nodes.ImportStar; 
    8282import com.sun.fortress.nodes.ImportedNames; 
    83 import com.sun.fortress.nodes.LValueBind; 
    8483import com.sun.fortress.nodes.NodeAbstractVisitor_void; 
    8584import com.sun.fortress.nodes.NodeVisitor_void; 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/BuildApiEnvironment.java

    r3053 r3082  
    3434import com.sun.fortress.nodes.Id; 
    3535import com.sun.fortress.nodes.IdOrOpOrAnonymousName; 
    36 import com.sun.fortress.nodes.LValueBind; 
     36import com.sun.fortress.nodes.LValue; 
    3737import com.sun.fortress.nodes_util.NodeUtil; 
    3838 
    3939public class BuildApiEnvironment extends BuildTopLevelEnvironments { 
    40      
     40 
    4141    @Override 
    4242    public Boolean forAbsFnDecl(AbsFnDecl x) { 
     
    7373            FValue fv = exporter.getEnvironment().getValueRaw(fname); 
    7474            FType ft = exporter.getEnvironment().getRootTypeNull(fname); // toplevel 
    75              
     75 
    7676            // This is overloadable if the object is NOT a singleton. 
    7777            if (x.getParams().isSome()) { 
    7878                overloadNames.add(fname); 
    79                 exporter.overloadableExportedFunction.add(fname);              
    80                 api.overloadableExportedFunction.add(fname);              
     79                exporter.overloadableExportedFunction.add(fname); 
     80                api.overloadableExportedFunction.add(fname); 
    8181            } 
    82              
     82 
    8383            if (fv != null) { 
    8484                bindInto.putValueRaw(fname, fv); 
     
    9898            } 
    9999            handlePossibleFM(x.getDecls()); 
    100              
     100 
    101101        } 
    102102        return change; 
     
    127127        // super.forAbsVarDecl(x); 
    128128        Boolean change = Boolean.FALSE; 
    129          
     129 
    130130        if (getPass() == 1) { 
    131             List<LValueBind> lhs = x.getLhs(); 
    132             LValueBind lvb = lhs.get(0); // Have desugared to single vars 
     131            List<LValue> lhs = x.getLhs(); 
     132            LValue lvb = lhs.get(0); // Have desugared to single vars 
    133133            Id name = lvb.getName(); 
    134134            String sname = NodeUtil.stringName(name); 
     
    149149    CUWrapper exporter; 
    150150    CUWrapper api; 
    151      
     151 
    152152    @Override 
    153153    public void setExporterAndApi(CUWrapper exporter, CUWrapper api) { 
     
    155155        this.api = api; 
    156156    } 
    157      
     157 
    158158    public BuildApiEnvironment(Environment within, 
    159159            Map<String, ComponentWrapper> linker) { 
     
    161161        // TODO Auto-generated constructor stub 
    162162    } 
    163      
     163 
    164164    private void handlePossibleFM(List<? extends AbsDeclOrDecl> tdecls) { 
    165165        for (AbsDeclOrDecl adod : tdecls) { 
     
    179179                } else { 
    180180                    // TODO not handling this quite yet. 
    181                      
     181 
    182182                    //exporter.missingExportedVars.put(s); 
    183183                } 
     
    187187    } 
    188188 
    189      
     189 
    190190} 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/BuildEnvironments.java

    r3077 r3082  
    662662 
    663663    private void forVarDecl1(VarDecl x) { 
    664         List<LValueBind> lhs = x.getLhs(); 
     664        List<LValue> lhs = x.getLhs(); 
    665665 
    666666        // List<Modifier> mods; 
     
    668668        // Option<Type> type = x.getType(); 
    669669        Expr init = x.getInit(); 
    670         LValueBind lvb = lhs.get(0); 
     670        LValue lvb = lhs.get(0); 
    671671 
    672672          Option<Type> type = lvb.getType(); 
     
    689689 
    690690//        for (LValue lv : lhs) { 
    691 //            if (lv instanceof LValueBind) { 
    692 //                LValueBind lvb = (LValueBind) lv; 
     691//            if (lv instanceof LValue) { 
     692//                LValue lvb = (LValue) lv; 
    693693//                Option<Type> type = lvb.getType(); 
    694694//                Id name = lvb.getName(); 
     
    731731    private void forVarDecl4(VarDecl x) { 
    732732 
    733         List<LValueBind> lhs = x.getLhs(); 
     733        List<LValue> lhs = x.getLhs(); 
    734734 
    735735        // List<Modifier> mods; 
     
    738738        Expr init = x.getInit(); 
    739739        // int index = 0; 
    740         LValueBind lvb = lhs.get(0); 
     740        LValue lvb = lhs.get(0); 
    741741 
    742742 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/BuildLetEnvironments.java

    r3077 r3082  
    3636import com.sun.fortress.nodes.IdOrOpOrAnonymousName; 
    3737import com.sun.fortress.nodes.LValue; 
    38 import com.sun.fortress.nodes.LValueBind; 
    3938import com.sun.fortress.nodes.LetExpr; 
    4039import com.sun.fortress.nodes.LetFn; 
     
    128127        } else { 
    129128            EvalType eval_type = new EvalType(containing); 
    130             for (LValue lval : lhs) { 
    131                 if (lval instanceof LValueBind) { 
    132                     LValueBind lvb = (LValueBind) lval; 
    133                     if (lvb.isMutable() && lvb.getType().isSome()) { 
    134                         FValue fv = lval.accept(new_eval); 
    135                         FType fvt = lvb.getType().unwrap().accept(eval_type); 
    136                         containing.putVariable(fv.getString(),fvt); 
    137                     } else { 
    138                         containing.putValue(lval.accept(new_eval), new IndirectionCell()); 
    139  
    140                     } 
     129            for (LValue lvb : lhs) { 
     130                if (lvb.isMutable() && lvb.getType().isSome()) { 
     131                    FValue fv = lvb.accept(new_eval); 
     132                    FType fvt = lvb.getType().unwrap().accept(eval_type); 
     133                    containing.putVariable(fv.getString(),fvt); 
    141134                } else { 
    142                     containing.putValue(lval.accept(new_eval), new IndirectionCell()); 
     135                    containing.putValue(lvb.accept(new_eval), new IndirectionCell()); 
    143136                } 
    144137            } 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/BuildTraitEnvironment.java

    r3077 r3082  
    3131import com.sun.fortress.nodes.FnAbsDeclOrDecl; 
    3232import com.sun.fortress.nodes.Id; 
    33 import com.sun.fortress.nodes.LValueBind; 
     33import com.sun.fortress.nodes.LValue; 
    3434import com.sun.fortress.nodes.StaticParam; 
    3535import com.sun.fortress.nodes.VarDecl; 
     
    8484    public Boolean forVarDecl(VarDecl x) { 
    8585        if (fields != null) { 
    86             List<LValueBind> lhs = x.getLhs(); 
    87             for (LValueBind lvb : lhs) { 
     86            List<LValue> lhs = x.getLhs(); 
     87            for (LValue lvb : lhs) { 
    8888                Id name = lvb.getName(); 
    8989                String s = NodeUtil.nameString(name); 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/Evaluator.java

    r3053 r3082  
    107107import com.sun.fortress.nodes.Juxt; 
    108108import com.sun.fortress.nodes.KeywordExpr; 
    109 import com.sun.fortress.nodes.LValueBind; 
     109import com.sun.fortress.nodes.LValue; 
    110110import com.sun.fortress.nodes.Label; 
    111111import com.sun.fortress.nodes.LetExpr; 
     
    138138import com.sun.fortress.nodes.Typecase; 
    139139import com.sun.fortress.nodes.TypecaseClause; 
    140 import com.sun.fortress.nodes.UnpastingBind; 
    141 import com.sun.fortress.nodes.UnpastingSplit; 
    142140import com.sun.fortress.nodes.VarRef; 
    143141import com.sun.fortress.nodes.VoidLiteralExpr; 
     
    886884    } 
    887885 
    888     public FValue forLValueBind(LValueBind x) { 
     886    public FValue forLValue(LValue x) { 
    889887        Id name = x.getName(); 
    890888        return FString.make(NodeUtil.nameString(name)); 
     
    16521650    } 
    16531651 
    1654     public FValue forUnpastingBind(UnpastingBind x) { 
    1655         return NI("forUnpastingBind"); 
    1656     } 
    1657  
    1658     public FValue forUnpastingSplit(UnpastingSplit x) { 
    1659         return NI("forUnpastingSplit"); 
    1660     } 
    1661  
    16621652    public FValue forVarRef(VarRef x) { 
    16631653//        Id id = x.getVar(); 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/LHSEvaluator.java

    r2741 r3082  
    4949import com.sun.fortress.nodes.FieldRef; 
    5050import com.sun.fortress.nodes.Id; 
    51 import com.sun.fortress.nodes.LValueBind; 
     51import com.sun.fortress.nodes.LValue; 
    5252import com.sun.fortress.nodes.SubscriptExpr; 
    5353import com.sun.fortress.nodes.Enclosing; 
     
    5555import com.sun.fortress.nodes.TupleExpr; 
    5656import com.sun.fortress.nodes.Type; 
    57 import com.sun.fortress.nodes.Unpasting; 
    58 import com.sun.fortress.nodes.UnpastingBind; 
    59 import com.sun.fortress.nodes.UnpastingSplit; 
    6057import com.sun.fortress.nodes.VarRef; 
    6158import com.sun.fortress.nodes._RewriteFieldRef; 
     
    129126    public Voidoid forVarRef(VarRef x) { 
    130127        String s = x.getVar().getText(); 
    131          
     128 
    132129        Environment e = evaluator.e.getHomeEnvironment(x.getVar()); 
    133130        e = BaseEnv.toContainingObjectEnv(e, x.getLexicalDepth()); 
    134          
     131 
    135132        FType ft = e.getVarTypeNull(s); 
    136133        if (ft != null) { 
     
    146143    } 
    147144 
    148     /* (non-Javadoc) 
    149      * @see com.sun.fortress.interpreter.nodes.NodeVisitor#forUnpastingBind(com.sun.fortress.interpreter.nodes.UnpastingBind) 
    150      */ 
    151     @Override 
    152     public Voidoid forUnpastingBind(UnpastingBind x) { 
    153         return super.forUnpastingBind(x); 
    154     } 
    155  
    156     /* (non-Javadoc) 
    157      * @see com.sun.fortress.interpreter.nodes.NodeVisitor#forUnpastingSplit(com.sun.fortress.interpreter.nodes.UnpastingSplit) 
    158      */ 
    159     @Override 
    160     public Voidoid forUnpastingSplit(UnpastingSplit x) { 
    161         return super.forUnpastingSplit(x); 
    162     } 
    163  
    164     public Voidoid forLValueBind(LValueBind x) { 
     145    public Voidoid forLValue(LValue x) { 
    165146        Id name = x.getName(); 
    166147        Option<Type> type = x.getType(); 
     
    201182                if (Glue.extendsGenericTrait(outerType, aname)) { 
    202183                    bestGuess = Glue.typeFromGeneric(outerType, aname, WellKnownNames.arrayElementTypeName); 
    203                      
     184 
    204185                    // Find and invoke the generic factory arrayK[\ T, size1, ..., sizeK \] () 
    205186                    String genericName = WellKnownNames.arrayMaker(rank); 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/LHSToLValue.java

    r2649 r3082  
    3030import com.sun.fortress.nodes.Id; 
    3131import com.sun.fortress.nodes.Lhs; 
    32 import com.sun.fortress.nodes.LValueBind; 
     32import com.sun.fortress.nodes.LValue; 
    3333import com.sun.fortress.nodes.SubscriptExpr; 
    3434import com.sun.fortress.nodes.ArgExpr; 
    3535import com.sun.fortress.nodes.TupleExpr; 
    36 import com.sun.fortress.nodes.Unpasting; 
    37 import com.sun.fortress.nodes.UnpastingBind; 
    38 import com.sun.fortress.nodes.UnpastingSplit; 
    3936import com.sun.fortress.nodes.VarRef; 
    4037import com.sun.fortress.nodes._RewriteFieldRef; 
     
    123120    } 
    124121 
    125     /* (non-Javadoc) 
    126      * @see com.sun.fortress.interpreter.nodes.NodeVisitor#forUnpastingBind(com.sun.fortress.interpreter.nodes.UnpastingBind) 
    127      */ 
    128     @Override 
    129     public Lhs forUnpastingBind(UnpastingBind x) { 
    130         Id name = x.getName(); 
    131         List<ExtentRange> dim = x.getDim(); 
    132         return super.forUnpastingBind(x); 
    133     } 
    134  
    135     /* (non-Javadoc) 
    136      * @see com.sun.fortress.interpreter.nodes.NodeVisitor#forUnpastingSplit(com.sun.fortress.interpreter.nodes.UnpastingSplit) 
    137      */ 
    138     @Override 
    139     public Lhs forUnpastingSplit(UnpastingSplit x) { 
    140         int dim = x.getDim(); 
    141         List<Unpasting> elems = x.getElems(); 
    142         return super.forUnpastingSplit(x); 
    143     } 
    144  
    145     public Lhs forLValueBind(LValueBind x) { 
     122    public Lhs forLValue(LValue x) { 
    146123        return x; 
    147124    } 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/evaluator/types/FTypeObject.java

    r2969 r3082  
    3131import com.sun.fortress.nodes.Id; 
    3232import com.sun.fortress.nodes.IdOrOpOrAnonymousName; 
    33 import com.sun.fortress.nodes.LValueBind; 
     33import com.sun.fortress.nodes.LValue; 
    3434import com.sun.fortress.nodes.Param; 
    3535import com.sun.fortress.nodes.VarAbsDeclOrDecl; 
     
    6666        for(AbsDeclOrDecl v : members) { 
    6767            if (v instanceof VarAbsDeclOrDecl) { 
    68                 for (LValueBind lhs : ((VarAbsDeclOrDecl)v).getLhs()) { 
     68                for (LValue lhs : ((VarAbsDeclOrDecl)v).getLhs()) { 
    6969                    fields.add(lhs.getName()); 
    7070                } 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/rewrite/DesugarerVisitor.java

    r3078 r3082  
    8383import com.sun.fortress.nodes.Juxt; 
    8484import com.sun.fortress.nodes.LValue; 
    85 import com.sun.fortress.nodes.LValueBind; 
    8685import com.sun.fortress.nodes.LetFn; 
    8786import com.sun.fortress.nodes.LocalVarDecl; 
     
    113112import com.sun.fortress.nodes.TypeArg; 
    114113import com.sun.fortress.nodes.Typecase; 
    115 import com.sun.fortress.nodes.Unpasting; 
    116 import com.sun.fortress.nodes.UnpastingBind; 
    117 import com.sun.fortress.nodes.UnpastingSplit; 
    118114import com.sun.fortress.nodes.VarDecl; 
    119115import com.sun.fortress.nodes.VarRef; 
     
    752748    } 
    753749    @Override 
    754     public Node forLValueBind(LValueBind lvb) { 
     750    public Node forLValue(LValue lvb) { 
    755751        Id id = lvb.getName(); 
    756752        if ("_".equals(id.getText())) { 
     
    875871    public Node forVarDecl(VarDecl vd) { 
    876872        atTopLevelInsideTraitOrObject = false; 
    877         List<LValueBind> lhs = vd.getLhs(); 
     873        List<LValue> lhs = vd.getLhs(); 
    878874 
    879875        if (lhs.size() > 1) { 
     
    882878            Expr init = vd.getInit(); 
    883879            init = (Expr) visitNode(init); 
    884             lhs = (List<LValueBind>) recurOnListOfLValueBind(lhs); 
     880            lhs = (List<LValue>) recurOnListOfLValue(lhs); 
    885881            ArrayList<VarDecl> newdecls = new ArrayList<VarDecl>(1+lhs.size()); 
    886882            String temp = WellKnownNames.tempTupleName(vd); 
     
    889885            newdecls.add(new_vd); 
    890886            int element_index = 0; 
    891             for (LValueBind lv : lhs) { 
     887            for (LValue lv : lhs) { 
    892888                Id newName = new Id(at, "$" + element_index); 
    893889                newdecls.add(new VarDecl(at, Useful.list(lv), 
     
    13641360 
    13651361        @Override 
    1366         public void forLValueBind(LValueBind that) { 
     1362        public void forLValue(LValue that) { 
    13671363            that.getName().accept(this); 
    13681364        } 
     
    13721368            String s = that.getText(); 
    13731369            rewrites_put(s, new Local()); 
    1374         } 
    1375  
    1376         @Override 
    1377         public void forUnpastingBind(UnpastingBind that) { 
    1378             that.getName().accept(this); 
    1379             for (ExtentRange er : that.getDim()) 
    1380                 er.accept(this); 
    1381         } 
    1382  
    1383         @Override 
    1384         public void forUnpastingSplit(UnpastingSplit that) { 
    1385             for (Unpasting up : that.getElems()) 
    1386                 up.accept(this); 
    13871370        } 
    13881371 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/rewrite/IsAnArrowName.java

    r3077 r3082  
    2020import com.sun.fortress.nodes.ArrowType; 
    2121import com.sun.fortress.nodes.FnDecl; 
    22 import com.sun.fortress.nodes.LValueBind; 
     22import com.sun.fortress.nodes.LValue; 
    2323import com.sun.fortress.nodes.Node; 
    2424import com.sun.fortress.nodes.NodeAbstractVisitor; 
     
    4545 
    4646    /* (non-Javadoc) 
    47      * @see com.sun.fortress.nodes.NodeAbstractVisitor#forLValueBind(com.sun.fortress.nodes.LValueBind) 
     47     * @see com.sun.fortress.nodes.NodeAbstractVisitor#forLValue(com.sun.fortress.nodes.LValue) 
    4848     */ 
    4949    @Override 
    50     public ArrowOrFunctional forLValueBind(LValueBind that) { 
     50    public ArrowOrFunctional forLValue(LValue that) { 
    5151        return optionTypeIsArrow(that.getType()); 
    5252    } 
  • trunk/ProjectFortress/src/com/sun/fortress/nodes_util/ApiMaker.java

    r3077 r3082  
    7171 
    7272                @Override public Boolean forVarDecl(VarDecl that) { 
    73                     List<LValueBind> lhs = that.getLhs(); 
     73                    List<LValue> lhs = that.getLhs(); 
    7474                    boolean result = false; 
    75                     for (LValueBind lv : lhs) { 
     75                    for (LValue lv : lhs) { 
    7676                        if ( containsPrivate(lv.getMods()) ) 
    7777                            result = true; 
     
    154154    public Option<Node> forVarDecl(VarDecl that) { 
    155155        if ( ! isPrivate(that) ) { 
    156             List<LValueBind> lhs = new ArrayList<LValueBind>(); 
    157             for (LValueBind lvb : that.getLhs()) { 
     156            List<LValue> lhs = new ArrayList<LValue>(); 
     157            for (LValue lvb : that.getLhs()) { 
    158158                if ( lvb.getType().isNone() ) 
    159159                    log(lvb, "The type of " + lvb.getName() + " is required."); 
  • trunk/ProjectFortress/src/com/sun/fortress/nodes_util/ErrorMsgMaker.java

    r3081 r3082  
    301301    } 
    302302 
    303     public String forLValueBind(LValueBind node) { 
     303    public String forLValue(LValue node) { 
    304304        String r = ""; 
    305305        if (node.getType().isSome()) { 
  • trunk/ProjectFortress/src/com/sun/fortress/nodes_util/ExprFactory.java

    r3081 r3082  
    607607        Option<Expr> _rhs = Option.some(_r); 
    608608        _body.add(_body_expr); 
    609         _lhs.add(new LValueBind(p.getSpan(), p,false)); 
     609        _lhs.add(new LValue(p.getSpan(), p,false)); 
    610610        return new LocalVarDecl(FortressUtil.spanTwo(p, _r), _body, _lhs, _rhs); 
    611611    } 
     
    616616        Option<Expr> _rhs = Option.some(_r); 
    617617        _body.add(_body_expr); 
    618         _lhs.add(new LValueBind(sp, p,false)); 
     618        _lhs.add(new LValue(sp, p,false)); 
    619619        return new LocalVarDecl(sp, _body, _lhs, _rhs); 
    620620    } 
  • trunk/ProjectFortress/src/com/sun/fortress/nodes_util/NodeFactory.java

    r3081 r3082  
    718718    } 
    719719 
    720     public static LValueBind makeLValue(Id id) { 
    721         return new LValueBind(id.getSpan(), id); 
    722     } 
    723  
    724     public static LValueBind makeLValue(String name, String type) { 
     720    public static LValue makeLValue(Id id) { 
     721        return new LValue(id.getSpan(), id); 
     722    } 
     723 
     724    public static LValue makeLValue(String name, String type) { 
    725725        return makeLValue(name, makeVarType(type)); 
    726726    } 
    727727 
    728     public static LValueBind makeLValue(Id name, Id type) { 
    729         return new LValueBind(new Span(name.getSpan(), type.getSpan()), 
     728    public static LValue makeLValue(Id name, Id type) { 
     729        return new LValue(new Span(name.getSpan(), type.getSpan()), 
    730730                              name, 
    731731                              Option.some((Type)makeVarType(type.getSpan(),type)), 
     
    734734    } 
    735735 
    736     public static LValueBind makeLValue(Id name, Type type) { 
    737         return new LValueBind(new Span(name.getSpan(), type.getSpan()), 
     736    public static LValue makeLValue(Id name, Type type) { 
     737        return new LValue(new Span(name.getSpan(), type.getSpan()), 
    738738                name, 
    739739                Option.some(type), 
     
    742742    } 
    743743 
    744     public static LValueBind makeLValue(Id name, Option<Type> type) { 
    745         return new LValueBind(name.getSpan(), 
     744    public static LValue makeLValue(Id name, Option<Type> type) { 
     745        return new LValue(name.getSpan(), 
    746746                name, 
    747747                type, 
     
    750750    } 
    751751 
    752     public static LValueBind makeLValue(String name, Type type) { 
    753         return new LValueBind(type.getSpan(), makeId(name), Option.some(type), 
     752    public static LValue makeLValue(String name, Type type) { 
     753        return new LValue(type.getSpan(), makeId(name), Option.some(type), 
    754754                Collections.<Modifier>emptyList(), false); 
    755755    } 
    756756 
    757     public static LValueBind makeLValue(String name, Type type, List<Modifier> mods) { 
    758         LValueBind result = makeLValue(name, type); 
     757    public static LValue makeLValue(String name, Type type, List<Modifier> mods) { 
     758        LValue result = makeLValue(name, type); 
    759759        return makeLValue(result, mods); 
    760760    } 
    761761 
    762     public static LValueBind makeLValue(LValueBind lvb, Id name) { 
    763         return new LValueBind(lvb.getSpan(), name, lvb.getType(), lvb.getMods(), 
     762    public static LValue makeLValue(LValue lvb, Id name) { 
     763        return new LValue(lvb.getSpan(), name, lvb.getType(), lvb.getMods(), 
    764764                              lvb.isMutable()); 
    765765    } 
    766766 
    767     public static LValueBind makeLValue(LValueBind lvb, boolean mutable) { 
    768         return new LValueBind(lvb.getSpan(), lvb.getName(), lvb.getType(), 
     767    public static LValue makeLValue(LValue lvb, boolean mutable) { 
     768        return new LValue(lvb.getSpan(), lvb.getName(), lvb.getType(), 
    769769                              lvb.getMods(), mutable); 
    770770    } 
    771771 
    772     public static LValueBind makeLValue(LValueBind lvb, List<Modifier> mods) { 
     772    public static LValue makeLValue(LValue lvb, List<Modifier> mods) { 
    773773        boolean mutable = lvb.isMutable(); 
    774774        for (Modifier m : mods) { 
     
    776776                mutable = true; 
    777777        } 
    778         return new LValueBind(lvb.getSpan(), lvb.getName(), lvb.getType(), 
     778        return new LValue(lvb.getSpan(), lvb.getName(), lvb.getType(), 
    779779                              mods, mutable); 
    780780    } 
    781781 
    782     public static LValueBind makeLValue(LValueBind lvb, List<Modifier> mods, 
     782    public static LValue makeLValue(LValue lvb, List<Modifier> mods, 
    783783            boolean mutable) { 
    784         return new LValueBind(lvb.getSpan(), lvb.getName(), lvb.getType(), 
     784        return new LValue(lvb.getSpan(), lvb.getName(), lvb.getType(), 
    785785                              mods, mutable); 
    786786    } 
    787787 
    788     public static LValueBind makeLValue(LValueBind lvb, Type ty) { 
    789         return new LValueBind(lvb.getSpan(), lvb.getName(), 
     788    public static LValue makeLValue(LValue lvb, Type ty) { 
     789        return new LValue(lvb.getSpan(), lvb.getName(), 
    790790                              Option.some(ty), lvb.getMods(), 
    791791                              lvb.isMutable()); 
    792792    } 
    793793 
    794     public static LValueBind makeLValue(LValueBind lvb, Type ty, 
     794    public static LValue makeLValue(LValue lvb, Type ty, 
    795795            boolean mutable) { 
    796         return new LValueBind(lvb.getSpan(), lvb.getName(), 
     796        return new LValue(lvb.getSpan(), lvb.getName(), 
    797797                              Option.some(ty), lvb.getMods(), mutable); 
    798798    } 
    799799 
    800     public static LValueBind makeLValue(LValueBind lvb, Type ty, 
     800    public static LValue makeLValue(LValue lvb, Type ty, 
    801801            List<Modifier> mods) { 
    802802        boolean mutable = lvb.isMutable(); 
     
    805805                mutable = true; 
    806806        } 
    807         return new LValueBind(lvb.getSpan(), lvb.getName(), 
     807        return new LValue(lvb.getSpan(), lvb.getName(), 
    808808                              Option.some(ty), mods, mutable); 
    809809    } 
    810810 
    811     public static LValueBind makeLValue(NormalParam param) { 
    812         return new LValueBind(param.getSpan(), param.getName(), 
     811    public static LValue makeLValue(NormalParam param) { 
     812        return new LValue(param.getSpan(), param.getName(), 
    813813                param.getType(), param.getMods(), false); 
    814814    } 
     
    10931093    } 
    10941094 
    1095     public static AbsVarDecl makeAbsVarDecl(Span span, List<LValueBind> lvals) { 
     1095    public static AbsVarDecl makeAbsVarDecl(Span span, List<LValue> lvals) { 
    10961096        FortressUtil.validId(lvals); 
    10971097        return new AbsVarDecl(span, lvals); 
    10981098    } 
    10991099 
    1100     public static VarDecl makeVarDecl(Span span, List<LValueBind> lvals, Expr init) { 
     1100    public static VarDecl makeVarDecl(Span span, List<LValue> lvals, Expr init) { 
    11011101        FortressUtil.validId(lvals); 
    11021102        return new VarDecl(span, lvals, init); 
     
    11051105    public static VarDecl makeVarDecl(Span span, Id name, Expr init) { 
    11061106        FortressUtil.validId(name); 
    1107         LValueBind bind = new LValueBind(span, name, Option.<Type>none(), 
     1107        LValue bind = new LValue(span, name, Option.<Type>none(), 
    11081108                Collections.<Modifier>emptyList(), true); 
    1109         return new VarDecl(span, Useful.<LValueBind>list(bind), init); 
     1109        return new VarDecl(span, Useful.<LValue>list(bind), init); 
    11101110    } 
    11111111 
     
    11131113        Id id = new Id(span, name); 
    11141114        FortressUtil.validId(id); 
    1115         LValueBind bind = new LValueBind(span, id, 
     1115        LValue bind = new LValue(span, id, 
    11161116                                         Option.<Type>none(), 
    11171117                                         Collections.<Modifier>emptyList(), true); 
    1118         return new VarDecl(span, Useful.<LValueBind>list(bind), init); 
     1118        return new VarDecl(span, Useful.<LValue>list(bind), init); 
    11191119    } 
    11201120 
  • trunk/ProjectFortress/src/com/sun/fortress/nodes_util/NodeUtil.java

    r3078 r3082  
    422422    /* stringNames *********************************************************/ 
    423423    public static IterableOnce<String> stringNames(LValue lv) { 
    424         return lv.accept(new NodeAbstractVisitor<IterableOnce<String>>() { 
    425             public IterableOnce<String> forLValueBind(LValueBind d) { 
    426                 return new UnitIterable<String>(d.getName().getText()); 
    427             } 
    428             public IterableOnce<String> forUnpastingBind(UnpastingBind d) { 
    429                 return new UnitIterable<String>(d.getName().getText()); 
    430             } 
    431             public IterableOnce<String> forUnpastingSplit(UnpastingSplit d) { 
    432                 return new IterableOnceForLValueList(d.getElems()); 
    433             } 
    434         }); 
     424        return new UnitIterable<String>(lv.getName().getText()); 
    435425    } 
    436426 
  • trunk/ProjectFortress/src/com/sun/fortress/parser/AbsField.rats

    r2855 r3082  
    4949     } 
    5050   / a1:ApiFldMods? a2:BindIdOrBindIdTuple w colon w a3:NoNewlineType w ellipses 
    51      { List<LValueBind> lvs; 
     51     { List<LValue> lvs; 
    5252       if (a1 != null) lvs = FortressUtil.ids2Lvs(a2, a1, a3, false); 
    5353       else            lvs = FortressUtil.ids2Lvs(a2, a3, false); 
     
    6060       if (a2.size() != tys.size()) 
    6161           syntaxError(span, "Mismatched numbers of variables and types."); 
    62        List<LValueBind> lvs; 
     62       List<LValue> lvs; 
    6363       if (a1 != null) lvs = FortressUtil.ids2Lvs(a2, a1, tys, false); 
    6464       else            lvs = FortressUtil.ids2Lvs(a2, tys, false); 
  • trunk/ProjectFortress/src/com/sun/fortress/parser/LocalDecl.rats

    r3077 r3082  
    116116           a2 = FortressUtil.setMutable(a2, createSpan(yyStart,3)); 
    117117       } 
    118        yyValue = FortressUtil.mkLocalVarDecl(createSpan(yyStart,yyCount), 
    119                                              FortressUtil.toLValueList(a2), a3); 
     118       yyValue = FortressUtil.mkLocalVarDecl(createSpan(yyStart,yyCount), a2, a3); 
    120119     } 
    121120   / a1:(var w)? a2:NoNewlineVarWTypes s colonequals w a3:NoNewlineExpr 
    122121     { a2 = FortressUtil.setMutable(a2, createSpan(yyStart,3)); 
    123        yyValue = FortressUtil.mkLocalVarDecl(createSpan(yyStart,yyCount), 
    124                                              FortressUtil.toLValueList(a2), a3); 
     122       yyValue = FortressUtil.mkLocalVarDecl(createSpan(yyStart,yyCount), a2, a3); 
    125123     } 
    126124   / a1:(var w)? a2:NoNewlineVarWTypes 
    127125     { if (a1 != null) a2 = FortressUtil.setMutable(a2, createSpan(yyStart,3)); 
    128        yyValue = FortressUtil.mkLocalVarDecl(createSpan(yyStart,yyCount), 
    129                                              FortressUtil.toLValueList(a2)); 
     126       yyValue = FortressUtil.mkLocalVarDecl(createSpan(yyStart,yyCount), a2); 
    130127     } 
    131128   / a1:VarWoTypes s equals w a2:NoNewlineExpr 
     
    177174     }; 
    178175 
    179 LValueBind VarMayType := a1:BindId a2:(s void:colon s NoNewlineType)? 
     176LValue VarMayType := a1:BindId a2:(s void:colon s NoNewlineType)? 
    180177     { if (a2 == null) 
    181            yyValue = FortressUtil.mkLValueBind(createSpan(yyStart,yyCount),a1); 
     178           yyValue = FortressUtil.mkLValue(createSpan(yyStart,yyCount),a1); 
    182179       else 
    183            yyValue = FortressUtil.mkLValueBind(createSpan(yyStart,yyCount),a1,a2); 
     180           yyValue = FortressUtil.mkLValue(createSpan(yyStart,yyCount),a1,a2); 
    184181     }; 
    185182 
     
    196193LValue VarWoType = 
    197194     a1:BindId 
    198      { yyValue = FortressUtil.mkLValueBind(createSpan(yyStart,yyCount), a1); } 
    199    / Unpasting ; 
     195     { yyValue = FortressUtil.mkLValue(createSpan(yyStart,yyCount), a1); } 
     196   / Unpasting 
     197     { Span span = createSpan(yyStart,yyCount); 
     198       yyValue = FortressUtil.mkLValue(span, new Id(span, "_")); 
     199     }; 
    200200 
    201201/* Unpasting ::= [ w UnpastingElems w ] */ 
    202 private Unpasting Unpasting = 
     202private void Unpasting = 
    203203     void:opensquare w UnpastingElems w void:closesquare ; 
    204204 
     
    207207   | UnpastingElem 
    208208 */ 
    209 private Unpasting UnpastingElems = 
    210      a1:UnpastingElem a2:RectSeparator a3:UnpastingElems 
    211      { yyValue = FortressUtil.unpastingCons(createSpan(yyStart,yyCount), 
    212                                             a1, a2, a3); 
    213      } 
     209private void UnpastingElems = 
     210     UnpastingElem RectSeparator UnpastingElems 
    214211   / UnpastingElem ; 
    215212 
     
    218215   | Unpasting 
    219216 */ 
    220 private Unpasting UnpastingElem = 
    221      a1:BindId a2:(void:opensquare w UnpastingDim w void:closesquare)? 
    222      { if (a2 == null) 
    223            yyValue = new UnpastingBind(createSpan(yyStart,yyCount), a1, 
    224                                        Collections.<ExtentRange>emptyList()); 
    225        else 
    226            yyValue = new UnpastingBind(createSpan(yyStart,yyCount), a1, a2); 
    227      } 
     217private void UnpastingElem = 
     218     BindId (void:opensquare w UnpastingDim w void:closesquare)? 
    228219   / Unpasting ; 
    229220 
     
    231222// due to the Rats! module system 
    232223/* UnpastingDim ::= NoNewlineExtentRange (w BY w NoNewlineExtentRange)+  */ 
    233 private List<ExtentRange> UnpastingDim = 
    234      a1:NoNewlineExtentRange a2s:(w cross w NoNewlineExtentRange)+ 
    235      { yyValue = FortressUtil.mkList(a1, a2s.list()); }; 
     224private void UnpastingDim = 
     225     NoNewlineExtentRange (w cross w NoNewlineExtentRange)+ ; 
    236226 
    237227/* CaseClause ::= NoNewlineExpr w => w BlockElems */ 
  • trunk/ProjectFortress/src/com/sun/fortress/parser/NoNewlineExpr.rats

    r2808 r3082  
    196196   | ( w NoNewlineVarWType (w , w NoNewlineVarWType)+ w ) 
    197197 */ 
    198 List<LValueBind> NoNewlineVarWTypes = 
     198List<LValue> NoNewlineVarWTypes = 
    199199     a1:NoNewlineVarWType 
    200200     { yyValue = FortressUtil.mkList(a1); } 
     
    204204 
    205205/* NoNewlineVarWType ::= BindId s NoNewlineIsType */ 
    206 LValueBind NoNewlineVarWType = a1:BindId s a2:NoNewlineIsType 
    207      { yyValue = FortressUtil.mkLValueBind(createSpan(yyStart,yyCount),a1,a2); }; 
     206LValue NoNewlineVarWType = a1:BindId s a2:NoNewlineIsType 
     207     { yyValue = FortressUtil.mkLValue(createSpan(yyStart,yyCount),a1,a2); }; 
    208208 
    209209/* NoNewlineIsType ::= : w NoNewlineType */ 
  • trunk/ProjectFortress/src/com/sun/fortress/parser/Variable.rats

    r2829 r3082  
    5959     } 
    6060   / a1:VarImmutableMods? a2:BindIdOrBindIdTuple w equals w a3:NoNewlineExpr 
    61      { List<LValueBind> lvs; 
     61     { List<LValue> lvs; 
    6262       if (a1 != null) lvs = FortressUtil.ids2Lvs(a2, a1); 
    6363       else lvs = FortressUtil.ids2Lvs(a2); 
     
    6666     } 
    6767   / a1:VarMods? a2:BindIdOrBindIdTuple w colon w a3:NoNewlineType w ellipses w a4:InitVal 
    68      { List<LValueBind> lvs; 
     68     { List<LValue> lvs; 
    6969       if (a1 != null) { 
    7070           if (a4.getB()) lvs = FortressUtil.ids2Lvs(a2, a1, a3, true); 
     
    8282       if (a2.size() != tys.size()) 
    8383           syntaxError(span, "Mismatched numbers of variables and types."); 
    84        List<LValueBind> lvs; 
     84       List<LValue> lvs; 
    8585       if (a1 != null) { 
    8686           if (a4.getB()) lvs = FortressUtil.ids2Lvs(a2, a1, tys, true); 
     
    130130   | ( w VarMayType (w , w VarMayType)+ w ) 
    131131 */ 
    132 List<LValueBind> VarMayTypes = 
     132List<LValue> VarMayTypes = 
    133133     a1:VarMayType 
    134134     { yyValue = FortressUtil.mkList(a1); } 
     
    137137 
    138138/* VarMayType ::= BindId (w IsType)? */ 
    139 LValueBind VarMayType = a1:BindId a2:(w IsType) 
     139LValue VarMayType = a1:BindId a2:(w IsType) 
    140140     { if (a2 == null) 
    141            yyValue = FortressUtil.mkLValueBind(createSpan(yyStart,yyCount),a1); 
     141           yyValue = FortressUtil.mkLValue(createSpan(yyStart,yyCount),a1); 
    142142       else 
    143            yyValue = FortressUtil.mkLValueBind(createSpan(yyStart,yyCount),a1,a2); 
     143           yyValue = FortressUtil.mkLValue(createSpan(yyStart,yyCount),a1,a2); 
    144144     }; 
    145145 
     
    163163     } 
    164164   / a1:AbsVarMods? a2:BindIdOrBindIdTuple w colon w a3:NoNewlineType w ellipses 
    165      { List<LValueBind> lvs; 
     165     { List<LValue> lvs; 
    166166       if (a1 != null) lvs = FortressUtil.ids2Lvs(a2, a1, a3, false); 
    167167       else            lvs = FortressUtil.ids2Lvs(a2, a3, false); 
     
    174174       if (a2.size() != tys.size()) 
    175175           syntaxError(span, "Mismatched numbers of variables and types."); 
    176        List<LValueBind> lvs; 
     176       List<LValue> lvs; 
    177177       if (a1 != null) lvs = FortressUtil.ids2Lvs(a2, a1, tys, false); 
    178178       else            lvs = FortressUtil.ids2Lvs(a2, tys, false); 
  • trunk/ProjectFortress/src/com/sun/fortress/parser_util/FortressUtil.java

    r3077 r3082  
    132132        l.add(last); 
    133133        return l; 
    134     } 
    135  
    136     public static List<LValue> toLValueList(List<LValueBind> lvbs) { 
    137         List<LValue> result = new ArrayList<LValue>(); 
    138         for (LValueBind lvb : lvbs) { 
    139             result.add((LValue)lvb); 
    140         } 
    141         return result; 
    142134    } 
    143135 
     
    347339    public static void validId(List<? extends LValue> lvs) { 
    348340        for (LValue lv : lvs) { 
    349             if (lv instanceof LValueBind) { 
    350                 validId(((LValueBind)lv).getName()); 
    351             } else if (lv instanceof UnpastingBind) { 
    352                 validId(((UnpastingBind)lv).getName()); 
    353             } else // if (lv instanceof UnpastingSplit) 
    354                 validId(((UnpastingSplit)lv).getElems()); 
     341            validId(lv.getName()); 
    355342        } 
    356343    } 
     
    408395    } 
    409396 
    410     public static void allHaveTypes(List<LValueBind> vars) { 
    411         for (LValueBind l : vars) { 
     397    public static void allHaveTypes(List<LValue> vars) { 
     398        for (LValue l : vars) { 
    412399            if (l.getType().isNone()) 
    413400                syntaxError(l.getSpan(), 
     
    416403    } 
    417404 
    418     public static List<LValueBind> setMutable(List<LValueBind> vars) { 
    419         List<LValueBind> result = new ArrayList<LValueBind>(); 
    420         for (LValueBind l : vars) { 
     405    public static List<LValue> setMutable(List<LValue> vars) { 
     406        List<LValue> result = new ArrayList<LValue>(); 
     407        for (LValue l : vars) { 
    421408            result.add(NodeFactory.makeLValue(l, true)); 
    422409        } 
     
    424411    } 
    425412 
    426     public static List<LValueBind> setMutable(List<LValueBind> vars, Span span) { 
    427         List<LValueBind> result = new ArrayList<LValueBind>(); 
    428         for (LValueBind l : vars) { 
     413    public static List<LValue> setMutable(List<LValue> vars, Span span) { 
     414        List<LValue> result = new ArrayList<LValue>(); 
     415        for (LValue l : vars) { 
    429416            List<Modifier> mods = new ArrayList<Modifier>(); 
    430417            mods.add(new ModifierVar(span)); 
     
    434421    } 
    435422 
    436     public static List<LValueBind> setMods(List<LValueBind> vars, 
     423    public static List<LValue> setMods(List<LValue> vars, 
    437424                                           List<Modifier> mods) { 
    438         List<LValueBind> result = new ArrayList<LValueBind>(); 
    439         for (LValueBind l : vars) { 
     425        List<LValue> result = new ArrayList<LValue>(); 
     426        for (LValue l : vars) { 
    440427            result.add(NodeFactory.makeLValue(l, mods)); 
    441428        } 
     
    443430    } 
    444431 
    445     public static List<LValueBind> setModsAndMutable(List<LValueBind> vars, 
     432    public static List<LValue> setModsAndMutable(List<LValue> vars, 
    446433                                                     List<Modifier> mods) { 
    447         List<LValueBind> result = new ArrayList<LValueBind>(); 
    448         for (LValueBind l : vars) { 
     434        List<LValue> result = new ArrayList<LValue>(); 
     435        for (LValue l : vars) { 
    449436            result.add(NodeFactory.makeLValue(l, mods, true)); 
    450437        } 
     
    455442        List<LValue> result = new ArrayList<LValue>(); 
    456443        for (LValue l : vars) { 
    457             if (l instanceof LValueBind) { 
    458                 List<Modifier> mods = new ArrayList<Modifier>(); 
    459                 mods.add(new ModifierVar(span)); 
    460                 result.add(NodeFactory.makeLValue((LValueBind)l, mods)); 
    461             } else syntaxError(l.getSpan(), "Unpasting cannot be mutable."); 
     444            List<Modifier> mods = new ArrayList<Modifier>(); 
     445            mods.add(new ModifierVar(span)); 
     446            result.add(NodeFactory.makeLValue(l, mods)); 
    462447        } 
    463448        return result; 
     
    467452        List<LValue> result = new ArrayList<LValue>(); 
    468453        for (LValue l : vars) { 
    469             if (l instanceof LValueBind) 
    470                 result.add(NodeFactory.makeLValue((LValueBind)l, ty)); 
    471             else syntaxError(l.getSpan(), "Unpasting cannot be set types."); 
     454            result.add(NodeFactory.makeLValue(l, ty)); 
    472455        } 
    473456        return result; 
     
    478461        int ind = 0; 
    479462        for (LValue l : vars) { 
    480             if (l instanceof LValueBind) { 
    481                 result.add(NodeFactory.makeLValue((LValueBind)l, tys.get(ind))); 
    482                 ind += 1; 
    483             } else syntaxError(l.getSpan(), "Unpasting cannot be set types."); 
     463            result.add(NodeFactory.makeLValue(l, tys.get(ind))); 
     464            ind += 1; 
    484465        } 
    485466        return result; 
     
    489470        List<LValue> result = new ArrayList<LValue>(); 
    490471        for (LValue l : vars) { 
    491             if (l instanceof LValueBind) { 
    492                 result.add(NodeFactory.makeLValue((LValueBind)l, ty, true)); 
    493             } else syntaxError(l.getSpan(), "Unpasting cannot be mutable."); 
     472            result.add(NodeFactory.makeLValue(l, ty, true)); 
    494473        } 
    495474        return result; 
     
    500479        List<LValue> result = new ArrayList<LValue>(); 
    501480        for (LValue l : vars) { 
    502            if (l instanceof LValueBind) { 
    503                List<Modifier> mods = new ArrayList<Modifier>(); 
    504                mods.add(new ModifierVar(span)); 
    505                result.add(NodeFactory.makeLValue((LValueBind)l, ty, mods)); 
    506            } else syntaxError(l.getSpan(), "Unpasting cannot be mutable."); 
     481            List<Modifier> mods = new ArrayList<Modifier>(); 
     482            mods.add(new ModifierVar(span)); 
     483            result.add(NodeFactory.makeLValue(l, ty, mods)); 
    507484        } 
    508485        return result; 
     
    514491        int ind = 0; 
    515492        for (LValue l : vars) { 
    516             if (l instanceof LValueBind) { 
    517                 result.add(NodeFactory.makeLValue((LValueBind)l, tys.get(ind), 
    518                                                   true)); 
    519                 ind += 1; 
    520             } else syntaxError(l.getSpan(), "Unpasting cannot be mutable."); 
     493            result.add(NodeFactory.makeLValue(l, tys.get(ind), true)); 
     494            ind += 1; 
    521495        } 
    522496        return result; 
     
    528502        int ind = 0; 
    529503        for (LValue l : vars) { 
    530             if (l instanceof LValueBind) { 
    531                List<Modifier> mods = new ArrayList<Modifier>(); 
    532                mods.add(new ModifierVar(span)); 
    533                result.add(NodeFactory.makeLValue((LValueBind)l, tys.get(ind), 
    534                                                  mods)); 
    535                ind += 1; 
    536             } else syntaxError(l.getSpan(), "Unpasting cannot be mutable."); 
    537         } 
    538         return result; 
    539     } 
    540  
    541     public static List<LValueBind> ids2Lvs(List<Id> ids, List<Modifier> mods, 
     504            List<Modifier> mods = new ArrayList<Modifier>(); 
     505            mods.add(new ModifierVar(span)); 
     506            result.add(NodeFactory.makeLValue(l, tys.get(ind), mods)); 
     507            ind += 1; 
     508        } 
     509        return result; 
     510    } 
     511 
     512    public static List<LValue> ids2Lvs(List<Id> ids, List<Modifier> mods, 
    542513                                           Option<Type> ty, boolean mutable) { 
    543         List<LValueBind> lvs = new ArrayList<LValueBind>(); 
     514        List<LValue> lvs = new ArrayList<LValue>(); 
    544515        for (Id id : ids) { 
    545             lvs.add(new LValueBind(id.getSpan(), id, ty, mods, mutable)); 
     516            lvs.add(new LValue(id.getSpan(), id, ty, mods, mutable)); 
    546517        } 
    547518        return lvs; 
    548519    } 
    549520 
    550     public static List<LValueBind> ids2Lvs(List<Id> ids, List<Modifier> mods, 
     521    public static List<LValue> ids2Lvs(List<Id> ids, List<Modifier> mods, 
    551522                                           Type ty, boolean mutable) { 
    552523        return ids2Lvs(ids, mods, Option.some(ty), mutable); 
    553524    } 
    554525 
    555     public static List<LValueBind> ids2Lvs(List<Id> ids, Type ty, 
     526    public static List<LValue> ids2Lvs(List<Id> ids, Type ty, 
    556527                                           boolean mutable) { 
    557528        return ids2Lvs(ids, emptyModifiers(), Option.some(ty), mutable); 
    558529    } 
    559530 
    560     public static List<LValueBind> ids2Lvs(List<Id> ids, List<Modifier> mods) { 
     531    public static List<LValue> ids2Lvs(List<Id> ids, List<Modifier> mods) { 
    561532        return ids2Lvs(ids, mods, Option.<Type>none(), false); 
    562533    } 
    563534 
    564     public static List<LValueBind> ids2Lvs(List<Id> ids) { 
     535    public static List<LValue> ids2Lvs(List<Id> ids) { 
    565536        return ids2Lvs(ids, emptyModifiers(), Option.<Type>none(), false); 
    566537    } 
    567538 
    568     public static List<LValueBind> ids2Lvs(List<Id> ids, List<Modifier> mods, 
     539    public static List<LValue> ids2Lvs(List<Id> ids, List<Modifier> mods, 
    569540                                           List<Type> tys, boolean mutable) { 
    570         List<LValueBind> lvs = new ArrayList<LValueBind>(); 
     541        List<LValue> lvs = new ArrayList<LValue>(); 
    571542        int ind = 0; 
    572543        for (Id id : ids) { 
    573             lvs.add(new LValueBind(id.getSpan(), id, Option.some(tys.get(ind)), 
     544            lvs.add(new LValue(id.getSpan(), id, Option.some(tys.get(ind)), 
    574545                                   mods, mutable)); 
    575546            ind += 1; 
     
    578549    } 
    579550 
    580     public static List<LValueBind> ids2Lvs(List<Id> ids, List<Type> tys, 
     551    public static List<LValue> ids2Lvs(List<Id> ids, List<Type> tys, 
    581552                                           boolean mutable) { 
    582553        return ids2Lvs(ids, emptyModifiers(), tys, mutable); 
     
    655626    } 
    656627 
    657     public static LValueBind mkLValueBind(Span span, Id id, Type ty) { 
    658         return new LValueBind(span, id, Option.some(ty), emptyModifiers(),false); 
    659     } 
    660     public static LValueBind mkLValueBind(Span span, Id id) { 
    661         return new LValueBind(span, id, Option.<Type>none(), 
     628    public static LValue mkLValue(Span span, Id id, Type ty) { 
     629        return new LValue(span, id, Option.some(ty), emptyModifiers(),false); 
     630    } 
     631    public static LValue mkLValue(Span span, Id id) { 
     632        return new LValue(span, id, Option.<Type>none(), 
    662633                              emptyModifiers(), false); 
    663634    } 
    664     public static LValueBind mkLValueBind(Id id, Type ty, 
     635    public static LValue mkLValue(Id id, Type ty, 
    665636                                          List<Modifier> mods) { 
    666         return new LValueBind(id.getSpan(), id, Option.some(ty), mods, 
     637        return new LValue(id.getSpan(), id, Option.some(ty), mods, 
    667638                              getMutable(mods)); 
    668639    } 
    669     public static LValueBind mkLValueBind(Id id, Type ty) { 
    670         return mkLValueBind(id, ty, emptyModifiers()); 
     640    public static LValue mkLValue(Id id, Type ty) { 
     641        return mkLValue(id, ty, emptyModifiers()); 
    671642    } 
    672643 
     
    786757//                  unpasting_split span dim (one :: elems) 
    787758//            | _ -> Errors.internal_error span "Empty unpasting.") 
     759/* 
    788760    public static Unpasting unpastingCons(Span span, Unpasting one, int sep, 
    789761                                          Unpasting two) { 
     
    816788        } 
    817789    } 
     790*/ 
    818791 
    819792// let join (one : span) (two : span) : span = 
  • trunk/ProjectFortress/src/com/sun/fortress/parser_util/SyntaxChecker.java

    r3077 r3082  
    149149 
    150150    public void forAbsVarDeclOnly(AbsVarDecl that) { 
    151         for (LValueBind lvb : that.getLhs()) { 
     151        for (LValue lvb : that.getLhs()) { 
    152152            if ( lvb.getType().isNone() ) 
    153153                log(lvb, "The type of " + lvb.getName() + " is required."); 
  • trunk/ProjectFortress/src/com/sun/fortress/syntax_abstractions/phases/Transform.java

    r3077 r3082  
    126126 
    127127    /* Support renaming for these nodes 
    128      * LValueBind    ( only for LocalVarDecl ) - done 
    129      * UnpastingBind ( only for LocalVarDecl ) - done 
     128     * LValue        ( only for LocalVarDecl ) - done 
    130129     * FnDecl        ( only for local function decls ) - done 
    131130     * NormalParam   ( only for FnExpr and local function decls ) - done 
     
    372371                public LValue apply(LValue value){ 
    373372                    return (LValue) value.accept( new TemplateUpdateVisitor(){ 
    374                         public Node forLValueBindOnly(LValueBind that, Id name_result, Option<Type> type_result, List<Modifier> mods_result) { 
     373                        public Node forLValueOnly(LValue that, Id name_result, Option<Type> type_result, List<Modifier> mods_result) { 
    375374                            Id old = (Id) name_result.accept(transformer); 
    376375                            Id generatedId = generateId(old); 
    377376                            Debug.debug( Debug.Type.SYNTAX, 2, "Generate new binding for " + old + " = " + generatedId ); 
    378377                            extendSyntaxEnvironment(old, generatedId); 
    379                             return new LValueBind(that.getSpan(), generatedId, type_result, mods_result); 
    380                         } 
    381                         public Node forUnpastingBindOnly(UnpastingBind that, Id name_result, List<ExtentRange> dim_result) { 
    382                             Id old = (Id) name_result.accept(transformer); 
    383                             Id generatedId = generateId(old); 
    384                             Debug.debug( Debug.Type.SYNTAX, 2, "Generate new binding for " + old + " = " + generatedId ); 
    385                             extendSyntaxEnvironment(old, generatedId); 
    386                             return new UnpastingBind(that.getSpan(), generatedId, dim_result); 
     378                            return new LValue(that.getSpan(), generatedId, type_result, mods_result); 
    387379                        } 
    388380                    }); 
  • trunk/ProjectFortress/src/com/sun/fortress/tools/FortressAstToConcrete.java

    r3081 r3082  
    603603        return Useful.applyToAll( lhs, new Fn<LValue,Boolean>(){ 
    604604            public Boolean apply( LValue value ){ 
    605                 return value.accept( new NodeDepthFirstVisitor<Boolean>(){ 
    606                     @Override public Boolean forLValueBind(LValueBind that) { 
    607                         return that.isMutable(); 
    608                     } 
    609  
    610                     @Override public Boolean forUnpastingBind(UnpastingBind that) { 
    611                         return false; 
    612                     } 
    613  
    614                     @Override public Boolean forUnpastingSplit(UnpastingSplit that) { 
    615                         return false; 
    616                     } 
    617                 }); 
     605                return value.isMutable(); 
    618606            } 
    619607        }); 
     
    627615 
    628616        List<LValue> lhs = new ArrayList<LValue>(); 
    629         for ( LValueBind lv : that.getLhs() ) { 
    630             lhs.add( (LValue)lv ); 
     617        for ( LValue lv : that.getLhs() ) { 
     618            lhs.add( lv ); 
    631619        }