Changeset 2312

Show
Ignore:
Timestamp:
07/19/08 03:35:34 (5 months ago)
Author:
sukyoungryu
Message:

[error message] Added more user-friendly error messages for AST nodes representing references to named entities: _RewriteObjectRef, FieldRef?, _RewriteFieldRef, FnRef?, _RewriteFnRef, and OpRef?.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ProjectFortress/astgen/Fortress.ast

    r2278 r2312  
    708708 
    709709            /** 
    710              * Template gap for expressions 
    711              */ 
    712 //            TemplateGapExpr(Id id, List<Id> templateParams) implements TemplateGap; 
    713             /** 
    714710             * expression annotated with a type 
    715711             */ 
     
    745741             */ 
    746742            abstract DelimitedExpr(); 
    747                 /** 
    748                  * Template gap for expressions 
    749                  */ 
    750 //                TemplateGapDelimitedExpr(Id id, List<Id> templateParams) implements TemplateGap; 
    751743                /** 
    752744                 * sequence of block elements implicitly enclosed by do/end 
     
    978970                   Expr body) 
    979971                  implements Applicable; 
    980                 /** 
    981                  * Template gap for FnExpr 
    982                  */ 
    983 //                TemplateGapFnExpr(Id id, List<Id> templateParams) implements TemplateGap; 
    984972            /** 
    985973             * expression used in block expressions 
     
    10271015            abstract SimpleExpr(); 
    10281016                /** 
    1029                  * Template gap for simple expressions 
    1030                  */ 
    1031 //                TemplateGapSimpleExpr(Id id, List<Id> templateParams) implements TemplateGap; 
    1032                 /** 
    10331017                 * subscripting expression 
    10341018                 * SubscriptExpr ::= Primary LeftEncloser ExprList? RightEncloser 
     
    10451029                abstract Primary(); 
    10461030                    /** 
    1047                      * Template gap for primary expressions 
    1048                      */ 
    1049 //                    TemplateGapPrimary(Id id, List<Id> templateParams) implements TemplateGap; 
    1050                     /** 
    10511031                     * literal 
    10521032                     * Primary ::= LiteralExpr 
     
    10541034                    abstract LiteralExpr(String text); 
    10551035                        /** 
    1056                          * Template gap for literal expressiont 
    1057                          */ 
    1058 //                        TemplateGapLiteralExpr(Id id, List<Id> templateParams) implements TemplateGap; 
    1059                         /** 
    10601036                         * number literal 
    10611037                         */ 
    10621038                        abstract NumberLiteralExpr(); 
    1063                             /** 
    1064                              * Template gap for number literals 
    1065                              */ 
    1066 //                            TemplateGapNumberLiteralExpr(Id id, List<Id> templateParams) implements TemplateGap; 
    10671039                            /** 
    10681040                             * float literal 
     
    10731045                                             BigInteger numerator, int denomBase, 
    10741046                                             int denomPower); 
    1075                                 /** 
    1076                                  * Template gap for float literals 
    1077                                  */ 
    1078 //                                TemplateGapFloatLiteralExpr(Id id, List<Id> templateParams) implements TemplateGap; 
    10791047                            /** 
    10801048                             * int literal 
     
    10831051                            IntLiteralExpr(String text = in_val.toString(), 
    10841052                                           BigInteger val); 
    1085                                 /** 
    1086                                  * Template gap for int literals 
    1087                                  */ 
    1088 //                                TemplateGapIntLiteralExpr(Id id, List<Id> templateParams) implements TemplateGap; 
    10891053                        /** 
    10901054                         * char literal 
     
    10921056                         */ 
    10931057                        CharLiteralExpr(int val = in_text.charAt(0)); 
    1094                             /** 
    1095                              * Template gap for char literals 
    1096                              */ 
    1097 //                            TemplateGapCharLiteralExpr(Id id, List<Id> templateParams) implements TemplateGap; 
    10981058                        /** 
    10991059                         * string literal 
     
    11011061                         */ 
    11021062                        StringLiteralExpr(); 
    1103                             /** 
    1104                              * Template gap for string literals 
    1105                              */ 
    1106 //                            TemplateGapStringLiteralExpr(Id id, List<Id> templateParams) implements TemplateGap; 
    11071063                        /** 
    11081064                         * void literal 
     
    11101066                         */ 
    11111067                        VoidLiteralExpr(String text = ""); 
    1112                             /** 
    1113                              * Template gap for void literals 
    1114                              */ 
    1115 //                            TemplateGapVoidLiteralExpr(Id id, List<Id> templateParams) implements TemplateGap; 
    11161068                    /** 
    11171069                     * variable reference 
     
    11761128                        _RewriteFnRef(Expr fn, 
    11771129                                      List<StaticArg> staticArgs 
    1178                                   = Collections.<StaticArg>emptyList()); 
     1130                                          = Collections.<StaticArg>emptyList()); 
    11791131                        /** 
    11801132                         * operator name with (inferred) static instantiations 
     
    12111163                             */ 
    12121164                            LooseJuxt(); 
    1213                                 /** 
    1214                                  * Template gap for expressions 
    1215                                  */ 
    1216 //                                TemplateGapLooseJuxt(Id id, List<Id> templateParams) implements TemplateGap; 
    12171165                           /** 
    12181166                             * juxtaposition without intervening whitespace 
     
    12421190                        OpExpr(OpRef op, 
    12431191                               List<Expr> args = Collections.<Expr>emptyList()); 
    1244                          
     1192 
    12451193                        /** 
    12461194                         * If an expression uses and operator, and that operator 
     
    12491197                         * unclear until typechecking and overloading resolution 
    12501198                         * whether it should be one multifix application or several 
    1251                          * infix applications.  
     1199                         * infix applications. 
    12521200                         * 
    12531201                         * e.g.) 3+4+5+6 
    12541202                         */ 
    12551203                        AmbiguousMultifixOpExpr(OpRef infix_op, OpRef multifix_op, 
    1256                                                 List<Expr> args = Collections.<Expr>emptyList());        
    1257                          
     1204                                                List<Expr> args = Collections.<Expr>emptyList()); 
     1205 
    12581206                        /** 
    12591207                         * chain expression 
     
    20031951        abstract Name(); 
    20041952            /** 
    2005              * Template gap for names 
    2006              */ 
    2007 //            TemplateGapName(Id id, List<Id> templateParams) implements TemplateGap; 
    2008             /** 
    20091953             * unstructured sequence of ids naming an API or component 
    20101954             * Names in the list must be unqualified. 
     
    20321976                     */ 
    20331977                    Id(String text); 
    2034                         /** 
    2035                          * Template gap for expressions 
    2036                          */ 
    2037 //                        TemplateGapId(Id id, List<Id> templateParams) implements TemplateGap; 
    20381978                    /** 
    20391979                     * operator name 
  • trunk/ProjectFortress/src/com/sun/fortress/nodes_util/ErrorMsgMaker.java

    r2109 r2312  
    139139    } 
    140140 
    141  
    142141    public String forId(Id node) { 
    143142        return NodeUtil.nameString(node); 
     
    194193    public String forVarRef(VarRef node) { 
    195194        return NodeUtil.nameString(node.getVar()); 
     195    } 
     196 
     197    public String for_RewriteObjectRef(_RewriteObjectRef node) { 
     198        List<StaticArg> sargs = node.getStaticArgs(); 
     199        return forId(node.getObj()) + 
     200               (sargs.size() > 0 ? Useful.listInOxfords(sargs) : ""); 
     201    } 
     202 
     203    public String forFieldRef(FieldRef node) { 
     204        return node.getObj().accept(this) + "." + forId(node.getField()); 
     205    } 
     206 
     207    public String for_RewriteFieldRef(FieldRef node) { 
     208        return node.getObj().accept(this) + "." + forName(node.getField()); 
     209    } 
     210 
     211    public String forFnRef(FnRef node) { 
     212        List<StaticArg> sargs = node.getStaticArgs(); 
     213        return forId(node.getOriginalName()) + 
     214               (sargs.size() > 0 ? Useful.listInOxfords(sargs) : ""); 
     215    } 
     216 
     217    public String for_RewriteFnRef(_RewriteFnRef node) { 
     218        List<StaticArg> sargs = node.getStaticArgs(); 
     219        return node.getFn().accept(this) + 
     220               (sargs.size() > 0 ? Useful.listInOxfords(sargs) : ""); 
     221    } 
     222 
     223    public String forOpRef(OpRef node) { 
     224        List<StaticArg> sargs = node.getStaticArgs(); 
     225        return forName(node.getOriginalName()) + 
     226               (sargs.size() > 0 ? Useful.listInOxfords(sargs) : ""); 
    196227    } 
    197228