Changeset 131236 in webkit for trunk/Source/JavaScriptCore/parser


Ignore:
Timestamp:
Oct 12, 2012, 4:48:18 PM (13 years ago)
Author:
[email protected]
Message:

Move macros from Parser.h to Parser.cpp
https://bugs.webkit.org/show_bug.cgi?id=99217

Reviewed by Andreas Kling.

There are a bunch of macros in Parser.h that are only used in Parser.cpp. Move them to Parser.cpp
so they won't pollute the global namespace.

  • parser/Parser.cpp:
  • parser/Parser.h:

(JSC):

Location:
trunk/Source/JavaScriptCore/parser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r130612 r131236  
    3535#include <wtf/OwnPtr.h>
    3636#include <wtf/WTFThreadData.h>
     37
     38#define fail() do { if (!m_error) updateErrorMessage(); return 0; } while (0)
     39#define failWithToken(tok) do { if (!m_error) updateErrorMessage(tok); return 0; } while (0)
     40#define failWithMessage(msg) do { if (!m_error) updateErrorMessage(msg); return 0; } while (0)
     41#define failWithNameAndMessage(before, name, after) do { if (!m_error) updateErrorWithNameAndMessage(before, name, after); return 0; } while (0)
     42#define failIfFalse(cond) do { if (!(cond)) fail(); } while (0)
     43#define failIfFalseWithMessage(cond, msg) do { if (!(cond)) failWithMessage(msg); } while (0)
     44#define failIfFalseWithNameAndMessage(cond, before, name, msg) do { if (!(cond)) failWithNameAndMessage(before, name, msg); } while (0)
     45#define failIfTrue(cond) do { if ((cond)) fail(); } while (0)
     46#define failIfTrueWithMessage(cond, msg) do { if ((cond)) failWithMessage(msg); } while (0)
     47#define failIfTrueWithNameAndMessage(cond, before, name, msg) do { if ((cond)) failWithNameAndMessage(before, name, msg); } while (0)
     48#define failIfTrueIfStrict(cond) do { if ((cond) && strictMode()) fail(); } while (0)
     49#define failIfTrueIfStrictWithMessage(cond, msg) do { if ((cond) && strictMode()) failWithMessage(msg); } while (0)
     50#define failIfTrueIfStrictWithNameAndMessage(cond, before, name, after) do { if ((cond) && strictMode()) failWithNameAndMessage(before, name, after); } while (0)
     51#define failIfFalseIfStrict(cond) do { if ((!(cond)) && strictMode()) fail(); } while (0)
     52#define failIfFalseIfStrictWithMessage(cond, msg) do { if ((!(cond)) && strictMode()) failWithMessage(msg); } while (0)
     53#define failIfFalseIfStrictWithNameAndMessage(cond, before, name, after) do { if ((!(cond)) && strictMode()) failWithNameAndMessage(before, name, after); } while (0)
     54#define consumeOrFail(tokenType) do { if (!consume(tokenType)) failWithToken(tokenType); } while (0)
     55#define consumeOrFailWithFlags(tokenType, flags) do { if (!consume(tokenType, flags)) failWithToken(tokenType); } while (0)
     56#define matchOrFail(tokenType) do { if (!match(tokenType)) failWithToken(tokenType); } while (0)
     57#define failIfStackOverflow() do { failIfFalseWithMessage(canRecurse(), "Code nested too deeply."); } while (0)
    3758
    3859using namespace std;
  • trunk/Source/JavaScriptCore/parser/Parser.h

    r128542 r131236  
    5858class SourceCode;
    5959
    60 #define fail() do { if (!m_error) updateErrorMessage(); return 0; } while (0)
    61 #define failWithToken(tok) do { if (!m_error) updateErrorMessage(tok); return 0; } while (0)
    62 #define failWithMessage(msg) do { if (!m_error) updateErrorMessage(msg); return 0; } while (0)
    63 #define failWithNameAndMessage(before, name, after) do { if (!m_error) updateErrorWithNameAndMessage(before, name, after); return 0; } while (0)
    64 #define failIfFalse(cond) do { if (!(cond)) fail(); } while (0)
    65 #define failIfFalseWithMessage(cond, msg) do { if (!(cond)) failWithMessage(msg); } while (0)
    66 #define failIfFalseWithNameAndMessage(cond, before, name, msg) do { if (!(cond)) failWithNameAndMessage(before, name, msg); } while (0)
    67 #define failIfTrue(cond) do { if ((cond)) fail(); } while (0)
    68 #define failIfTrueWithMessage(cond, msg) do { if ((cond)) failWithMessage(msg); } while (0)
    69 #define failIfTrueWithNameAndMessage(cond, before, name, msg) do { if ((cond)) failWithNameAndMessage(before, name, msg); } while (0)
    70 #define failIfTrueIfStrict(cond) do { if ((cond) && strictMode()) fail(); } while (0)
    71 #define failIfTrueIfStrictWithMessage(cond, msg) do { if ((cond) && strictMode()) failWithMessage(msg); } while (0)
    72 #define failIfTrueIfStrictWithNameAndMessage(cond, before, name, after) do { if ((cond) && strictMode()) failWithNameAndMessage(before, name, after); } while (0)
    73 #define failIfFalseIfStrict(cond) do { if ((!(cond)) && strictMode()) fail(); } while (0)
    74 #define failIfFalseIfStrictWithMessage(cond, msg) do { if ((!(cond)) && strictMode()) failWithMessage(msg); } while (0)
    75 #define failIfFalseIfStrictWithNameAndMessage(cond, before, name, after) do { if ((!(cond)) && strictMode()) failWithNameAndMessage(before, name, after); } while (0)
    76 #define consumeOrFail(tokenType) do { if (!consume(tokenType)) failWithToken(tokenType); } while (0)
    77 #define consumeOrFailWithFlags(tokenType, flags) do { if (!consume(tokenType, flags)) failWithToken(tokenType); } while (0)
    78 #define matchOrFail(tokenType) do { if (!match(tokenType)) failWithToken(tokenType); } while (0)
    79 #define failIfStackOverflow() do { failIfFalseWithMessage(canRecurse(), "Code nested too deeply."); } while (0)
    80 
    81     // Macros to make the more common TreeBuilder types a little less verbose
     60// Macros to make the more common TreeBuilder types a little less verbose
    8261#define TreeStatement typename TreeBuilder::Statement
    8362#define TreeExpression typename TreeBuilder::Expression
Note: See TracChangeset for help on using the changeset viewer.