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):

File:
1 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;
Note: See TracChangeset for help on using the changeset viewer.