Changeset 1024 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Apr 15, 2002, 4:43:21 PM (23 years ago)
Author:
darin
Message:

Merged KDE 3.0 final code in and:

JavaScriptCore:

  • kjs/internal.cpp:
  • kjs/property_map.cpp:
  • kjs/ustring.h: Removed some unneeded <config.h> includes so we are more similar to the real KDE sources.

Merged changes from KDE 3.0 final and did some build fixes.

  • kjs/grammar.*: Regenerated.
  • kjs/*.lut.h: Regenerated.

WebCore:

  • src/kdelibs/khtml/rendering/render_text.cpp: (TextSlave::printDecoration): Remove some minor gratuitous diffs vs. KDE.
  • src/kdelibs/khtml/rendering/render_text.cpp: (TextSlave::printDecoration): Richard updated to reflect changes in KDE.
  • src/kdelibs/khtml/css/css_valueimpl.cpp: (FontFamilyValueImpl::FontFamilyValueImpl): Fix comment.
  • src/kdelibs/khtml/css/cssstyleselector.cpp: Remove some gratuitous diffs vs. KDE.
  • src/kdelibs/khtml/html/html_objectimpl.cpp: (HTMLEmbedElementImpl::parseAttribute): Remove unneeded copy from KWQ's early days.
  • src/kdelibs/khtml/html/html_tableimpl.cpp: (HTMLTableElementImpl::parseAttribute), (HTMLTablePartElementImpl::parseAttribute): Remove unneeded copy from KWQ's early days.
  • src/kdelibs/khtml/html/htmltokenizer.cpp: (HTMLTokenizer::processToken): Redo the APPLE_CHANGES ifdef here.
  • src/kdelibs/khtml/khtmlpart_p.h: Update to latest kde.
  • src/kdelibs/khtml/khtmlview.cpp: (KHTMLView::KHTMLView): Add ifdef APPLE_CHANGES. (KHTMLView::~KHTMLView): Add ifdef APPLE_CHANGES. (KHTMLView::print): Remove code left in here during merge process.
  • src/kwq/KWQKHTMLPart.mm: Remove unused setFontSizes(), fontSizes(), and resetFontSizes(). After the merge is landed, remove more.
  • src/libwebcore.exp: Export updateStyleSelector() for WebKit.

Fix text to it displays at the right font size.

  • src/kdelibs/khtml/css/cssstyleselector.cpp: (CSSStyleSelector::computeFontSizes): Apply the same SCREEN_RESOLUTION hack here that we do elsewhere.
  • src/kdelibs/khtml/rendering/font.cpp: (Font::width): Use kMin instead of max (oops). (Font::update): Turn off font database chicanery.
  • src/kwq/KWQKHTMLPart.mm: (KHTMLPart::zoomFactor): Use zoom factor 100, not 1.

More fixes so text displays (still at wrong font size).

  • src/kdelibs/khtml/rendering/font.cpp: (max): New helper. (Font::drawText): Simplified implementation for now. (Font::width): Simplified implementation for now.
  • src/kwq/KWQColorGroup.mm: Reinstated QCOLOR_GROUP_SIZE.
  • src/kwq/qt/qfontmetrics.h: Removed charWidth and changed _width to take QChar *.
  • src/kwq/KWQFontMetrics.mm: Removed charWidth and changed _width to take QChar *.

Merged changes from KDE 3.0 final. Other fixes to get things compiling.

  • src/kdelibs/khtml/css/css_valueimpl.cpp: (CSSStyleDeclarationImpl::setProperty): Fix unused variable.
  • src/kdelibs/khtml/khtmlview.cpp: (KHTMLView::contentsContextMenuEvent): Fix unused variable.
  • src/kdelibs/khtml/rendering/font.cpp: (Font::drawText), (Font::width), (Font::update): Disable special "nsbp" logic for now. We can reenable it if necessary.
  • src/kdelibs/khtml/rendering/render_replaced.cpp: Fix mismerge.
  • src/kdelibs/khtml/rendering/render_text.cpp: (RenderText::nodeAtPoint): Fix unused variable.
  • src/kwq/KWQApplication.mm: (QDesktopWidget::width), (QApplication::desktop): Fix mismerge.
  • src/kwq/KWQColorGroup.mm: Fix QCOLOR_GROUP_SIZE.
  • src/kwq/KWQFontMetrics.mm: (QFontMetrics::lineSpacing): New. (QFontMetrics::width): Remove unused optimization.
  • src/kwq/qt/qfontmetrics.h: Add lineSpacing().

Merged changes from previous merge pass.

2002-03-25 Darin Adler <Darin Adler>

Last bit of making stuff compile and link. Probably will drop the merge now
and take it up again when it's time to merge in KDE 3.0 final.

  • src/kwq/KWQEvent.mm: (QFocusEvent::reason): New.
  • src/kwq/KWQPainter.mm: (QPainter::drawText): New overload.

2002-03-25 Darin Adler <Darin Adler>

  • src/kdelibs/khtml/rendering/font.cpp: (Font::width): Make it call _width so we don't lose the optimization.
  • src/kwq/KWQApplication.mm: (QDesktopWidget::screenNumber): New. (QDesktopWidget::screenGeometry): New. (QApplication::style): New.
  • src/kwq/KWQColorGroup.mm: (QColorGroup::highlight): New. (QColorGroup::highlightedText): New.
  • src/kwq/KWQFont.mm: (QFont::setPixelSize): New.
  • src/kwq/KWQFontMetrics.mm: (QFontMetrics::charWidth): New.
  • src/kwq/KWQKGlobal.mm: (KGlobal::locale): Implement. (KLocale::KLocale): New. (KLocale::languageList): New.
  • src/kwq/KWQKHTMLPart.mm: (KHTMLPart::sheetUsed): New. (KHTMLPart::setSheetUsed): New. (KHTMLPart::zoomFactor): New.
  • src/kwq/KWQKHTMLSettings.mm: (KHTMLSettings::mediumFontSize): New.
  • src/kwq/KWQScrollView.mm: (QScrollView::childX): New. (QScrollView::childY): New.
  • src/kwq/qt/qapplication.h: style() returns a QStyle &.
  • src/kwq/qt/qpalette.h: Add Highlight and HighlightedText.

2002-03-24 Darin Adler <Darin Adler>

More compiling. Still won't link.

  • src/kdelibs/khtml/khtmlview.cpp: Disable printing and drag and drop code.
  • src/kdelibs/khtml/rendering/render_text.cpp: (TextSlave::printDecoration): Temporarily turn off our smarter underlining since it relies on access to the string, and TextSlave doesn't have that any more. (RenderText::nodeAtPoint): Get rid of a workaround we don't need any more for a bug that was fixed by KDE folks.
  • src/kwq/KWQApplication.mm: (QApplication::desktop): Make the desktop be a QDesktopWidget.
  • src/kwq/qt/qnamespace.h: Add MetaButton.
  • src/kwq/qt/qtooltip.h: Add a maybeTip virtual function member and a virtual destructor.

2002-03-24 Darin Adler <Darin Adler>

Some fixes to get more stuff to compile.

  • src/kdelibs/khtml/ecma/kjs_dom.cpp: (DOMDocument::getValueProperty): Don't try to look at the private m_bComplete to display "complete". Just do "loading" and "loaded".
  • src/kdelibs/khtml/khtmlpart_p.h: #ifdef this all out for APPLE_CHANGES.
  • src/kdelibs/khtml/rendering/font.cpp: (Font::update): Add an explicit cast to int to avoid float -> int warning.
  • src/kdelibs/khtml/rendering/render_table.cpp: (RenderTable::calcColMinMax): Add an explicit cast to int to avoid uint compared with int warning.
  • src/kdelibs/khtml/xml/dom_docimpl.cpp: (DocumentImpl::recalcStyleSelector): Use sheetUsed() and setSheetUsed() functions on KHTMLPart intead of getting at private fields the way the real KDE code does.
  • src/kwq/KWQKHTMLPart.h: Declare zoomFactor(), sheetUsed(), and setSheetUsed().
  • src/kwq/KWQStyle.h: Add PM_DefaultFramWidth as another metric.
  • src/kwq/kdecore/klocale.h: Add languageList().
  • src/kwq/khtml/khtml_settings.h: Add mediumFontSize().
  • src/kwq/qt/qapplication.h: Add style() and QDesktopWidget.
  • src/kwq/qt/qevent.h: Add reason().
  • src/kwq/qt/qfont.h: Add setPixelSize(int).
  • src/kwq/qt/qfontmetrics.h: Add charWidth() and _charWidth() functions.
  • src/kwq/qt/qpainter.h: Add drawText() overload with position parameter.
  • src/kwq/qt/qpalette.h: Add highlight() and highlightedText().
  • src/kwq/qt/qscrollview.h: Add childX() and childY().
  • src/kwq/KWQApplication.mm: Change KWQDesktopWidget to QDesktopWidget.

WebKit:

  • WebView.subproj/IFPreferences.h:
  • WebView.subproj/IFPreferences.mm: (+[IFPreferences load]): Remove the old WebKitFontSizes preference. (-[IFPreferences mediumFontSize]), (-[IFPreferences setMediumFontSize:]): New.
  • WebView.subproj/IFWebView.mm: (-[IFWebView reapplyStyles]): Call updateStyleSelector() instead of recalcStyle().

Merged changes from previous merge branch.

2002-03-25 Darin Adler <Darin Adler>

  • WebView.subproj/IFPreferences.mm: (+[IFPreferences load]): Add WebKitMediumFontSizePreferenceKey.

WebBrowser:

  • Preferences.subproj/TextPreferences.m: (-[TextPreferences defaultFontSize]), (-[TextPreferences setDefaultFontSize:]): Just get and set the new mediumFontSize preference rather than doing the whole fontSizes preference dance.
Location:
trunk/JavaScriptCore/kjs
Files:
51 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/array_object.cpp

    r798 r1024  
    5959      for (unsigned int u = newLen; u < oldLen; u++) {
    6060        UString p = UString::from(u);
    61         if (hasProperty(exec, p, false))
     61        if (hasOwnProperty(exec, p))
    6262          deleteProperty(exec, p);
    6363      }
     
    7575
    7676  // do we need to update/create the length property ?
    77   if (hasProperty(exec, "length", false)) {
     77  if (hasOwnProperty(exec, "length")) {
    7878    Value len = get(exec, "length");
    7979    if (idx < len.toUInt32(exec))
     
    8888  ObjectImp::put(exec,propertyName,value,attr);
    8989}
     90
     91bool ArrayInstanceImp::hasOwnProperty(ExecState *exec,
     92                                      const UString &propertyName)
     93{
     94  // disable this object's prototype temporarily for the hasProperty() call
     95  Value protoBackup = prototype();
     96  setPrototype(Undefined());
     97  bool b = hasProperty(exec, propertyName);
     98  setPrototype(protoBackup);
     99  return b;
     100}
     101
    90102// ------------------------------ ArrayPrototypeImp ----------------------------
    91103
  • trunk/JavaScriptCore/kjs/array_object.h

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
     
    3534    virtual void put(ExecState *exec, const UString &propertyName, const Value &value, int attr = None);
    3635    virtual void putDirect(ExecState *exec, const UString &propertyName, const Value &value, int attr = None);
     36    /**
     37     * A shallow hasProperty() variant that doesn't look at the prototype's
     38     * properties.
     39     */
     40    virtual bool hasOwnProperty(ExecState *exec, const UString &propertyName);
    3741
    3842    virtual const ClassInfo *classInfo() const { return &info; }
  • trunk/JavaScriptCore/kjs/bool_object.h

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
  • trunk/JavaScriptCore/kjs/collector.cpp

    r798 r1024  
    1919 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2020 *
    21  *  $Id$
    2221 */
    2322
  • trunk/JavaScriptCore/kjs/collector.h

    r798 r1024  
    1919 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2020 *
    21  *  $Id$
    2221 */
    2322
     
    8180
    8281#ifdef KJS_DEBUG_MEM
    83     /** Check that nothing is left when the last interpreter gets deleted */
     82    /**
     83     * Check that nothing is left when the last interpreter gets deleted
     84     */
    8485    static void finalCheck();
    8586    /**
  • trunk/JavaScriptCore/kjs/date_object.cpp

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
     
    175174  const int bufsize=100;
    176175  char timebuffer[bufsize];
    177   char *oldlocale = setlocale(LC_TIME,NULL);
    178   if (!oldlocale)
     176  CString oldlocale = setlocale(LC_TIME,NULL);
     177  if (!oldlocale.c_str())
    179178    oldlocale = setlocale(LC_ALL, NULL);
    180179  Value v = thisObj.internalValue();
     
    206205      strftime(timebuffer, bufsize, "%a, %d-%b-%y %H:%M:%S %Z", t);
    207206    }
    208     setlocale(LC_TIME,oldlocale);
     207    setlocale(LC_TIME,oldlocale.c_str());
    209208    result = String(timebuffer);
    210209    break;
  • trunk/JavaScriptCore/kjs/date_object.h

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
     
    2625#include "internal.h"
    2726#include "function_object.h"
     27
     28#include <sys/time.h>
    2829
    2930namespace KJS {
     
    120121  // helper functions
    121122  Value parseDate(const String &s);
    122   time_t KRFCDate_parseDate(const UString &_date);
     123  time_t KRFCDate_parseDate(const UString &_date); 
    123124  Value timeClip(const Value &t);
    124125
  • trunk/JavaScriptCore/kjs/debugger.cpp

    r798 r1024  
    1919 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2020 *
    21  *  $Id$
    2221 */
    2322
  • trunk/JavaScriptCore/kjs/debugger.h

    r798 r1024  
    1919 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2020 *
    21  *  $Id$
    2221 */
    2322
  • trunk/JavaScriptCore/kjs/error_object.h

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
  • trunk/JavaScriptCore/kjs/function.cpp

    r798 r1024  
    5858  Value protect(this);
    5959  argStack = new ListImp();
     60  Value protectArgStack( argStack ); // this also calls setGcAllowed on argStack
     61  //fprintf(stderr,"FunctionImp::FunctionImp this=%p argStack=%p\n");
    6062  put(exec,"arguments",Null(),ReadOnly|DontDelete|DontEnum);
    6163}
     
    6365FunctionImp::~FunctionImp()
    6466{
    65   argStack->setGcAllowed();
    6667  // The function shouldn't be deleted while it is still executed; argStack
    6768  // should be set to 0 by the last call to popArgs()
    68   assert(argStack->isEmpty());
     69  //assert(argStack->isEmpty());
     70  // Accessing argStack from here is a problem though.
     71  // When the function isn't used anymore, it's not marked, and neither is the
     72  // argStack, so both can be deleted - in any order!
    6973  delete param;
    7074}
     
    170174
    171175  *p = new Parameter(n);
     176}
     177
     178UString FunctionImp::parameterString() const
     179{
     180  UString s;
     181  const Parameter * const *p = &param;
     182  while (*p) {
     183    if (!s.isEmpty())
     184        s += ", ";
     185    s += (*p)->name;
     186    p = &(*p)->next;
     187  }
     188
     189  return s;
    172190}
    173191
  • trunk/JavaScriptCore/kjs/function.h

    r798 r1024  
    1919 *  Boston, MA 02111-1307, USA.
    2020 *
    21  *  $Id$
    2221 */
    2322
     
    4746
    4847    void addParameter(const UString &n);
     48    // parameters in string representation, e.g. (a, b, c)
     49    UString parameterString() const;
    4950    virtual CodeType codeType() const = 0;
    5051
  • trunk/JavaScriptCore/kjs/function_object.cpp

    r798 r1024  
    8484  case ToString: {
    8585    // ### also make this work for internal functions
    86     // ### return the text of the function body (see 15.3.4.2)
    8786    if (thisObj.isNull() || !thisObj.inherits(&InternalFunctionImp::info)) {
    8887#ifndef NDEBUG
     
    9392      return err;
    9493    }
    95     if (thisObj.inherits(&FunctionImp::info) &&
     94    if (thisObj.inherits(&DeclaredFunctionImp::info)) {
     95       DeclaredFunctionImp *fi = static_cast<DeclaredFunctionImp*>
     96                                 (thisObj.imp());
     97       return String("function " + fi->name() + "(" +
     98         fi->parameterString() + ") " + fi->body->toString());
     99    } else if (thisObj.inherits(&FunctionImp::info) &&
    96100        !static_cast<FunctionImp*>(thisObj.imp())->name().isNull()) {
    97101      result = String("function " + static_cast<FunctionImp*>(thisObj.imp())->name() + "()");
     
    127131        Object argArrayObj = Object::dynamicCast(argArray);
    128132        unsigned int length = argArrayObj.get(exec,"length").toUInt32(exec);
    129         for (uint i = 0; i < length; i++)
     133        for (unsigned int i = 0; i < length; i++)
    130134          applyArgs.append(argArrayObj.get(exec,UString::from(i)));
    131135      }
  • trunk/JavaScriptCore/kjs/function_object.h

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
  • trunk/JavaScriptCore/kjs/grammar.cpp

    r903 r1024  
    318318   180,   181,   182,   183,   186,   188,   189,   192,   194,   198,
    319319   200,   203,   205,   208,   210,   214,   217,   218,   221,   223,
    320    224,   225,   227,   230,   232,   235,   237,   238,   239,   242,
    321    244,   247,   249,   252,   254,   257,   259,   260,   263,   265,
    322    266,   267,   268,   269,   270,   271,   272,   273,   274,   275,
    323    278,   280,   281,   282,   285,   287,   288,   291,   293,   294,
    324    295,   298,   300,   302,   304,   306,   308,   310,   314,   316,
    325    317,   318,   319,   322,   324,   327,   329,   332,   334,   337,
    326    339,   343,   345,   349,   351,   355,   357,   361,   363,   364,
    327    365,   366,   367,   368,   369,   370,   371,   372,   373,   376,
    328    378,   381,   383,   384,   385,   386,   387,   388,   389,   390,
    329    391,   392,   393,   394,   395,   398,   400,   403,   405,   408,
    330    411,   420,   422,   426,   428,   431,   435,   439,   442,   449,
    331    451,   455,   457,   458,   461,   464,   467,   471,   477,   479,
    332    482,   484,   488,   490,   497,   499,   503,   505,   513,   515,
    333    519,   520,   526,   531,   536,   538,   542,   544,   547,   549,
    334    552,   554,   557,   559,   562,   568,   572,   574,   575,   578,
    335    582,   586,   589,   593,   595,   600,   602,   606,   609,   613,
    336    616,   620,   622,   625,   627
     320   224,   225,   227,   230,   232,   235,   237,   238,   239,   243,
     321   245,   248,   250,   253,   255,   258,   260,   261,   264,   266,
     322   267,   268,   269,   270,   271,   272,   273,   274,   275,   276,
     323   279,   281,   282,   283,   286,   288,   289,   292,   294,   295,
     324   296,   299,   301,   303,   305,   307,   309,   311,   315,   317,
     325   318,   319,   320,   323,   325,   328,   330,   333,   335,   338,
     326   340,   344,   346,   350,   352,   356,   358,   362,   364,   365,
     327   366,   367,   368,   369,   370,   371,   372,   373,   374,   377,
     328   379,   382,   384,   385,   386,   387,   388,   389,   390,   391,
     329   392,   393,   394,   395,   396,   399,   401,   404,   406,   409,
     330   412,   421,   423,   427,   429,   432,   436,   440,   443,   450,
     331   452,   456,   458,   459,   462,   465,   468,   472,   478,   480,
     332   483,   485,   489,   491,   498,   500,   504,   506,   514,   516,
     333   520,   521,   527,   532,   537,   539,   543,   545,   548,   550,
     334   553,   555,   558,   560,   563,   569,   573,   575,   576,   579,
     335   583,   587,   590,   594,   596,   601,   603,   607,   610,   614,
     336   617,   621,   623,   626,   628
    337337};
    338338#endif
     
    14671467case 39:
    14681468#line 239 "grammar.y"
    1469 { yyval.node = new AccessorNode2(yyvsp[-2].node, yyvsp[0].ustr); ;
     1469{ yyval.node = new AccessorNode2(yyvsp[-2].node, yyvsp[0].ustr);
     1470                                     delete yyvsp[0].ustr; ;
    14701471    break;}
    14711472case 40:
    1472 #line 243 "grammar.y"
     1473#line 244 "grammar.y"
    14731474{ yyval.args = new ArgumentsNode(0L); ;
    14741475    break;}
    14751476case 41:
    1476 #line 244 "grammar.y"
     1477#line 245 "grammar.y"
    14771478{ yyval.args = new ArgumentsNode(yyvsp[-1].alist); ;
    14781479    break;}
    14791480case 42:
    1480 #line 248 "grammar.y"
     1481#line 249 "grammar.y"
    14811482{ yyval.alist = new ArgumentListNode(yyvsp[0].node); ;
    14821483    break;}
    14831484case 43:
    1484 #line 249 "grammar.y"
     1485#line 250 "grammar.y"
    14851486{ yyval.alist = new ArgumentListNode(yyvsp[-2].alist, yyvsp[0].node); ;
    14861487    break;}
    14871488case 47:
    1488 #line 259 "grammar.y"
     1489#line 260 "grammar.y"
    14891490{ yyval.node = new PostfixNode(yyvsp[-1].node, OpPlusPlus); ;
    14901491    break;}
    14911492case 48:
    1492 #line 260 "grammar.y"
     1493#line 261 "grammar.y"
    14931494{ yyval.node = new PostfixNode(yyvsp[-1].node, OpMinusMinus); ;
    14941495    break;}
    14951496case 50:
    1496 #line 265 "grammar.y"
     1497#line 266 "grammar.y"
    14971498{ yyval.node = new DeleteNode(yyvsp[0].node); ;
    14981499    break;}
    14991500case 51:
    1500 #line 266 "grammar.y"
     1501#line 267 "grammar.y"
    15011502{ yyval.node = new VoidNode(yyvsp[0].node); ;
    15021503    break;}
    15031504case 52:
    1504 #line 267 "grammar.y"
     1505#line 268 "grammar.y"
    15051506{ yyval.node = new TypeOfNode(yyvsp[0].node); ;
    15061507    break;}
    15071508case 53:
    1508 #line 268 "grammar.y"
    1509 { yyval.node = new PrefixNode(OpPlusPlus, yyvsp[0].node); ;
    1510     break;}
    1511 case 54:
    15121509#line 269 "grammar.y"
    15131510{ yyval.node = new PrefixNode(OpPlusPlus, yyvsp[0].node); ;
    15141511    break;}
     1512case 54:
     1513#line 270 "grammar.y"
     1514{ yyval.node = new PrefixNode(OpPlusPlus, yyvsp[0].node); ;
     1515    break;}
    15151516case 55:
    1516 #line 270 "grammar.y"
    1517 { yyval.node = new PrefixNode(OpMinusMinus, yyvsp[0].node); ;
    1518     break;}
    1519 case 56:
    15201517#line 271 "grammar.y"
    15211518{ yyval.node = new PrefixNode(OpMinusMinus, yyvsp[0].node); ;
    15221519    break;}
     1520case 56:
     1521#line 272 "grammar.y"
     1522{ yyval.node = new PrefixNode(OpMinusMinus, yyvsp[0].node); ;
     1523    break;}
    15231524case 57:
    1524 #line 272 "grammar.y"
     1525#line 273 "grammar.y"
    15251526{ yyval.node = new UnaryPlusNode(yyvsp[0].node); ;
    15261527    break;}
    15271528case 58:
    1528 #line 273 "grammar.y"
     1529#line 274 "grammar.y"
    15291530{ yyval.node = new NegateNode(yyvsp[0].node); ;
    15301531    break;}
    15311532case 59:
    1532 #line 274 "grammar.y"
     1533#line 275 "grammar.y"
    15331534{ yyval.node = new BitwiseNotNode(yyvsp[0].node); ;
    15341535    break;}
    15351536case 60:
    1536 #line 275 "grammar.y"
     1537#line 276 "grammar.y"
    15371538{ yyval.node = new LogicalNotNode(yyvsp[0].node); ;
    15381539    break;}
    15391540case 62:
    1540 #line 280 "grammar.y"
     1541#line 281 "grammar.y"
    15411542{ yyval.node = new MultNode(yyvsp[-2].node, yyvsp[0].node, '*'); ;
    15421543    break;}
    15431544case 63:
    1544 #line 281 "grammar.y"
     1545#line 282 "grammar.y"
    15451546{ yyval.node = new MultNode(yyvsp[-2].node, yyvsp[0].node, '/'); ;
    15461547    break;}
    15471548case 64:
    1548 #line 282 "grammar.y"
     1549#line 283 "grammar.y"
    15491550{ yyval.node = new MultNode(yyvsp[-2].node,yyvsp[0].node,'%'); ;
    15501551    break;}
    15511552case 66:
    1552 #line 287 "grammar.y"
     1553#line 288 "grammar.y"
    15531554{ yyval.node = new AddNode(yyvsp[-2].node, yyvsp[0].node, '+'); ;
    15541555    break;}
    15551556case 67:
    1556 #line 288 "grammar.y"
     1557#line 289 "grammar.y"
    15571558{ yyval.node = new AddNode(yyvsp[-2].node, yyvsp[0].node, '-'); ;
    15581559    break;}
    15591560case 69:
    1560 #line 293 "grammar.y"
     1561#line 294 "grammar.y"
    15611562{ yyval.node = new ShiftNode(yyvsp[-2].node, OpLShift, yyvsp[0].node); ;
    15621563    break;}
    15631564case 70:
    1564 #line 294 "grammar.y"
     1565#line 295 "grammar.y"
    15651566{ yyval.node = new ShiftNode(yyvsp[-2].node, OpRShift, yyvsp[0].node); ;
    15661567    break;}
    15671568case 71:
    1568 #line 295 "grammar.y"
     1569#line 296 "grammar.y"
    15691570{ yyval.node = new ShiftNode(yyvsp[-2].node, OpURShift, yyvsp[0].node); ;
    15701571    break;}
    15711572case 73:
    1572 #line 301 "grammar.y"
     1573#line 302 "grammar.y"
    15731574{ yyval.node = new RelationalNode(yyvsp[-2].node, OpLess, yyvsp[0].node); ;
    15741575    break;}
    15751576case 74:
    1576 #line 303 "grammar.y"
     1577#line 304 "grammar.y"
    15771578{ yyval.node = new RelationalNode(yyvsp[-2].node, OpGreater, yyvsp[0].node); ;
    15781579    break;}
    15791580case 75:
    1580 #line 305 "grammar.y"
     1581#line 306 "grammar.y"
    15811582{ yyval.node = new RelationalNode(yyvsp[-2].node, OpLessEq, yyvsp[0].node); ;
    15821583    break;}
    15831584case 76:
    1584 #line 307 "grammar.y"
     1585#line 308 "grammar.y"
    15851586{ yyval.node = new RelationalNode(yyvsp[-2].node, OpGreaterEq, yyvsp[0].node); ;
    15861587    break;}
    15871588case 77:
    1588 #line 309 "grammar.y"
     1589#line 310 "grammar.y"
    15891590{ yyval.node = new RelationalNode(yyvsp[-2].node, OpInstanceOf, yyvsp[0].node); ;
    15901591    break;}
    15911592case 78:
    1592 #line 311 "grammar.y"
     1593#line 312 "grammar.y"
    15931594{ yyval.node = new RelationalNode(yyvsp[-2].node, OpIn, yyvsp[0].node); ;
    15941595    break;}
    15951596case 80:
    1596 #line 316 "grammar.y"
     1597#line 317 "grammar.y"
    15971598{ yyval.node = new EqualNode(yyvsp[-2].node, OpEqEq, yyvsp[0].node); ;
    15981599    break;}
    15991600case 81:
    1600 #line 317 "grammar.y"
     1601#line 318 "grammar.y"
    16011602{ yyval.node = new EqualNode(yyvsp[-2].node, OpNotEq, yyvsp[0].node); ;
    16021603    break;}
    16031604case 82:
    1604 #line 318 "grammar.y"
     1605#line 319 "grammar.y"
    16051606{ yyval.node = new EqualNode(yyvsp[-2].node, OpStrEq, yyvsp[0].node); ;
    16061607    break;}
    16071608case 83:
    1608 #line 319 "grammar.y"
     1609#line 320 "grammar.y"
    16091610{ yyval.node = new EqualNode(yyvsp[-2].node, OpStrNEq, yyvsp[0].node);;
    16101611    break;}
    16111612case 85:
    1612 #line 324 "grammar.y"
     1613#line 325 "grammar.y"
    16131614{ yyval.node = new BitOperNode(yyvsp[-2].node, OpBitAnd, yyvsp[0].node); ;
    16141615    break;}
    16151616case 87:
    1616 #line 329 "grammar.y"
     1617#line 330 "grammar.y"
    16171618{ yyval.node = new BitOperNode(yyvsp[-2].node, OpBitXOr, yyvsp[0].node); ;
    16181619    break;}
    16191620case 89:
    1620 #line 334 "grammar.y"
     1621#line 335 "grammar.y"
    16211622{ yyval.node = new BitOperNode(yyvsp[-2].node, OpBitOr, yyvsp[0].node); ;
    16221623    break;}
    16231624case 91:
    1624 #line 340 "grammar.y"
     1625#line 341 "grammar.y"
    16251626{ yyval.node = new BinaryLogicalNode(yyvsp[-2].node, OpAnd, yyvsp[0].node); ;
    16261627    break;}
    16271628case 93:
    1628 #line 346 "grammar.y"
     1629#line 347 "grammar.y"
    16291630{ yyval.node = new BinaryLogicalNode(yyvsp[-2].node, OpOr, yyvsp[0].node); ;
    16301631    break;}
    16311632case 95:
    1632 #line 352 "grammar.y"
     1633#line 353 "grammar.y"
    16331634{ yyval.node = new ConditionalNode(yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
    16341635    break;}
    16351636case 97:
    1636 #line 358 "grammar.y"
     1637#line 359 "grammar.y"
    16371638{ yyval.node = new AssignNode(yyvsp[-2].node, yyvsp[-1].op, yyvsp[0].node);;
    16381639    break;}
    16391640case 98:
    1640 #line 362 "grammar.y"
     1641#line 363 "grammar.y"
    16411642{ yyval.op = OpEqual; ;
    16421643    break;}
    16431644case 99:
    1644 #line 363 "grammar.y"
     1645#line 364 "grammar.y"
    16451646{ yyval.op = OpPlusEq; ;
    16461647    break;}
    16471648case 100:
    1648 #line 364 "grammar.y"
     1649#line 365 "grammar.y"
    16491650{ yyval.op = OpMinusEq; ;
    16501651    break;}
    16511652case 101:
    1652 #line 365 "grammar.y"
     1653#line 366 "grammar.y"
    16531654{ yyval.op = OpMultEq; ;
    16541655    break;}
    16551656case 102:
    1656 #line 366 "grammar.y"
     1657#line 367 "grammar.y"
    16571658{ yyval.op = OpDivEq; ;
    16581659    break;}
    16591660case 103:
    1660 #line 367 "grammar.y"
     1661#line 368 "grammar.y"
    16611662{ yyval.op = OpLShift; ;
    16621663    break;}
    16631664case 104:
    1664 #line 368 "grammar.y"
     1665#line 369 "grammar.y"
    16651666{ yyval.op = OpRShift; ;
    16661667    break;}
    16671668case 105:
    1668 #line 369 "grammar.y"
     1669#line 370 "grammar.y"
    16691670{ yyval.op = OpURShift; ;
    16701671    break;}
    16711672case 106:
    1672 #line 370 "grammar.y"
     1673#line 371 "grammar.y"
    16731674{ yyval.op = OpAndEq; ;
    16741675    break;}
    16751676case 107:
    1676 #line 371 "grammar.y"
     1677#line 372 "grammar.y"
    16771678{ yyval.op = OpXOrEq; ;
    16781679    break;}
    16791680case 108:
    1680 #line 372 "grammar.y"
     1681#line 373 "grammar.y"
    16811682{ yyval.op = OpOrEq; ;
    16821683    break;}
    16831684case 109:
    1684 #line 373 "grammar.y"
     1685#line 374 "grammar.y"
    16851686{ yyval.op = OpModEq; ;
    16861687    break;}
    16871688case 111:
    1688 #line 378 "grammar.y"
     1689#line 379 "grammar.y"
    16891690{ yyval.node = new CommaNode(yyvsp[-2].node, yyvsp[0].node); ;
    16901691    break;}
    16911692case 126:
    1692 #line 399 "grammar.y"
     1693#line 400 "grammar.y"
    16931694{ yyval.stat = new BlockNode(0L); DBG(yyval.stat, yylsp[0], yylsp[0]); ;
    16941695    break;}
    16951696case 127:
    1696 #line 400 "grammar.y"
     1697#line 401 "grammar.y"
    16971698{ yyval.stat = new BlockNode(yyvsp[-1].srcs); DBG(yyval.stat, yylsp[0], yylsp[0]); ;
    16981699    break;}
    16991700case 128:
    1700 #line 404 "grammar.y"
     1701#line 405 "grammar.y"
    17011702{ yyval.slist = new StatListNode(yyvsp[0].stat); ;
    17021703    break;}
    17031704case 129:
    1704 #line 405 "grammar.y"
     1705#line 406 "grammar.y"
    17051706{ yyval.slist = new StatListNode(yyvsp[-1].slist, yyvsp[0].stat); ;
    17061707    break;}
    17071708case 130:
    1708 #line 409 "grammar.y"
     1709#line 410 "grammar.y"
    17091710{ yyval.stat = new VarStatementNode(yyvsp[-1].vlist);
    17101711                                      DBG(yyval.stat, yylsp[-2], yylsp[0]); ;
    17111712    break;}
    17121713case 131:
    1713 #line 411 "grammar.y"
     1714#line 412 "grammar.y"
    17141715{ if (automatic()) {
    17151716                                          yyval.stat = new VarStatementNode(yyvsp[-1].vlist);
     
    17211722    break;}
    17221723case 132:
    1723 #line 421 "grammar.y"
     1724#line 422 "grammar.y"
    17241725{ yyval.vlist = new VarDeclListNode(yyvsp[0].decl); ;
    17251726    break;}
    17261727case 133:
    1727 #line 423 "grammar.y"
     1728#line 424 "grammar.y"
    17281729{ yyval.vlist = new VarDeclListNode(yyvsp[-2].vlist, yyvsp[0].decl); ;
    17291730    break;}
    17301731case 134:
    1731 #line 427 "grammar.y"
     1732#line 428 "grammar.y"
    17321733{ yyval.decl = new VarDeclNode(yyvsp[0].ustr, 0); delete yyvsp[0].ustr; ;
    17331734    break;}
    17341735case 135:
    1735 #line 428 "grammar.y"
     1736#line 429 "grammar.y"
    17361737{ yyval.decl = new VarDeclNode(yyvsp[-1].ustr, yyvsp[0].init); delete yyvsp[-1].ustr; ;
    17371738    break;}
    17381739case 136:
    1739 #line 432 "grammar.y"
     1740#line 433 "grammar.y"
    17401741{ yyval.init = new AssignExprNode(yyvsp[0].node); ;
    17411742    break;}
    17421743case 137:
    1743 #line 436 "grammar.y"
     1744#line 437 "grammar.y"
    17441745{ yyval.stat = new EmptyStatementNode(); ;
    17451746    break;}
    17461747case 138:
    1747 #line 440 "grammar.y"
     1748#line 441 "grammar.y"
    17481749{ yyval.stat = new ExprStatementNode(yyvsp[-1].node);
    17491750                                     DBG(yyval.stat, yylsp[-1], yylsp[0]); ;
    17501751    break;}
    17511752case 139:
    1752 #line 442 "grammar.y"
     1753#line 443 "grammar.y"
    17531754{ if (automatic()) {
    17541755                                       yyval.stat = new ExprStatementNode(yyvsp[-1].node);
     
    17581759    break;}
    17591760case 140:
    1760 #line 450 "grammar.y"
     1761#line 451 "grammar.y"
    17611762{ yyval.stat = new IfNode(yyvsp[-2].node,yyvsp[0].stat,0L);DBG(yyval.stat,yylsp[-4],yylsp[-1]); ;
    17621763    break;}
    17631764case 141:
    1764 #line 452 "grammar.y"
     1765#line 453 "grammar.y"
    17651766{ yyval.stat = new IfNode(yyvsp[-4].node,yyvsp[-2].stat,yyvsp[0].stat);DBG(yyval.stat,yylsp[-6],yylsp[-3]); ;
    17661767    break;}
    17671768case 142:
    1768 #line 456 "grammar.y"
     1769#line 457 "grammar.y"
    17691770{ yyval.stat=new DoWhileNode(yyvsp[-4].stat,yyvsp[-1].node);DBG(yyval.stat,yylsp[-5],yylsp[-3]);;
    17701771    break;}
    17711772case 143:
    1772 #line 457 "grammar.y"
     1773#line 458 "grammar.y"
    17731774{ yyval.stat = new WhileNode(yyvsp[-2].node,yyvsp[0].stat);DBG(yyval.stat,yylsp[-4],yylsp[-1]); ;
    17741775    break;}
    17751776case 144:
    1776 #line 459 "grammar.y"
     1777#line 460 "grammar.y"
    17771778{ yyval.stat = new ForNode(yyvsp[-6].node,yyvsp[-4].node,yyvsp[-2].node,yyvsp[0].stat);
    17781779                                     DBG(yyval.stat,yylsp[-8],yylsp[-1]); ;
    17791780    break;}
    17801781case 145:
    1781 #line 462 "grammar.y"
     1782#line 463 "grammar.y"
    17821783{ yyval.stat = new ForNode(yyvsp[-6].vlist,yyvsp[-4].node,yyvsp[-2].node,yyvsp[0].stat);
    17831784                                     DBG(yyval.stat,yylsp[-9],yylsp[-1]); ;
    17841785    break;}
    17851786case 146:
    1786 #line 465 "grammar.y"
     1787#line 466 "grammar.y"
    17871788{ yyval.stat = new ForInNode(yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].stat);
    17881789                                     DBG(yyval.stat,yylsp[-6],yylsp[-1]); ;
    17891790    break;}
    17901791case 147:
    1791 #line 468 "grammar.y"
     1792#line 469 "grammar.y"
    17921793{ yyval.stat = new ForInNode(yyvsp[-4].ustr,0L,yyvsp[-2].node,yyvsp[0].stat);
    17931794                                     DBG(yyval.stat,yylsp[-7],yylsp[-1]);
     
    17951796    break;}
    17961797case 148:
    1797 #line 472 "grammar.y"
     1798#line 473 "grammar.y"
    17981799{ yyval.stat = new ForInNode(yyvsp[-5].ustr,yyvsp[-4].init,yyvsp[-2].node,yyvsp[0].stat);
    17991800                                     DBG(yyval.stat,yylsp[-8],yylsp[-1]);
     
    18011802    break;}
    18021803case 149:
    1803 #line 478 "grammar.y"
     1804#line 479 "grammar.y"
    18041805{ yyval.node = 0L; ;
    18051806    break;}
    18061807case 151:
    1807 #line 483 "grammar.y"
     1808#line 484 "grammar.y"
    18081809{ yyval.stat = new ContinueNode(); DBG(yyval.stat,yylsp[-1],yylsp[0]); ;
    18091810    break;}
    18101811case 152:
    1811 #line 484 "grammar.y"
     1812#line 485 "grammar.y"
    18121813{ if (automatic()) {
    18131814                                       yyval.stat = new ContinueNode(); DBG(yyval.stat,yylsp[-1],yylsp[0]);
     
    18161817    break;}
    18171818case 153:
    1818 #line 488 "grammar.y"
     1819#line 489 "grammar.y"
    18191820{ yyval.stat = new ContinueNode(yyvsp[-1].ustr); DBG(yyval.stat,yylsp[-2],yylsp[0]);
    18201821                                     delete yyvsp[-1].ustr; ;
    18211822    break;}
    18221823case 154:
    1823 #line 490 "grammar.y"
     1824#line 491 "grammar.y"
    18241825{ if (automatic()) {
    18251826                                       yyval.stat = new ContinueNode(yyvsp[-1].ustr);DBG(yyval.stat,yylsp[-2],yylsp[-1]);
     
    18291830    break;}
    18301831case 155:
    1831 #line 498 "grammar.y"
     1832#line 499 "grammar.y"
    18321833{ yyval.stat = new BreakNode();DBG(yyval.stat,yylsp[-1],yylsp[0]); ;
    18331834    break;}
    18341835case 156:
    1835 #line 499 "grammar.y"
     1836#line 500 "grammar.y"
    18361837{ if (automatic()) {
    18371838                                       yyval.stat = new BreakNode(); DBG(yyval.stat,yylsp[-1],yylsp[-1]);
     
    18401841    break;}
    18411842case 157:
    1842 #line 503 "grammar.y"
     1843#line 504 "grammar.y"
    18431844{ yyval.stat = new BreakNode(yyvsp[-1].ustr); DBG(yyval.stat,yylsp[-2],yylsp[0]);
    18441845                                     delete yyvsp[-1].ustr; ;
    18451846    break;}
    18461847case 158:
    1847 #line 505 "grammar.y"
     1848#line 506 "grammar.y"
    18481849{ if (automatic()) {
    18491850                                       yyval.stat = new BreakNode(yyvsp[-1].ustr); DBG(yyval.stat,yylsp[-2],yylsp[-1]);
     
    18541855    break;}
    18551856case 159:
    1856 #line 514 "grammar.y"
     1857#line 515 "grammar.y"
    18571858{ yyval.stat = new ReturnNode(0L); DBG(yyval.stat,yylsp[-1],yylsp[0]); ;
    18581859    break;}
    18591860case 160:
    1860 #line 515 "grammar.y"
     1861#line 516 "grammar.y"
    18611862{ if (automatic()) {
    18621863                                       yyval.stat = new ReturnNode(0L); DBG(yyval.stat,yylsp[-1],yylsp[-1]);
     
    18651866    break;}
    18661867case 161:
    1867 #line 519 "grammar.y"
     1868#line 520 "grammar.y"
    18681869{ yyval.stat = new ReturnNode(yyvsp[-1].node); ;
    18691870    break;}
    18701871case 162:
    1871 #line 520 "grammar.y"
     1872#line 521 "grammar.y"
    18721873{ if (automatic())
    18731874                                       yyval.stat = new ReturnNode(yyvsp[-1].node);
     
    18761877    break;}
    18771878case 163:
    1878 #line 527 "grammar.y"
     1879#line 528 "grammar.y"
    18791880{ yyval.stat = new WithNode(yyvsp[-2].node,yyvsp[0].stat);
    18801881                                     DBG(yyval.stat, yylsp[-4], yylsp[-1]); ;
    18811882    break;}
    18821883case 164:
    1883 #line 532 "grammar.y"
     1884#line 533 "grammar.y"
    18841885{ yyval.stat = new SwitchNode(yyvsp[-2].node, yyvsp[0].cblk);
    18851886                                     DBG(yyval.stat, yylsp[-4], yylsp[-1]); ;
    18861887    break;}
    18871888case 165:
    1888 #line 537 "grammar.y"
     1889#line 538 "grammar.y"
    18891890{ yyval.cblk = new CaseBlockNode(yyvsp[-1].clist, 0L, 0L); ;
    18901891    break;}
    18911892case 166:
    1892 #line 539 "grammar.y"
     1893#line 540 "grammar.y"
    18931894{ yyval.cblk = new CaseBlockNode(yyvsp[-3].clist, yyvsp[-2].ccl, yyvsp[-1].clist); ;
    18941895    break;}
    18951896case 167:
    1896 #line 543 "grammar.y"
     1897#line 544 "grammar.y"
    18971898{ yyval.clist = 0L; ;
    18981899    break;}
    18991900case 169:
    1900 #line 548 "grammar.y"
     1901#line 549 "grammar.y"
    19011902{ yyval.clist = new ClauseListNode(yyvsp[0].ccl); ;
    19021903    break;}
    19031904case 170:
    1904 #line 549 "grammar.y"
     1905#line 550 "grammar.y"
    19051906{ yyval.clist = yyvsp[-1].clist->append(yyvsp[0].ccl); ;
    19061907    break;}
    19071908case 171:
    1908 #line 553 "grammar.y"
     1909#line 554 "grammar.y"
    19091910{ yyval.ccl = new CaseClauseNode(yyvsp[-1].node, 0L); ;
    19101911    break;}
    19111912case 172:
    1912 #line 554 "grammar.y"
     1913#line 555 "grammar.y"
    19131914{ yyval.ccl = new CaseClauseNode(yyvsp[-2].node, yyvsp[0].slist); ;
    19141915    break;}
    19151916case 173:
    1916 #line 558 "grammar.y"
     1917#line 559 "grammar.y"
    19171918{ yyval.ccl = new CaseClauseNode(0L, 0L);; ;
    19181919    break;}
    19191920case 174:
    1920 #line 559 "grammar.y"
     1921#line 560 "grammar.y"
    19211922{ yyval.ccl = new CaseClauseNode(0L, yyvsp[0].slist); ;
    19221923    break;}
    19231924case 175:
    1924 #line 563 "grammar.y"
     1925#line 564 "grammar.y"
    19251926{ yyvsp[0].stat->pushLabel(yyvsp[-2].ustr);
    19261927                                     yyval.stat = new LabelNode(yyvsp[-2].ustr, yyvsp[0].stat);
     
    19281929    break;}
    19291930case 176:
    1930 #line 569 "grammar.y"
     1931#line 570 "grammar.y"
    19311932{ yyval.stat = new ThrowNode(yyvsp[-1].node); ;
    19321933    break;}
    19331934case 177:
    1934 #line 573 "grammar.y"
     1935#line 574 "grammar.y"
    19351936{ yyval.stat = new TryNode(yyvsp[-1].stat, yyvsp[0].node); ;
    19361937    break;}
    19371938case 178:
    1938 #line 574 "grammar.y"
     1939#line 575 "grammar.y"
    19391940{ yyval.stat = new TryNode(yyvsp[-1].stat, 0L, yyvsp[0].node); ;
    19401941    break;}
    19411942case 179:
    1942 #line 575 "grammar.y"
     1943#line 576 "grammar.y"
    19431944{ yyval.stat = new TryNode(yyvsp[-2].stat, yyvsp[-1].node, yyvsp[0].node); ;
    19441945    break;}
    19451946case 180:
    1946 #line 579 "grammar.y"
     1947#line 580 "grammar.y"
    19471948{ yyval.node = new CatchNode(yyvsp[-2].ustr, yyvsp[0].stat); delete yyvsp[-2].ustr; ;
    19481949    break;}
    19491950case 181:
    1950 #line 583 "grammar.y"
     1951#line 584 "grammar.y"
    19511952{ yyval.node = new FinallyNode(yyvsp[0].stat); ;
    19521953    break;}
    19531954case 182:
    1954 #line 587 "grammar.y"
     1955#line 588 "grammar.y"
    19551956{ yyval.func = new FuncDeclNode(yyvsp[-3].ustr, 0L, yyvsp[0].body);
    19561957                                             delete yyvsp[-3].ustr; ;
    19571958    break;}
    19581959case 183:
    1959 #line 590 "grammar.y"
     1960#line 591 "grammar.y"
    19601961{ yyval.func = new FuncDeclNode(yyvsp[-4].ustr, yyvsp[-2].param, yyvsp[0].body);
    19611962                                     delete yyvsp[-4].ustr; ;
    19621963    break;}
    19631964case 184:
    1964 #line 594 "grammar.y"
     1965#line 595 "grammar.y"
    19651966{ yyval.node = new FuncExprNode(0L, yyvsp[0].body); ;
    19661967    break;}
    19671968case 185:
    1968 #line 596 "grammar.y"
     1969#line 597 "grammar.y"
    19691970{ yyval.node = new FuncExprNode(yyvsp[-2].param, yyvsp[0].body); ;
    19701971    break;}
    19711972case 186:
    1972 #line 601 "grammar.y"
     1973#line 602 "grammar.y"
    19731974{ yyval.param = new ParameterNode(yyvsp[0].ustr); delete yyvsp[0].ustr; ;
    19741975    break;}
    19751976case 187:
    1976 #line 602 "grammar.y"
     1977#line 603 "grammar.y"
    19771978{ yyval.param = yyvsp[-2].param->append(yyvsp[0].ustr);
    19781979                                     delete yyvsp[0].ustr; ;
    19791980    break;}
    19801981case 188:
    1981 #line 607 "grammar.y"
     1982#line 608 "grammar.y"
    19821983{ yyval.body = new FunctionBodyNode(0L);
    19831984                                     DBG(yyval.body, yylsp[-1], yylsp[0]);;
    19841985    break;}
    19851986case 189:
    1986 #line 609 "grammar.y"
     1987#line 610 "grammar.y"
    19871988{ yyval.body = new FunctionBodyNode(yyvsp[-1].srcs);
    19881989                                     DBG(yyval.body, yylsp[-2], yylsp[0]);;
    19891990    break;}
    19901991case 190:
    1991 #line 614 "grammar.y"
     1992#line 615 "grammar.y"
    19921993{ yyval.prog = new ProgramNode(0L);
    19931994                                     Parser::progNode = yyval.prog; ;
    19941995    break;}
    19951996case 191:
    1996 #line 616 "grammar.y"
     1997#line 617 "grammar.y"
    19971998{ yyval.prog = new ProgramNode(yyvsp[0].srcs);
    19981999                                     Parser::progNode = yyval.prog; ;
    19992000    break;}
    20002001case 192:
    2001 #line 621 "grammar.y"
     2002#line 622 "grammar.y"
    20022003{ yyval.srcs = new SourceElementsNode(yyvsp[0].src); ;
    20032004    break;}
    20042005case 193:
    2005 #line 622 "grammar.y"
     2006#line 623 "grammar.y"
    20062007{ yyval.srcs = new SourceElementsNode(yyvsp[-1].srcs, yyvsp[0].src); ;
    20072008    break;}
    20082009case 194:
    2009 #line 626 "grammar.y"
     2010#line 627 "grammar.y"
    20102011{ yyval.src = new SourceElementNode(yyvsp[0].stat); ;
    20112012    break;}
    20122013case 195:
    2013 #line 627 "grammar.y"
     2014#line 628 "grammar.y"
    20142015{ yyval.src = new SourceElementNode(yyvsp[0].func); ;
    20152016    break;}
     
    22372238  return 1;
    22382239}
    2239 #line 630 "grammar.y"
     2240#line 631 "grammar.y"
    22402241
    22412242
  • trunk/JavaScriptCore/kjs/grammar.y

    r903 r1024  
    237237  | CallExpr Arguments             { $$ = new FunctionCallNode($1, $2); }
    238238  | CallExpr '[' Expr ']'          { $$ = new AccessorNode1($1, $3); }
    239   | CallExpr '.' IDENT             { $$ = new AccessorNode2($1, $3); }
     239  | CallExpr '.' IDENT             { $$ = new AccessorNode2($1, $3);
     240                                     delete $3; }
    240241;
    241242
  • trunk/JavaScriptCore/kjs/internal.cpp

    r931 r1024  
    2222 */
    2323
    24 #include <config.h>
    25 
    2624#include <stdio.h>
    2725#include <math.h>
     
    475473  clear();
    476474  delete hook;
     475
     476  if ( emptyList == this )
     477    emptyList = 0L;
    477478}
    478479
     
    758759  BooleanImp::staticFalse->setGcAllowed();
    759760  BooleanImp::staticFalse = 0L;
    760 #ifdef APPLE_CHANGES
    761   ListImp::emptyList->setGcAllowed();
    762   ListImp::emptyList->deref();
    763   ListImp::emptyList = 0;
    764 #endif
    765761}
    766762
     
    787783
    788784  // initialize properties of the global object
    789 
     785  initGlobalObject();
     786
     787  recursion = 0;
     788}
     789
     790void InterpreterImp::initGlobalObject()
     791{
    790792  // Contructor prototype objects (Object.prototype, Array.prototype etc)
    791793
     
    910912  // built-in objects
    911913  global.put(globExec,"Math", Object(new MathObjectImp(globExec,objProto)), DontEnum);
    912 
    913   recursion = 0;
    914914}
    915915
  • trunk/JavaScriptCore/kjs/internal.h

    r798 r1024  
    350350    Interpreter* interpreter() const { return m_interpreter; }
    351351
     352    void initGlobalObject();
     353
    352354    void mark();
    353355
  • trunk/JavaScriptCore/kjs/interpreter.cpp

    r798 r1024  
    2020 *  Boston, MA 02111-1307, USA.
    2121 *
    22  *  $Id$
    2322 */
    2423
     
    113112{
    114113  return rep->globalObject();
     114}
     115
     116void Interpreter::initGlobalObject()
     117{
     118  rep->initGlobalObject();
    115119}
    116120
     
    365369}
    366370
     371void Interpreter::virtual_hook( int, void* )
     372{ /*BASE::virtual_hook( id, data );*/ }
  • trunk/JavaScriptCore/kjs/interpreter.h

    r798 r1024  
    2020 *  Boston, MA 02111-1307, USA.
    2121 *
    22  *  $Id$
    2322 */
    2423
     
    115114   * interpreter has a global object which is used for the purposes of code
    116115   * evaluation, and also provides access to built-in properties such as
    117    " Object" and "Number".
     116   * " Object" and "Number".
    118117   */
    119118  class Interpreter {
     
    149148    Object globalObject() const;
    150149
     150    void initGlobalObject();
     151
    151152    /**
    152153     * Returns the execution state object which can be used to execute
     
    205206    Object builtinObject() const;
    206207
    207     /** Returns the builtin "Function" object. */
     208    /**
     209     * Returns the builtin "Function" object.
     210     */
    208211    Object builtinFunction() const;
    209212
    210     /** Returns the builtin "Array" object. */
     213    /**
     214     * Returns the builtin "Array" object.
     215     */
    211216    Object builtinArray() const;
    212217
    213218
    214     /** Returns the builtin "Boolean" object. */
     219    /**
     220     * Returns the builtin "Boolean" object.
     221     */
    215222    Object builtinBoolean() const;
    216223
    217     /** Returns the builtin "String" object. */
     224    /**
     225     * Returns the builtin "String" object.
     226     */
    218227    Object builtinString() const;
    219228
    220     /** Returns the builtin "Number" object. */
     229    /**
     230     * Returns the builtin "Number" object.
     231     */
    221232    Object builtinNumber() const;
    222233
    223     /** Returns the builtin "Date" object. */
     234    /**
     235     * Returns the builtin "Date" object.
     236     */
    224237    Object builtinDate() const;
    225238
    226     /** Returns the builtin "RegExp" object. */
     239    /**
     240     * Returns the builtin "RegExp" object.
     241     */
    227242    Object builtinRegExp() const;
    228243
    229     /** Returns the builtin "Error" object. */
     244    /**
     245     * Returns the builtin "Error" object.
     246     */
    230247    Object builtinError() const;
    231248
    232     /** Returns the builtin "Object.prototype" object. */
     249    /**
     250     * Returns the builtin "Object.prototype" object.
     251     */
    233252    Object builtinObjectPrototype() const;
    234253
    235     /** Returns the builtin "Function.prototype" object. */
     254    /**
     255     * Returns the builtin "Function.prototype" object.
     256     */
    236257    Object builtinFunctionPrototype() const;
    237258
    238     /** Returns the builtin "Array.prototype" object. */
     259    /**
     260     * Returns the builtin "Array.prototype" object.
     261     */
    239262    Object builtinArrayPrototype() const;
    240263
    241     /** Returns the builtin "Boolean.prototype" object. */
     264    /**
     265     * Returns the builtin "Boolean.prototype" object.
     266     */
    242267    Object builtinBooleanPrototype() const;
    243268
    244     /** Returns the builtin "String.prototype" object. */
     269    /**
     270     * Returns the builtin "String.prototype" object.
     271     */
    245272    Object builtinStringPrototype() const;
    246273
    247     /** Returns the builtin "Number.prototype" object. */
     274    /**
     275     * Returns the builtin "Number.prototype" object.
     276     */
    248277    Object builtinNumberPrototype() const;
    249278
    250     /** Returns the builtin "Date.prototype" object. */
     279    /**
     280     * Returns the builtin "Date.prototype" object.
     281     */
    251282    Object builtinDatePrototype() const;
    252283
    253     /** Returns the builtin "RegExp.prototype" object. */
     284    /**
     285     * Returns the builtin "RegExp.prototype" object.
     286     */
    254287    Object builtinRegExpPrototype() const;
    255288
    256     /** Returns the builtin "Error.prototype" object. */
     289    /**
     290     * Returns the builtin "Error.prototype" object.
     291     */
    257292    Object builtinErrorPrototype() const;
    258293
    259     /** The initial value of "Error" global property */
     294    /**
     295     * The initial value of "Error" global property
     296     */
    260297    Object builtinEvalError() const;
    261298    Object builtinRangeError() const;
     
    318355     */
    319356    Interpreter operator=(const Interpreter&);
     357  protected:
     358    virtual void virtual_hook( int id, void* data );
    320359  };
    321360
  • trunk/JavaScriptCore/kjs/lexer.cpp

    r798 r1024  
    1919 *  Boston, MA 02111-1307, USA.
    2020 *
    21  *  $Id$
    2221 */
    2322
     
    5352#include "lexer.lut.h"
    5453
    55 extern YYLTYPE yylloc;  // global bison variable holding token info
     54extern YYLTYPE yylloc; // global bison variable holding token info
    5655
    5756// a bridge for yacc from the C world to C++
     
    6261
    6362Lexer::Lexer()
    64   : yylineno(0),
     63  : yylineno(1),
    6564    size8(128), size16(128), restrKeyword(false),
    6665    eatNextIdentifier(false), stackToken(-1), lastToken(-1), pos(0),
     
    9594void Lexer::setCode(const UChar *c, unsigned int len)
    9695{
    97   yylineno = 0;
     96  yylineno = 1;
    9897  restrKeyword = false;
    9998  delimited = false;
     
    126125    next3 = (pos + 3 < length) ? code[pos+3].unicode() : 0;
    127126  }
     127}
     128
     129// called on each new line
     130void Lexer::nextLine()
     131{
     132  yylineno++;
     133#ifndef KJS_PURE_ECMA
     134  bol = true;
     135#endif
    128136}
    129137
     
    167175    case Start:
    168176      if (isWhiteSpace()) {
    169         // do nothing
     177        // do nothing
    170178      } else if (current == '/' && next1 == '/') {
    171         shift(1);
    172         state = InSingleLineComment;
     179        shift(1);
     180        state = InSingleLineComment;
    173181      } else if (current == '/' && next1 == '*') {
    174         shift(1);
    175         state = InMultiLineComment;
     182        shift(1);
     183        state = InMultiLineComment;
    176184      } else if (current == 0) {
    177         if (!terminator && !delimited) {
    178           // automatic semicolon insertion if program incomplete
    179           token = ';';
    180           stackToken = 0;
    181           setDone(Other);
    182         } else
    183           setDone(Eof);
     185        if (!terminator && !delimited) {
     186          // automatic semicolon insertion if program incomplete
     187          token = ';';
     188          stackToken = 0;
     189          setDone(Other);
     190        } else
     191          setDone(Eof);
    184192      } else if (isLineTerminator()) {
    185         yylineno++;
     193        nextLine();
     194        terminator = true;
     195        if (restrKeyword) {
     196          token = ';';
     197          setDone(Other);
     198        }
     199      } else if (current == '"' || current == '\'') {
     200        state = InString;
     201        stringType = current;
     202      } else if (isIdentLetter(current)) {
     203        record16(current);
     204        state = InIdentifier;
     205      } else if (current == '0') {
     206        record8(current);
     207        state = InNum0;
     208      } else if (isDecimalDigit(current)) {
     209        record8(current);
     210        state = InNum;
     211      } else if (current == '.' && isDecimalDigit(next1)) {
     212        record8(current);
     213        state = InDecimal;
    186214#ifndef KJS_PURE_ECMA
    187         bol = true;
    188 #endif
    189         terminator = true;
    190         if (restrKeyword) {
    191           token = ';';
    192           setDone(Other);
    193         }
    194       } else if (current == '"' || current == '\'') {
    195         state = InString;
    196         stringType = current;
    197       } else if (isIdentLetter(current)) {
    198         record16(current);
    199         state = InIdentifier;
    200       } else if (current == '0') {
    201         record8(current);
    202         state = InNum0;
    203       } else if (isDecimalDigit(current)) {
    204         record8(current);
    205         state = InNum;
    206       } else if (current == '.' && isDecimalDigit(next1)) {
    207         record8(current);
    208         state = InDecimal;
    209 #ifndef KJS_PURE_ECMA
    210         // <!-- marks the beginning of a line comment (for www usage)
    211       } else if (bol && current == '<' && next1 == '!' &&
    212                  next2 == '-' && next3 == '-') {
    213         shift(3);
    214         state = InSingleLineComment;
    215         // same of -->
     215        // <!-- marks the beginning of a line comment (for www usage)
     216      } else if (current == '<' && next1 == '!' &&
     217                 next2 == '-' && next3 == '-') {
     218        shift(3);
     219        state = InSingleLineComment;
     220        // same for -->
    216221      } else if (bol && current == '-' && next1 == '-' &&  next2 == '>') {
    217         shift(2);
    218         state = InSingleLineComment;
     222        shift(2);
     223        state = InSingleLineComment;
    219224#endif
    220225      } else {
    221         token = matchPunctuator(current, next1, next2, next3);
    222         if (token != -1) {
    223           setDone(Other);
    224         } else {
    225           //      cerr << "encountered unknown character" << endl;
    226           setDone(Bad);
    227         }
     226        token = matchPunctuator(current, next1, next2, next3);
     227        if (token != -1) {
     228          setDone(Other);
     229        } else {
     230          //      cerr << "encountered unknown character" << endl;
     231          setDone(Bad);
     232        }
    228233      }
    229234      break;
    230235    case InString:
    231236      if (current == stringType) {
    232         shift(1);
    233         setDone(String);
     237        shift(1);
     238        setDone(String);
    234239      } else if (current == 0 || isLineTerminator()) {
    235         setDone(Bad);
     240        setDone(Bad);
    236241      } else if (current == '\\') {
    237         state = InEscapeSequence;
     242        state = InEscapeSequence;
    238243      } else {
    239         record16(current);
     244        record16(current);
    240245      }
    241246      break;
     
    243248    case InEscapeSequence:
    244249      if (isOctalDigit(current)) {
    245         if (current >= '0' && current <= '3' &&
    246             isOctalDigit(next1) && isOctalDigit(next2)) {
    247           record16(convertOctal(current, next1, next2));
    248           shift(2);
    249           state = InString;
    250         } else if (isOctalDigit(current) && isOctalDigit(next1)) {
    251           record16(convertOctal('0', current, next1));
    252           shift(1);
    253           state = InString;
    254         } else if (isOctalDigit(current)) {
    255           record16(convertOctal('0', '0', current));
    256           state = InString;
    257         } else {
    258           setDone(Bad);
    259         }
     250        if (current >= '0' && current <= '3' &&
     251            isOctalDigit(next1) && isOctalDigit(next2)) {
     252          record16(convertOctal(current, next1, next2));
     253          shift(2);
     254          state = InString;
     255        } else if (isOctalDigit(current) && isOctalDigit(next1)) {
     256          record16(convertOctal('0', current, next1));
     257          shift(1);
     258          state = InString;
     259        } else if (isOctalDigit(current)) {
     260          record16(convertOctal('0', '0', current));
     261          state = InString;
     262        } else {
     263          setDone(Bad);
     264        }
    260265      } else if (current == 'x')
    261         state = InHexEscape;
     266        state = InHexEscape;
    262267      else if (current == 'u')
    263         state = InUnicodeEscape;
     268        state = InUnicodeEscape;
    264269      else {
    265         record16(singleEscape(current));
    266         state = InString;
     270        record16(singleEscape(current));
     271        state = InString;
    267272      }
    268273      break;
    269274    case InHexEscape:
    270275      if (isHexDigit(current) && isHexDigit(next1)) {
    271         state = InString;
    272         record16(convertHex(current, next1));
    273         shift(1);
     276        state = InString;
     277        record16(convertHex(current, next1));
     278        shift(1);
    274279      } else if (current == stringType) {
    275         record16('x');
    276         shift(1);
    277         setDone(String);
     280        record16('x');
     281        shift(1);
     282        setDone(String);
    278283      } else {
    279         record16('x');
    280         record16(current);
    281         state = InString;
     284        record16('x');
     285        record16(current);
     286        state = InString;
    282287      }
    283288      break;
    284289    case InUnicodeEscape:
    285290      if (isHexDigit(current) && isHexDigit(next1) &&
    286           isHexDigit(next2) && isHexDigit(next3)) {
    287         record16(convertUnicode(current, next1, next2, next3));
    288         shift(3);
    289         state = InString;
     291          isHexDigit(next2) && isHexDigit(next3)) {
     292        record16(convertUnicode(current, next1, next2, next3));
     293        shift(3);
     294        state = InString;
    290295      } else if (current == stringType) {
    291         record16('u');
    292         shift(1);
    293         setDone(String);
     296        record16('u');
     297        shift(1);
     298        setDone(String);
    294299      } else {
    295         setDone(Bad);
     300        setDone(Bad);
    296301      }
    297302      break;
    298303    case InSingleLineComment:
    299304      if (isLineTerminator()) {
    300         yylineno++;
    301         terminator = true;
    302 #ifndef KJS_PURE_ECMA
    303         bol = true;
    304 #endif
    305         if (restrKeyword) {
    306           token = ';';
    307           setDone(Other);
    308         } else
    309           state = Start;
     305        nextLine();
     306        terminator = true;
     307        if (restrKeyword) {
     308          token = ';';
     309          setDone(Other);
     310        } else
     311          state = Start;
    310312      } else if (current == 0) {
    311         setDone(Eof);
     313        setDone(Eof);
    312314      }
    313315      break;
    314316    case InMultiLineComment:
    315317      if (current == 0) {
    316         setDone(Bad);
     318        setDone(Bad);
    317319      } else if (isLineTerminator()) {
    318         yylineno++;
     320        nextLine();
    319321      } else if (current == '*' && next1 == '/') {
    320         state = Start;
    321         shift(1);
     322        state = Start;
     323        shift(1);
    322324      }
    323325      break;
    324326    case InIdentifier:
    325327      if (isIdentLetter(current) || isDecimalDigit(current)) {
    326         record16(current);
    327         break;
     328        record16(current);
     329        break;
    328330      }
    329331      setDone(Identifier);
     
    331333    case InNum0:
    332334      if (current == 'x' || current == 'X') {
    333         record8(current);
    334         state = InHex;
     335        record8(current);
     336        state = InHex;
    335337      } else if (current == '.') {
    336         record8(current);
    337         state = InDecimal;
     338        record8(current);
     339        state = InDecimal;
    338340      } else if (current == 'e' || current == 'E') {
    339         record8(current);
    340         state = InExponentIndicator;
     341        record8(current);
     342        state = InExponentIndicator;
    341343      } else if (isOctalDigit(current)) {
    342         record8(current);
    343         state = InOctal;
     344        record8(current);
     345        state = InOctal;
    344346      } else if (isDecimalDigit(current)) {
    345347        record8(current);
    346348        state = InDecimal;
    347349      } else {
    348         setDone(Number);
     350        setDone(Number);
    349351      }
    350352      break;
    351353    case InHex:
    352354      if (isHexDigit(current)) {
    353         record8(current);
     355        record8(current);
    354356      } else {
    355         setDone(Hex);
     357        setDone(Hex);
    356358      }
    357359      break;
    358360    case InOctal:
    359361      if (isOctalDigit(current)) {
    360         record8(current);
     362        record8(current);
    361363      }
    362364      else if (isDecimalDigit(current)) {
     
    364366        state = InDecimal;
    365367      } else
    366         setDone(Octal);
     368        setDone(Octal);
    367369      break;
    368370    case InNum:
    369371      if (isDecimalDigit(current)) {
    370         record8(current);
     372        record8(current);
    371373      } else if (current == '.') {
    372         record8(current);
    373         state = InDecimal;
     374        record8(current);
     375        state = InDecimal;
    374376      } else if (current == 'e' || current == 'E') {
    375         record8(current);
    376         state = InExponentIndicator;
     377        record8(current);
     378        state = InExponentIndicator;
    377379      } else
    378         setDone(Number);
     380        setDone(Number);
    379381      break;
    380382    case InDecimal:
    381383      if (isDecimalDigit(current)) {
    382         record8(current);
     384        record8(current);
    383385      } else if (current == 'e' || current == 'E') {
    384         record8(current);
    385         state = InExponentIndicator;
     386        record8(current);
     387        state = InExponentIndicator;
    386388      } else
    387         setDone(Number);
     389        setDone(Number);
    388390      break;
    389391    case InExponentIndicator:
    390392      if (current == '+' || current == '-') {
    391         record8(current);
     393        record8(current);
    392394      } else if (isDecimalDigit(current)) {
    393         record8(current);
    394         state = InExponent;
     395        record8(current);
     396        state = InExponent;
    395397      } else
    396         setDone(Bad);
     398        setDone(Bad);
    397399      break;
    398400    case InExponent:
    399401      if (isDecimalDigit(current)) {
    400         record8(current);
     402        record8(current);
    401403      } else
    402         setDone(Number);
     404        setDone(Number);
    403405      break;
    404406    default:
     
    506508
    507509    if (token == CONTINUE || token == BREAK ||
    508         token == RETURN || token == THROW)
     510        token == RETURN || token == THROW)
    509511      restrKeyword = true;
    510512    break;
     
    531533{
    532534  return (current == ' ' || current == '\t' ||
    533           current == 0x0b || current == 0x0c);
     535          current == 0x0b || current == 0x0c);
    534536}
    535537
     
    549551  /* TODO: allow other legitimate unicode chars */
    550552  return (c >= 'a' && c <= 'z' ||
    551           c >= 'A' && c <= 'Z' ||
    552           c == '$' || c == '_');
     553          c >= 'A' && c <= 'Z' ||
     554          c == '$' || c == '_');
    553555}
    554556
     
    561563{
    562564  return (c >= '0' && c <= '9' ||
    563           c >= 'a' && c <= 'f' ||
    564           c >= 'A' && c <= 'F');
     565          c >= 'a' && c <= 'f' ||
     566          c >= 'A' && c <= 'F');
    565567}
    566568
     
    571573
    572574int Lexer::matchPunctuator(unsigned short c1, unsigned short c2,
    573                               unsigned short c3, unsigned short c4)
     575                              unsigned short c3, unsigned short c4)
    574576{
    575577  if (c1 == '>' && c2 == '>' && c3 == '>' && c4 == '=') {
     
    736738{
    737739  return UChar((convertHex(c1) << 4) + convertHex(c2),
    738                (convertHex(c3) << 4) + convertHex(c4));
     740               (convertHex(c3) << 4) + convertHex(c4));
    739741}
    740742
  • trunk/JavaScriptCore/kjs/lexer.h

    r798 r1024  
    1919 *  Boston, MA 02111-1307, USA.
    2020 *
    21  *  $Id$
    2221 */
    2322
     
    4544
    4645    enum State { Start,
    47                 Identifier,
    48                 InIdentifier,
    49                 InSingleLineComment,
    50                 InMultiLineComment,
    51                 InNum,
    52                 InNum0,
    53                 InHex,
    54                 InOctal,
    55                 InDecimal,
    56                 InExponentIndicator,
    57                 InExponent,
    58                 Hex,
    59                 Octal,
    60                 Number,
    61                 String,
    62                 Eof,
    63                 InString,
    64                 InEscapeSequence,
    65                 InHexEscape,
    66                 InUnicodeEscape,
    67                 Other,
    68                 Bad };
     46                Identifier,
     47                InIdentifier,
     48                InSingleLineComment,
     49                InMultiLineComment,
     50                InNum,
     51                InNum0,
     52                InHex,
     53                InOctal,
     54                InDecimal,
     55                InExponentIndicator,
     56                InExponent,
     57                Hex,
     58                Octal,
     59                Number,
     60                String,
     61                Eof,
     62                InString,
     63                InEscapeSequence,
     64                InHexEscape,
     65                InUnicodeEscape,
     66                Other,
     67                Bad };
    6968
    7069    bool scanRegExp();
     
    9291    unsigned int pos;
    9392    void shift(unsigned int p);
     93    void nextLine();
    9494    int lookupKeyword(const char *);
    9595
     
    100100
    101101    int matchPunctuator(unsigned short c1, unsigned short c2,
    102                         unsigned short c3, unsigned short c4);
     102                        unsigned short c3, unsigned short c4);
    103103    unsigned short singleEscape(unsigned short c) const;
    104104    unsigned short convertOctal(unsigned short c1, unsigned short c2,
     
    108108    static unsigned char convertHex(unsigned short c1, unsigned short c2);
    109109    static UChar convertUnicode(unsigned short c1, unsigned short c2,
    110                                 unsigned short c3, unsigned short c4);
     110                                unsigned short c3, unsigned short c4);
    111111    static bool isIdentLetter(unsigned short c);
    112112    static bool isDecimalDigit(unsigned short c);
  • trunk/JavaScriptCore/kjs/lookup.cpp

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
  • trunk/JavaScriptCore/kjs/lookup.h

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
     
    3433   */
    3534  struct HashEntry {
    36     /** s is the key (e.g. a property name) */
     35    /**
     36     * s is the key (e.g. a property name)
     37     */
    3738    const char *s;
    38     /** value is the result value (usually an enum value) */
     39    /**
     40     * value is the result value (usually an enum value)
     41     */
    3942    int value;
    40     /** attr is a set for flags (e.g. the property flags, see object.h) */
     43    /**
     44     * attr is a set for flags (e.g. the property flags, see object.h)
     45     */
    4146    short int attr;
    42     /** params is another number. For property hashtables, it is used to
    43         denote the number of argument of the function */
     47    /**
     48     * params is another number. For property hashtables, it is used to
     49     * denote the number of argument of the function
     50     */
    4451    short int params;
    45     /** next is the pointer to the next entry for the same hash value */
     52    /**
     53     * next is the pointer to the next entry for the same hash value
     54     */
    4655    const HashEntry *next;
    4756  };
     
    5968   */
    6069  struct HashTable {
    61     /** type is a version number. Currently always 2 */
     70    /**
     71     * type is a version number. Currently always 2
     72     */
    6273    int type;
    63     /** size is the total number of entries in the hashtable, including the null entries,
     74    /**
     75     * size is the total number of entries in the hashtable, including the null entries,
    6476     * i.e. the size of the "entries" array.
    65      * Used to iterate over all entries in the table */
     77     * Used to iterate over all entries in the table
     78     */
    6679    int size;
    67     /** pointer to the array of entries
    68      * Mind that some entries in the array are null (0,0,0,0). */
     80    /**
     81     * pointer to the array of entries
     82     * Mind that some entries in the array are null (0,0,0,0).
     83     */
    6984    const HashEntry *entries;
    70     /** the maximum value for the hash. Always smaller than size. */
     85    /**
     86     * the maximum value for the hash. Always smaller than size.
     87     */
    7188    int hashSize;
    7289  };
     
    7794  class Lookup {
    7895  public:
    79     /** Find an entry in the table, and return its value (i.e. the value field of HashEntry) */
     96    /**
     97     * Find an entry in the table, and return its value (i.e. the value field of HashEntry)
     98     */
    8099    static int find(const struct HashTable *table, const UString &s);
    81100    static int find(const struct HashTable *table,
     
    92111                                      const UChar *c, unsigned int len);
    93112
    94     /** Calculate the hash value for a given key */
     113    /**
     114     * Calculate the hash value for a given key
     115     */
    95116    static unsigned int hash(const UString &key);
    96117    static unsigned int hash(const UChar *c, unsigned int len);
     
    100121  class ExecState;
    101122  class UString;
    102   /** @internal
    103    * Helper for lookupFunction and lookupValueOrFunction */
     123  /**
     124   * @internal
     125   * Helper for lookupFunction and lookupValueOrFunction
     126   */
    104127  template <class FuncImp>
    105128  inline Value lookupOrCreateFunction(ExecState *exec, const UString &propertyName,
  • trunk/JavaScriptCore/kjs/math_object.cpp

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
     
    3534#include "math_object.lut.h"
    3635
     36#ifndef M_PI
     37#define M_PI 3.14159265358979323846
     38#endif  /*  M_PI  */
     39
    3740using namespace KJS;
    3841
     
    4346/* Source for math_object.lut.h
    4447@begin mathTable 21
    45   E             MathObjectImp::Euler    DontEnum
    46   LN2           MathObjectImp::Ln2      DontEnum
    47   LN10          MathObjectImp::Ln10     DontEnum
    48   LOG2E         MathObjectImp::Log2E    DontEnum
    49   LOG10E        MathObjectImp::Log10E   DontEnum
    50   PI            MathObjectImp::Pi       DontEnum
    51   SQRT1_2       MathObjectImp::Sqrt1_2  DontEnum
    52   SQRT2         MathObjectImp::Sqrt2    DontEnum
    53   abs           MathObjectImp::Abs      DontEnum|Function 1
    54   acos          MathObjectImp::ACos     DontEnum|Function 1
    55   asin          MathObjectImp::ASin     DontEnum|Function 1
    56   atan          MathObjectImp::ATan     DontEnum|Function 1
    57   atan2         MathObjectImp::ATan2    DontEnum|Function 2
    58   ceil          MathObjectImp::Ceil     DontEnum|Function 1
    59   cos           MathObjectImp::Cos      DontEnum|Function 1
    60   exp           MathObjectImp::Exp      DontEnum|Function 1
    61   floor         MathObjectImp::Floor    DontEnum|Function 1
    62   log           MathObjectImp::Log      DontEnum|Function 1
    63   max           MathObjectImp::Max      DontEnum|Function 2
    64   min           MathObjectImp::Min      DontEnum|Function 2
    65   pow           MathObjectImp::Pow      DontEnum|Function 2
    66   random        MathObjectImp::Random   DontEnum|Function 0
    67   round         MathObjectImp::Round    DontEnum|Function 1
    68   sin           MathObjectImp::Sin      DontEnum|Function 1
    69   sqrt          MathObjectImp::Sqrt     DontEnum|Function 1
    70   tan           MathObjectImp::Tan      DontEnum|Function 1
     48  E             MathObjectImp::Euler    DontEnum|DontDelete|ReadOnly
     49  LN2           MathObjectImp::Ln2      DontEnum|DontDelete|ReadOnly
     50  LN10          MathObjectImp::Ln10     DontEnum|DontDelete|ReadOnly
     51  LOG2E         MathObjectImp::Log2E    DontEnum|DontDelete|ReadOnly
     52  LOG10E        MathObjectImp::Log10E   DontEnum|DontDelete|ReadOnly
     53  PI            MathObjectImp::Pi       DontEnum|DontDelete|ReadOnly
     54  SQRT1_2       MathObjectImp::Sqrt1_2  DontEnum|DontDelete|ReadOnly
     55  SQRT2         MathObjectImp::Sqrt2    DontEnum|DontDelete|ReadOnly
     56  abs           MathObjectImp::Abs      DontEnum|Function 1
     57  acos          MathObjectImp::ACos     DontEnum|Function 1
     58  asin          MathObjectImp::ASin     DontEnum|Function 1
     59  atan          MathObjectImp::ATan     DontEnum|Function 1
     60  atan2         MathObjectImp::ATan2    DontEnum|Function 2
     61  ceil          MathObjectImp::Ceil     DontEnum|Function 1
     62  cos           MathObjectImp::Cos      DontEnum|Function 1
     63  exp           MathObjectImp::Exp      DontEnum|Function 1
     64  floor         MathObjectImp::Floor    DontEnum|Function 1
     65  log           MathObjectImp::Log      DontEnum|Function 1
     66  max           MathObjectImp::Max      DontEnum|Function 2
     67  min           MathObjectImp::Min      DontEnum|Function 2
     68  pow           MathObjectImp::Pow      DontEnum|Function 2
     69  random        MathObjectImp::Random   DontEnum|Function 0
     70  round         MathObjectImp::Round    DontEnum|Function 1
     71  sin           MathObjectImp::Sin      DontEnum|Function 1
     72  sqrt          MathObjectImp::Sqrt     DontEnum|Function 1
     73  tan           MathObjectImp::Tan      DontEnum|Function 1
    7174@end
    7275*/
     
    104107    break;
    105108  case Pi:
    106     d = 2.0 * asin(1.0);
     109    d = M_PI;
    107110    break;
    108111  case Sqrt1_2:
  • trunk/JavaScriptCore/kjs/math_object.h

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
  • trunk/JavaScriptCore/kjs/math_object.lut.h

    r901 r1024  
    88   { "atan", MathObjectImp::ATan, DontEnum|Function, 1, &mathTableEntries[25] },
    99   { 0, 0, 0, 0, 0 },
    10    { "SQRT2", MathObjectImp::Sqrt2, DontEnum, 0, &mathTableEntries[23] },
     10   { "SQRT2", MathObjectImp::Sqrt2, DontEnum|DontDelete|ReadOnly, 0, &mathTableEntries[23] },
    1111   { 0, 0, 0, 0, 0 },
    1212   { 0, 0, 0, 0, 0 },
    1313   { 0, 0, 0, 0, 0 },
    14    { "E", MathObjectImp::Euler, DontEnum, 0, &mathTableEntries[21] },
     14   { "E", MathObjectImp::Euler, DontEnum|DontDelete|ReadOnly, 0, &mathTableEntries[21] },
    1515   { "asin", MathObjectImp::ASin, DontEnum|Function, 1, &mathTableEntries[26] },
    1616   { "atan2", MathObjectImp::ATan2, DontEnum|Function, 2, &mathTableEntries[32] },
    17    { "LOG2E", MathObjectImp::Log2E, DontEnum, 0, &mathTableEntries[27] },
     17   { "LOG2E", MathObjectImp::Log2E, DontEnum|DontDelete|ReadOnly, 0, &mathTableEntries[27] },
    1818   { "cos", MathObjectImp::Cos, DontEnum|Function, 1, 0 },
    1919   { "max", MathObjectImp::Max, DontEnum|Function, 2, &mathTableEntries[29] },
    2020   { 0, 0, 0, 0, 0 },
    2121   { 0, 0, 0, 0, 0 },
    22    { "LOG10E", MathObjectImp::Log10E, DontEnum, 0, &mathTableEntries[24] },
    23    { "LN2", MathObjectImp::Ln2, DontEnum, 0, &mathTableEntries[31] },
     22   { "LOG10E", MathObjectImp::Log10E, DontEnum|DontDelete|ReadOnly, 0, &mathTableEntries[24] },
     23   { "LN2", MathObjectImp::Ln2, DontEnum|DontDelete|ReadOnly, 0, &mathTableEntries[31] },
    2424   { "abs", MathObjectImp::Abs, DontEnum|Function, 1, 0 },
    2525   { "sqrt", MathObjectImp::Sqrt, DontEnum|Function, 1, 0 },
    2626   { "exp", MathObjectImp::Exp, DontEnum|Function, 1, 0 },
    2727   { 0, 0, 0, 0, 0 },
    28    { "LN10", MathObjectImp::Ln10, DontEnum, 0, &mathTableEntries[22] },
    29    { "PI", MathObjectImp::Pi, DontEnum, 0, &mathTableEntries[28] },
    30    { "SQRT1_2", MathObjectImp::Sqrt1_2, DontEnum, 0, 0 },
     28   { "LN10", MathObjectImp::Ln10, DontEnum|DontDelete|ReadOnly, 0, &mathTableEntries[22] },
     29   { "PI", MathObjectImp::Pi, DontEnum|DontDelete|ReadOnly, 0, &mathTableEntries[28] },
     30   { "SQRT1_2", MathObjectImp::Sqrt1_2, DontEnum|DontDelete|ReadOnly, 0, 0 },
    3131   { "acos", MathObjectImp::ACos, DontEnum|Function, 1, 0 },
    3232   { "ceil", MathObjectImp::Ceil, DontEnum|Function, 1, 0 },
  • trunk/JavaScriptCore/kjs/nodes.cpp

    r941 r1024  
    2424#include "nodes.h"
    2525
     26//#include <iostream>
     27#include <math.h>
    2628#include <assert.h>
    27 #ifdef APPLE_CHANGES
    28 #include <iostream>
    29 #else
    30 #include <iostream.h>
    31 #endif
    32 #include <math.h>
     29#ifdef KJS_DEBUG_MEM
    3330#include <stdio.h>
    34 #ifdef KJS_DEBUG_MEM
    3531#include <typeinfo>
    3632#endif
     
    25422538  CaseClauseNode *clause;
    25432539
    2544   if (a) {
    25452540    while (a) {
    25462541      clause = a->clause();
     
    25612556      }
    25622557    }
    2563   }
    25642558
    25652559  while (b) {
     
    29472941  /* TODO: workaround for empty body which I don't see covered by the spec */
    29482942  if (!source)
    2949     return Completion(ReturnValue, Undefined());
     2943    return Completion(Normal);
    29502944
    29512945  source->processFuncDecl(exec);
  • trunk/JavaScriptCore/kjs/nodes.h

    r798 r1024  
    2020 *  Boston, MA 02111-1307, USA.
    2121 *
    22  *  $Id$
    2322 */
    2423
     
    3938  class SourceElementsNode;
    4039  class ProgramNode;
     40  class SourceStream;
    4141
    4242  enum Operator { OpEqual,
     
    7676    virtual ~Node();
    7777    virtual Value evaluate(ExecState *exec) = 0;
     78    UString toString() const;
     79    virtual void streamTo(SourceStream &s) const = 0;
    7880    virtual void processVarDecls(ExecState */*exec*/) {}
    7981    int lineNo() const { return line; }
     
    134136    NullNode() {}
    135137    Value evaluate(ExecState *exec);
     138    virtual void streamTo(SourceStream &s) const;
    136139  };
    137140
     
    140143    BooleanNode(bool v) : value(v) {}
    141144    Value evaluate(ExecState *exec);
     145    virtual void streamTo(SourceStream &s) const;
    142146  private:
    143147    bool value;
     
    148152    NumberNode(double v) : value(v) { }
    149153    Value evaluate(ExecState *exec);
     154    virtual void streamTo(SourceStream &s) const;
    150155  private:
    151156    double value;
     
    156161    StringNode(const UString *v) { value = *v; }
    157162    Value evaluate(ExecState *exec);
     163    virtual void streamTo(SourceStream &s) const;
    158164  private:
    159165    UString value;
     
    165171      : pattern(p), flags(f) { }
    166172    Value evaluate(ExecState *exec);
     173    virtual void streamTo(SourceStream &s) const;
    167174  private:
    168175    UString pattern, flags;
     
    173180    ThisNode() {}
    174181    Value evaluate(ExecState *exec);
     182    virtual void streamTo(SourceStream &s) const;
    175183  };
    176184
     
    179187    ResolveNode(const UString *s) : ident(*s) { }
    180188    Value evaluate(ExecState *exec);
     189    virtual void streamTo(SourceStream &s) const;
    181190  private:
    182191    UString ident;
     
    190199    virtual ~GroupNode();
    191200    Value evaluate(ExecState *exec);
     201    virtual void streamTo(SourceStream &s) const { group->streamTo(s); }
    192202  private:
    193203    Node *group;
     
    201211    virtual ~ElisionNode();
    202212    Value evaluate(ExecState *exec);
     213    virtual void streamTo(SourceStream &s) const;
    203214  private:
    204215    ElisionNode *elision;
     
    207218  class ElementNode : public Node {
    208219  public:
    209     ElementNode(ElisionNode *e, Node *n) : list(0l), elision(e), node(n) { }
     220    ElementNode(ElisionNode *e, Node *n) : list(0L), elision(e), node(n) { }
    210221    ElementNode(ElementNode *l, ElisionNode *e, Node *n)
    211222      : list(l), elision(e), node(n) { }
     
    214225    virtual ~ElementNode();
    215226    Value evaluate(ExecState *exec);
     227    virtual void streamTo(SourceStream &s) const;
    216228  private:
    217229    ElementNode *list;
     
    231243    virtual ~ArrayNode();
    232244    Value evaluate(ExecState *exec);
     245    virtual void streamTo(SourceStream &s) const;
    233246  private:
    234247    ElementNode *element;
     
    244257    virtual ~ObjectLiteralNode();
    245258    Value evaluate(ExecState *exec);
     259    virtual void streamTo(SourceStream &s) const;
    246260  private:
    247261    Node *list;
     
    256270    virtual ~PropertyValueNode();
    257271    Value evaluate(ExecState *exec);
     272    virtual void streamTo(SourceStream &s) const;
    258273  private:
    259274    Node *name, *assign, *list;
     
    265280    PropertyNode(const UString *s) : str(*s) { }
    266281    Value evaluate(ExecState *exec);
     282    virtual void streamTo(SourceStream &s) const;
    267283  private:
    268284    double numeric;
     
    277293    virtual ~AccessorNode1();
    278294    Value evaluate(ExecState *exec);
     295    virtual void streamTo(SourceStream &s) const;
    279296  private:
    280297    Node *expr1;
     
    289306    virtual ~AccessorNode2();
    290307    Value evaluate(ExecState *exec);
     308    virtual void streamTo(SourceStream &s) const;
    291309  private:
    292310    Node *expr;
     
    303321    Value evaluate(ExecState *exec);
    304322    List evaluateList(ExecState *exec);
     323    virtual void streamTo(SourceStream &s) const;
    305324  private:
    306325    ArgumentListNode *list;
     
    316335    Value evaluate(ExecState *exec);
    317336    List evaluateList(ExecState *exec);
     337    virtual void streamTo(SourceStream &s) const;
    318338  private:
    319339    ArgumentListNode *list;
     
    328348    virtual ~NewExprNode();
    329349    Value evaluate(ExecState *exec);
     350    virtual void streamTo(SourceStream &s) const;
    330351  private:
    331352    Node *expr;
     
    340361    virtual ~FunctionCallNode();
    341362    Value evaluate(ExecState *exec);
     363    virtual void streamTo(SourceStream &s) const;
    342364  private:
    343365    Node *expr;
     
    352374    virtual ~PostfixNode();
    353375    Value evaluate(ExecState *exec);
     376    virtual void streamTo(SourceStream &s) const;
    354377  private:
    355378    Node *expr;
     
    364387    virtual ~DeleteNode();
    365388    Value evaluate(ExecState *exec);
     389    virtual void streamTo(SourceStream &s) const;
    366390  private:
    367391    Node *expr;
     
    375399    virtual ~VoidNode();
    376400    Value evaluate(ExecState *exec);
     401    virtual void streamTo(SourceStream &s) const;
    377402  private:
    378403    Node *expr;
     
    386411    virtual ~TypeOfNode();
    387412    Value evaluate(ExecState *exec);
     413    virtual void streamTo(SourceStream &s) const;
    388414  private:
    389415    Node *expr;
     
    397423    virtual ~PrefixNode();
    398424    Value evaluate(ExecState *exec);
     425    virtual void streamTo(SourceStream &s) const;
    399426  private:
    400427    Operator oper;
     
    409436    virtual ~UnaryPlusNode();
    410437    Value evaluate(ExecState *exec);
     438    virtual void streamTo(SourceStream &s) const;
    411439  private:
    412440    Node *expr;
     
    420448    virtual ~NegateNode();
    421449    Value evaluate(ExecState *exec);
     450    virtual void streamTo(SourceStream &s) const;
    422451  private:
    423452    Node *expr;
     
    431460    virtual ~BitwiseNotNode();
    432461    Value evaluate(ExecState *exec);
     462    virtual void streamTo(SourceStream &s) const;
    433463  private:
    434464    Node *expr;
     
    442472    virtual ~LogicalNotNode();
    443473    Value evaluate(ExecState *exec);
     474    virtual void streamTo(SourceStream &s) const;
    444475  private:
    445476    Node *expr;
     
    453484    virtual ~MultNode();
    454485    Value evaluate(ExecState *exec);
     486    virtual void streamTo(SourceStream &s) const;
    455487  private:
    456488    Node *term1, *term2;
     
    465497    virtual ~AddNode();
    466498    Value evaluate(ExecState *exec);
     499    virtual void streamTo(SourceStream &s) const;
    467500  private:
    468501    Node *term1, *term2;
     
    478511    virtual ~ShiftNode();
    479512    Value evaluate(ExecState *exec);
     513    virtual void streamTo(SourceStream &s) const;
    480514  private:
    481515    Node *term1, *term2;
     
    491525    virtual ~RelationalNode();
    492526    Value evaluate(ExecState *exec);
     527    virtual void streamTo(SourceStream &s) const;
    493528  private:
    494529    Node *expr1, *expr2;
     
    504539    virtual ~EqualNode();
    505540    Value evaluate(ExecState *exec);
     541    virtual void streamTo(SourceStream &s) const;
    506542  private:
    507543    Node *expr1, *expr2;
     
    517553    virtual ~BitOperNode();
    518554    Value evaluate(ExecState *exec);
     555    virtual void streamTo(SourceStream &s) const;
    519556  private:
    520557    Node *expr1, *expr2;
     
    522559  };
    523560
    524   /** expr1 && expr2, expr1 || expr2 */
     561  /**
     562   * expr1 && expr2, expr1 || expr2
     563   */
    525564  class BinaryLogicalNode : public Node {
    526565  public:
     
    531570    virtual ~BinaryLogicalNode();
    532571    Value evaluate(ExecState *exec);
     572    virtual void streamTo(SourceStream &s) const;
    533573  private:
    534574    Node *expr1, *expr2;
     
    536576  };
    537577
    538   /** The ternary operator, "logical ? expr1 : expr2" */
     578  /**
     579   * The ternary operator, "logical ? expr1 : expr2"
     580   */
    539581  class ConditionalNode : public Node {
    540582  public:
     
    545587    virtual ~ConditionalNode();
    546588    Value evaluate(ExecState *exec);
     589    virtual void streamTo(SourceStream &s) const;
    547590  private:
    548591    Node *logical, *expr1, *expr2;
     
    556599    virtual ~AssignNode();
    557600    Value evaluate(ExecState *exec);
     601    virtual void streamTo(SourceStream &s) const;
    558602  private:
    559603    Node *left;
     
    569613    virtual ~CommaNode();
    570614    Value evaluate(ExecState *exec);
     615    virtual void streamTo(SourceStream &s) const;
    571616  private:
    572617    Node *expr1, *expr2;
     
    582627    virtual Completion execute(ExecState *exec);
    583628    virtual void processVarDecls(ExecState *exec);
     629    virtual void streamTo(SourceStream &s) const;
    584630  private:
    585631    StatementNode *statement;
     
    594640    virtual ~AssignExprNode();
    595641    Value evaluate(ExecState *exec);
     642    virtual void streamTo(SourceStream &s) const;
    596643  private:
    597644    Node *expr;
     
    606653    Value evaluate(ExecState *exec);
    607654    virtual void processVarDecls(ExecState *exec);
     655    virtual void streamTo(SourceStream &s) const;
    608656  private:
    609657    UString ident;
     
    620668    Value evaluate(ExecState *exec);
    621669    virtual void processVarDecls(ExecState *exec);
     670    virtual void streamTo(SourceStream &s) const;
    622671  private:
    623672    Node *list;
     
    633682    virtual Completion execute(ExecState *exec);
    634683    virtual void processVarDecls(ExecState *exec);
     684    virtual void streamTo(SourceStream &s) const;
    635685  private:
    636686    VarDeclListNode *list;
     
    645695    virtual Completion execute(ExecState *exec);
    646696    virtual void processVarDecls(ExecState *exec);
     697    virtual void streamTo(SourceStream &s) const;
    647698  private:
    648699    SourceElementsNode *source;
     
    653704    EmptyStatementNode() { } // debug
    654705    virtual Completion execute(ExecState *exec);
     706    virtual void streamTo(SourceStream &s) const;
    655707  };
    656708
     
    662714    virtual ~ExprStatementNode();
    663715    virtual Completion execute(ExecState *exec);
     716    virtual void streamTo(SourceStream &s) const;
    664717  private:
    665718    Node *expr;
     
    675728    virtual Completion execute(ExecState *exec);
    676729    virtual void processVarDecls(ExecState *exec);
     730    virtual void streamTo(SourceStream &s) const;
    677731  private:
    678732    Node *expr;
     
    688742    virtual Completion execute(ExecState *exec);
    689743    virtual void processVarDecls(ExecState *exec);
     744    virtual void streamTo(SourceStream &s) const;
    690745  private:
    691746    StatementNode *statement;
     
    701756    virtual Completion execute(ExecState *exec);
    702757    virtual void processVarDecls(ExecState *exec);
     758    virtual void streamTo(SourceStream &s) const;
    703759  private:
    704760    Node *expr;
     
    715771    virtual Completion execute(ExecState *exec);
    716772    virtual void processVarDecls(ExecState *exec);
     773    virtual void streamTo(SourceStream &s) const;
    717774  private:
    718775    Node *expr1, *expr2, *expr3;
     
    729786    virtual Completion execute(ExecState *exec);
    730787    virtual void processVarDecls(ExecState *exec);
     788    virtual void streamTo(SourceStream &s) const;
    731789  private:
    732790    UString ident;
     
    742800    ContinueNode(const UString *i) : ident(*i) { }
    743801    virtual Completion execute(ExecState *exec);
     802    virtual void streamTo(SourceStream &s) const;
    744803  private:
    745804    UString ident;
     
    751810    BreakNode(const UString *i) : ident(*i) { }
    752811    virtual Completion execute(ExecState *exec);
     812    virtual void streamTo(SourceStream &s) const;
    753813  private:
    754814    UString ident;
     
    762822    virtual ~ReturnNode();
    763823    virtual Completion execute(ExecState *exec);
     824    virtual void streamTo(SourceStream &s) const;
    764825  private:
    765826    Node *value;
     
    774835    virtual Completion execute(ExecState *exec);
    775836    virtual void processVarDecls(ExecState *exec);
     837    virtual void streamTo(SourceStream &s) const;
    776838  private:
    777839    Node *expr;
     
    788850    Completion evalStatements(ExecState *exec);
    789851    virtual void processVarDecls(ExecState *exec);
     852    virtual void streamTo(SourceStream &s) const;
    790853  private:
    791854    Node *expr;
     
    804867    ClauseListNode *next() const { return nx; }
    805868    virtual void processVarDecls(ExecState *exec);
     869    virtual void streamTo(SourceStream &s) const;
    806870  private:
    807871    CaseClauseNode *cl;
     
    819883    Completion evalBlock(ExecState *exec, const Value& input);
    820884    virtual void processVarDecls(ExecState *exec);
     885    virtual void streamTo(SourceStream &s) const;
    821886  private:
    822887    ClauseListNode *list1;
     
    833898    virtual Completion execute(ExecState *exec);
    834899    virtual void processVarDecls(ExecState *exec);
     900    virtual void streamTo(SourceStream &s) const;
    835901  private:
    836902    Node *expr;
     
    846912    virtual Completion execute(ExecState *exec);
    847913    virtual void processVarDecls(ExecState *exec);
     914    virtual void streamTo(SourceStream &s) const;
    848915  private:
    849916    UString label;
     
    858925    virtual ~ThrowNode();
    859926    virtual Completion execute(ExecState *exec);
     927    virtual void streamTo(SourceStream &s) const;
    860928  private:
    861929    Node *expr;
     
    871939    Completion execute(ExecState *exec, const Value &arg);
    872940    virtual void processVarDecls(ExecState *exec);
     941    virtual void streamTo(SourceStream &s) const;
    873942  private:
    874943    UString ident;
     
    884953    virtual Completion execute(ExecState *exec);
    885954    virtual void processVarDecls(ExecState *exec);
     955    virtual void streamTo(SourceStream &s) const;
    886956  private:
    887957    StatementNode *block;
     
    897967    virtual Completion execute(ExecState *exec);
    898968    virtual void processVarDecls(ExecState *exec);
     969    virtual void streamTo(SourceStream &s) const;
    899970  private:
    900971    StatementNode *block;
     
    913984    UString ident() { return id; }
    914985    ParameterNode *nextParam() { return next; }
     986    virtual void streamTo(SourceStream &s) const;
    915987  private:
    916988    UString id;
     
    9281000    virtual void processFuncDecl(ExecState *exec);
    9291001    virtual void processVarDecls(ExecState *exec);
     1002    void streamTo(SourceStream &s) const;
    9301003  protected:
    9311004    SourceElementsNode *source;
     
    9421015      { /* empty */ return Completion(); }
    9431016    void processFuncDecl(ExecState *exec);
     1017    virtual void streamTo(SourceStream &s) const;
    9441018  private:
    9451019    UString ident;
     
    9561030    virtual ~FuncExprNode();
    9571031    Value evaluate(ExecState *exec);
     1032    virtual void streamTo(SourceStream &s) const;
    9581033  private:
    9591034    ParameterNode *param;
     
    9631038  class SourceElementNode : public StatementNode {
    9641039  public:
    965     SourceElementNode(StatementNode *s) { statement = s; function = 0L; }
    966     SourceElementNode(FuncDeclNode *f) { function = f; statement = 0L;}
     1040    SourceElementNode(StatementNode *s) : statement(s), function(0L) { }
     1041    SourceElementNode(FuncDeclNode *f) : statement(0L), function(f) { }
    9671042    virtual void ref();
    9681043    virtual bool deref();
     
    9711046    virtual void processFuncDecl(ExecState *exec);
    9721047    virtual void processVarDecls(ExecState *exec);
     1048    virtual void streamTo(SourceStream &s) const;
    9731049  private:
    9741050    StatementNode *statement;
     
    9881064    virtual void processFuncDecl(ExecState *exec);
    9891065    virtual void processVarDecls(ExecState *exec);
     1066    virtual void streamTo(SourceStream &s) const;
    9901067  private:
    9911068    SourceElementNode *element; // 'this' element
  • trunk/JavaScriptCore/kjs/number_object.cpp

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
  • trunk/JavaScriptCore/kjs/number_object.h

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
  • trunk/JavaScriptCore/kjs/object.cpp

    r910 r1024  
    2020 *  Boston, MA 02111-1307, USA.
    2121 *
    22  *  $Id$
    2322 */
    2423
     
    109108}
    110109
    111 bool Object::hasProperty(ExecState *exec, const UString &propertyName, bool recursive) const
    112 {
    113   return static_cast<ObjectImp*>(rep)->hasProperty(exec,propertyName,recursive);
     110bool Object::hasProperty(ExecState *exec, const UString &propertyName) const
     111{
     112  return static_cast<ObjectImp*>(rep)->hasProperty(exec, propertyName);
    114113}
    115114
     
    184183  : _prop(0), _proto(static_cast<ObjectImp*>(proto.imp())), _internalValue(0L), _scope(0)
    185184{
    186   //fprintf(stderr,"ObjectImp::ObjectImp %p %s\n",(void*)this);
     185  //fprintf(stderr,"ObjectImp::ObjectImp %p\n",(void*)this);
    187186  _scope = ListImp::empty();
    188187  _prop = new PropertyMap();
     
    191190ObjectImp::ObjectImp()
    192191{
    193   //fprintf(stderr,"ObjectImp::ObjectImp %p %s\n",(void*)this);
     192  //fprintf(stderr,"ObjectImp::ObjectImp %p\n",(void*)this);
    194193  _prop = 0;
    195194  _proto = NullImp::staticNull;
     
    357356
    358357// ECMA 8.6.2.4
    359 bool ObjectImp::hasProperty(ExecState *exec, const UString &propertyName, bool recursive) const
     358bool ObjectImp::hasProperty(ExecState *exec, const UString &propertyName) const
    360359{
    361360  if (propertyName == "__proto__")
     
    370369  // Look in the prototype
    371370  Object proto = Object::dynamicCast(prototype());
    372   if (proto.isNull() || !recursive)
    373     return false;
    374 
    375   return proto.hasProperty(exec,propertyName);
     371  return !proto.isNull() && proto.hasProperty(exec,propertyName);
    376372}
    377373
     
    388384
    389385  // Look in the static hashtable of properties
    390   if (findPropertyHashEntry(propertyName))
    391     return false; // No builtin property can be deleted
     386  const HashEntry* entry = findPropertyHashEntry(propertyName);
     387  if (entry && entry->attr & DontDelete)
     388    return false; // this builtin property can't be deleted
    392389  return true;
    393390}
  • trunk/JavaScriptCore/kjs/object.h

    r798 r1024  
    4242  // Attributes (only applicable to the Object type)
    4343  enum Attribute { None       = 0,
    44                    ReadOnly   = 1 << 1, // property can be only read, not written
    45                    DontEnum   = 1 << 2, // property doesn't appear in (for .. in ..)
    46                    DontDelete = 1 << 3, // property can't be deleted
    47                    Internal   = 1 << 4, // an internal property, set to by pass checks
    48                    Function   = 1 << 5 }; // property is a function - only used by static hashtables
     44                   ReadOnly   = 1 << 1, // property can be only read, not written
     45                   DontEnum   = 1 << 2, // property doesn't appear in (for .. in ..)
     46                   DontDelete = 1 << 3, // property can't be deleted
     47                   Internal   = 1 << 4, // an internal property, set to by pass checks
     48                   Function   = 1 << 5 }; // property is a function - only used by static hashtables
    4949
    5050  /**
     
    164164     * @return true if the object has the property, otherwise false
    165165     */
    166     bool hasProperty(ExecState *exec, const UString &propertyName,
    167                      bool recursive = true) const;
     166    bool hasProperty(ExecState *exec, const UString &propertyName) const;
    168167
    169168    /**
     
    488487     * @see Object::hasProperty()
    489488     */
    490     virtual bool hasProperty(ExecState *exec, const UString &propertyName,
    491                              bool recursive = true) const;
     489    virtual bool hasProperty(ExecState *exec,
     490                             const UString &propertyName) const;
    492491
    493492    /**
     
    579578   */
    580579  enum ErrorType { GeneralError   = 0,
    581                    EvalError      = 1,
    582                    RangeError     = 2,
    583                    ReferenceError = 3,
    584                    SyntaxError    = 4,
    585                    TypeError      = 5,
    586                    URIError       = 6};
     580                   EvalError      = 1,
     581                   RangeError     = 2,
     582                   ReferenceError = 3,
     583                   SyntaxError    = 4,
     584                   TypeError      = 5,
     585                   URIError       = 6};
    587586
    588587  /**
  • trunk/JavaScriptCore/kjs/object_object.cpp

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
  • trunk/JavaScriptCore/kjs/object_object.h

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
  • trunk/JavaScriptCore/kjs/operations.h

    r798 r1024  
    1919 *  Boston, MA 02111-1307, USA.
    2020 *
    21  *  $Id$
    2221 */
    2322
  • trunk/JavaScriptCore/kjs/property_map.cpp

    r936 r1024  
    1919 *  Boston, MA 02111-1307, USA.
    2020 *
    21  *  $Id$
    2221 */
    2322
    2423
    2524#include "property_map.h"
    26 
    27 #include <config.h>
    2825
    2926#include <string.h>
     
    129126PropertyMap::~PropertyMap()
    130127{
    131 #ifdef APPLE_CHANGES
    132128  clear();
    133 #endif
    134129}
    135130
  • trunk/JavaScriptCore/kjs/property_map.h

    r798 r1024  
    1919 *  Boston, MA 02111-1307, USA.
    2020 *
    21  *  $Id$
    2221 */
    2322
  • trunk/JavaScriptCore/kjs/regexp.cpp

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
  • trunk/JavaScriptCore/kjs/regexp.h

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
  • trunk/JavaScriptCore/kjs/regexp_object.cpp

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
  • trunk/JavaScriptCore/kjs/regexp_object.h

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
  • trunk/JavaScriptCore/kjs/string_object.cpp

    r798 r1024  
    203203      reg = imp->regExp();
    204204    }
    205     else if (a0.isA(StringType))
    206     {
     205    else
     206    { /*
     207       *  ECMA 15.5.4.12 String.prototype.search (regexp)
     208       *  If regexp is not an object whose [[Class]] property is "RegExp", it is
     209       *  replaced with the result of the expression new RegExp(regexp).
     210       */
    207211      reg = new RegExp(a0.toString(exec), RegExp::None);
    208     }
    209     else
    210     {
    211 #ifndef NDEBUG
    212       printf("KJS: Match/Search. Argument is not a RegExp nor a String - returning Undefined\n");
    213 #endif
    214       result = Undefined();
    215       break;
    216212    }
    217213    RegExpObjectImp* regExpObj = static_cast<RegExpObjectImp*>(exec->interpreter()->builtinRegExp().imp());
     
    241237
    242238      RegExpObjectImp* regExpObj = static_cast<RegExpObjectImp*>(exec->interpreter()->builtinRegExp().imp());
    243       int **ovector = regExpObj->registerRegexp( reg, u );
    244239      int lastIndex = 0;
    245240      u3 = a1.toString(exec); // replacement string
    246241      // This is either a loop (if global is set) or a one-way (if not).
    247242      do {
     243        int **ovector = regExpObj->registerRegexp( reg, u );
    248244        UString mstr = reg->match(u, lastIndex, &pos, ovector);
    249245        len = mstr.size();
    250         lastIndex = pos + u3.size();
     246        UString rstr(u3);
     247        bool ok;
     248        // check if u3 matches $1 or $2 etc
     249        for (int i = 0; (i = rstr.find(UString("$"), i)) != -1; i++) {
     250          if (i+1<rstr.size() && rstr[i+1] == '$') {  // "$$" -> "$"
     251            rstr = rstr.substr(0,i) + "$" + rstr.substr(i+2);
     252            continue;
     253          }
     254          // Assume number part is one char exactly
     255          unsigned long pos = rstr.substr(i+1,1).toULong(&ok);
     256          if (ok && pos <= (unsigned)reg->subPatterns()) {
     257            rstr = rstr.substr(0,i)
     258                      + u.substr((*ovector)[2*pos],
     259                                     (*ovector)[2*pos+1]-(*ovector)[2*pos])
     260                      + rstr.substr(i+2);
     261            i += (*ovector)[2*pos+1]-(*ovector)[2*pos] - 1; // -1 offsets i++
     262          }
     263        }
     264        lastIndex = pos + rstr.size();
    251265        if ( pos != -1 )
    252           u = u.substr(0, pos) + u3 + u.substr(pos + len);
     266          u = u.substr(0, pos) + rstr + u.substr(pos + len);
    253267        //fprintf(stderr,"pos=%d,len=%d,lastIndex=%d,u=%s\n",pos,len,lastIndex,u.ascii());
    254268      } while ( global && pos != -1 );
     
    321335        }
    322336      }
    323       delete ovector;
     337      delete [] ovector;
    324338    } else if (a0.type() != UndefinedType) {
    325339      u2 = a0.toString(exec);
  • trunk/JavaScriptCore/kjs/string_object.h

    r798 r1024  
    1818 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1919 *
    20  *  $Id$
    2120 */
    2221
  • trunk/JavaScriptCore/kjs/testkjs.cpp

    r798 r1024  
    1919 *  Boston, MA 02111-1307, USA.
    2020 *
    21  *  $Id$
    2221 */
    2322
     
    6463    // create interpreter
    6564    Interpreter interp(global);
     65    // add debug() function
    6666    global.put(interp.globalExec(),"debug", Object(new TestFunctionImp()));
    6767    // add "print" for compatibility with the mozilla js shell
    6868    global.put(interp.globalExec(),"print", Object(new TestFunctionImp()));
    69 
    70     // add debug() function
    71     //  kjs->enableDebug();
    7269
    7370    const int BufferSize = 200000;
     
    7976      if (!f) {
    8077        fprintf(stderr, "Error opening %s.\n", file);
    81         return -1;
     78        return 2;
    8279      }
    8380      int num = fread(code, 1, BufferSize, f);
     
    113110    }
    114111
    115     //  delete kjs;
    116112  } // end block, so that Interpreter and global get deleted
    117113
     
    122118  Interpreter::finalCheck();
    123119#endif
    124   return ret;
     120  return ret ? 0 : 1;
    125121}
  • trunk/JavaScriptCore/kjs/types.cpp

    r798 r1024  
    2020 *  Boston, MA 02111-1307, USA.
    2121 *
    22  *  $Id$
    2322 */
    2423
  • trunk/JavaScriptCore/kjs/types.h

    r798 r1024  
    2020 *  Boston, MA 02111-1307, USA.
    2121 *
    22  *  $Id$
    2322 */
    2423
  • trunk/JavaScriptCore/kjs/ustring.cpp

    r798 r1024  
    1919 *  Boston, MA 02111-1307, USA.
    2020 *
    21  *  $Id$
    2221 */
    2322
     
    182181UString::UString(char c)
    183182{
    184   rep = Rep::create(new UChar(0, c), 1);
     183    UChar *d = new UChar[1];
     184    d[0] = UChar(0, c);
     185    rep = Rep::create(d, 1);
    185186}
    186187
     
    524525bool KJS::operator<(const UString& s1, const UString& s2)
    525526{
    526   int l1 = s1.size();
    527   int l2 = s2.size();
     527  const int l1 = s1.size();
     528  const int l2 = s2.size();
     529  const int lmin = l1 < l2 ? l1 : l2;
    528530  const UChar *c1 = s1.data();
    529531  const UChar *c2 = s2.data();
    530532  int l = 0;
    531   int le = l1 < l2 ? l1 : l2;
    532   while (l < le && *c1 == *c2) {
     533  while (l < lmin && *c1 == *c2) {
    533534    c1++;
    534535    c2++;
    535536    l++;
    536537  }
    537   if (l != le)
     538  if (l < lmin)
    538539    return (c1->unicode() < c2->unicode());
    539540
    540   return (l1 < l2 && !(*c1 == *c2));
     541  return (l1 < l2);
    541542}
    542543
  • trunk/JavaScriptCore/kjs/ustring.h

    r918 r1024  
    1919 *  Boston, MA 02111-1307, USA.
    2020 *
    21  *  $Id$
    2221 */
    2322
    2423#ifndef _KJS_USTRING_H_
    2524#define _KJS_USTRING_H_
    26 
    27 #ifdef HAVE_CONFIG_H
    28 #include <config.h>
    29 #endif
    3025
    3126#ifdef APPLE_CHANGES
     
    110105    friend bool operator<(const UString& s1, const UString& s2);
    111106
    112     ushort uc;
     107    unsigned short uc;
    113108  };
    114109
  • trunk/JavaScriptCore/kjs/value.cpp

    r798 r1024  
    4242// ------------------------------ ValueImp -------------------------------------
    4343
    44 ValueImp::ValueImp() : refcount(0), _flags(0)
    45 {
     44ValueImp::ValueImp() :
     45  refcount(0),
    4646  // Tell the garbage collector that this memory block corresponds to a real object now
    47   _flags |= VI_CREATED;
     47  _flags(VI_CREATED)
     48{
    4849  //fprintf(stderr,"ValueImp::ValueImp %p\n",(void*)this);
    4950}
     
    6768void ValueImp::setGcAllowed()
    6869{
     70  //fprintf(stderr,"ValueImp::setGcAllowed %p\n",(void*)this);
    6971  _flags |= VI_GCALLOWED;
    7072}
  • trunk/JavaScriptCore/kjs/value.h

    r798 r1024  
    3434#endif
    3535
     36#include <stdlib.h> // Needed for size_t
     37
    3638#include "ustring.h"
    37 
    38 #if APPLE_CHANGES
    39 #include <stdlib.h>
    40 #endif
    4139
    4240// Primitive data types
     
    219217     * Performs the ToUint32 type conversion operation on this value (ECMA 9.6)
    220218     */
    221     uint toUInt32(ExecState *exec) const;
     219    unsigned int toUInt32(ExecState *exec) const;
    222220
    223221    /**
Note: See TracChangeset for help on using the changeset viewer.