RESOLVED FIXED 71747
DateMath.cpp should not depend on JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=71747
Summary DateMath.cpp should not depend on JavaScriptCore
Mark Rowe (bdash)
Reported 2011-11-07 16:25:31 PST
While working on making WTF build outside of JavaScriptCore I noticed that wtf/DateMath.cpp includes several headers from JavaScriptCore, and makes use of some JavaScriptCore types such as ExecState, JSGlobalData and DSTOffsetCache. This layering violation needs to be addressed before WTF can be correctly split out of JavaScriptCore.
Attachments
Patch (112.45 KB, patch)
2011-11-14 12:50 PST, Adam Barth
no flags
Mark Rowe (bdash)
Comment 1 2011-11-07 16:44:09 PST
It looks like it may be possible to simply move the USE(JSC) parts of DateMath.h / DateMath.cpp in to a more appropriate file inside JavaScriptCore itself.
Adam Barth
Comment 2 2011-11-14 12:50:33 PST
WebKit Review Bot
Comment 3 2011-11-14 12:53:41 PST
Attachment 115014 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/CMakeLists.txt', u'S..." exit_code: 1 Source/JavaScriptCore/runtime/JSDateMath.cpp:76: Alphabetical sorting problem. [build/include_order] [4] Source/JavaScriptCore/runtime/JSDateMath.cpp:147: More than one command on the same line in if [whitespace/parens] [4] Source/JavaScriptCore/runtime/JSDateMath.cpp:154: An else statement can be removed when the prior "if" concludes with a return, break, continue or goto statement. [readability/control_flow] [4] Source/JavaScriptCore/runtime/JSDateMath.cpp:244: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] Total errors found: 4 in 17 files If any of these errors are false positives, please file a bug against check-webkit-style.
Darin Adler
Comment 4 2011-11-14 15:12:31 PST
Comment on attachment 115014 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=115014&action=review >> Source/JavaScriptCore/runtime/JSDateMath.cpp:76 >> #include "ASCIICType.h" > > Alphabetical sorting problem. [build/include_order] [4] It’s true, ASCIICType.h should come before Assertions.h. > Source/JavaScriptCore/runtime/JSDateMath.cpp:82 > #include "Assertions.h" > #include "ASCIICType.h" > #include "CurrentTime.h" > -#if USE(JSC) > #include "JSObject.h" > -#endif > #include "MathExtras.h" > -#if USE(JSC) > #include "ScopeChain.h" > -#endif > #include "StdLibExtras.h" > #include "StringExtras.h" Is there a chance we could cut these includes down a bit more? Guess someone can look into that later. > Source/JavaScriptCore/wtf/DateMath.h:108 > +using WTF::isLeapYear; > using WTF::dateToDaysFrom1970; Entire "using" list should be sorted alphabetically.
WebKit Review Bot
Comment 5 2011-11-14 16:05:10 PST
Comment on attachment 115014 [details] Patch Clearing flags on attachment: 115014 Committed r100205: <http://trac.webkit.org/changeset/100205>
WebKit Review Bot
Comment 6 2011-11-14 16:05:16 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.