[MediaWiki-commits] [Gerrit] Exterminate global usage in defines - change (mediawiki...Parsoid)
jenkins-bot has submitted this change and it was merged. Change subject: Exterminate global usage in defines .. Exterminate global usage in defines We used to define a few constructors and some state on the global object to make it available to the PEG tokenizer. We have since found a way to pass the state into the PEG tokenizer, but a few constructors were still added to the global object in the defines module. The predecessor patch I8810da3a5ec287d7ae9078463ba01472a87a492e adds explicit local definitions in most remaining places. This patch finally does the same for the tokenizer and removes the global definitions altogether. Change-Id: If0ada2ea04b680b90caeb4fa76c46ca272e78d43 --- M js/lib/mediawiki.parser.defines.js M js/lib/pegTokenizer.pegjs.txt 2 files changed, 11 insertions(+), 11 deletions(-) Approvals: Subramanya Sastry: Looks good to me, approved Cscott: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/js/lib/mediawiki.parser.defines.js b/js/lib/mediawiki.parser.defines.js index 3c50ed8..6d88a3e 100644 --- a/js/lib/mediawiki.parser.defines.js +++ b/js/lib/mediawiki.parser.defines.js @@ -967,15 +967,4 @@ Params: Params, ParserValue: ParserValue }; - // TODO: don't use globals! - global.TagTk = TagTk; - global.InternalTk = InternalTk; - global.EndTagTk = EndTagTk; - global.SelfclosingTagTk = SelfclosingTagTk; - global.NlTk = NlTk; - global.CommentTk = CommentTk; - global.EOFTk = EOFTk; - global.KV = KV; - global.Params = Params; - global.ParserValue = ParserValue; } diff --git a/js/lib/pegTokenizer.pegjs.txt b/js/lib/pegTokenizer.pegjs.txt index d5c7c27..6455e88 100644 --- a/js/lib/pegTokenizer.pegjs.txt +++ b/js/lib/pegTokenizer.pegjs.txt @@ -35,6 +35,17 @@ var Util = require('./mediawiki.Util.js').Util; +// import defines and define some constructor shortcuts + var defines = require('./mediawiki.parser.defines.js'), +KV = defines.KV, +TagTk = defines.TagTk, +SelfclosingTagTk = defines.SelfclosingTagTk, +EndTagTk = defines.EndTagTk, +NlTk = defines.NlTk, +CommentTk = defines.CommentTk, +EOFTk = defines.EOFTk; + + var flattenIfArray = function(e) { function internal_flatten(e, res) { // Don't bother flattening if we dont have an array -- To view, visit https://gerrit.wikimedia.org/r/60357 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If0ada2ea04b680b90caeb4fa76c46ca272e78d43 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Parsoid Gerrit-Branch: master Gerrit-Owner: GWicke gwi...@wikimedia.org Gerrit-Reviewer: Cscott wikime...@cscott.net Gerrit-Reviewer: Subramanya Sastry ssas...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Exterminate global usage in defines - change (mediawiki...Parsoid)
GWicke has uploaded a new change for review. https://gerrit.wikimedia.org/r/60357 Change subject: Exterminate global usage in defines .. Exterminate global usage in defines We used to define a few constructors and some state on the global object to make it available to the PEG tokenizer. We have since found a way to pass the state into the PEG tokenizer, but a few constructors were still added to the global object in the defines module. The predecessor patch I8810da3a5ec287d7ae9078463ba01472a87a492e adds explicit local definitions in most remaining places. This patch finally does the same for the tokenizer and removes the global definitions altogether. Currently parserTests fail on node 0.6.x due to a recursive dependency which is being investigated in I8810da3a5ec287d7ae9078463ba01472a87a492e. Change-Id: If0ada2ea04b680b90caeb4fa76c46ca272e78d43 --- M js/lib/mediawiki.parser.defines.js M js/lib/pegTokenizer.pegjs.txt 2 files changed, 11 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid refs/changes/57/60357/1 diff --git a/js/lib/mediawiki.parser.defines.js b/js/lib/mediawiki.parser.defines.js index a674d5f..188caf7 100644 --- a/js/lib/mediawiki.parser.defines.js +++ b/js/lib/mediawiki.parser.defines.js @@ -955,15 +955,4 @@ Params: Params, ParserValue: ParserValue }; - // TODO: don't use globals! - global.TagTk = TagTk; - global.InternalTk = InternalTk; - global.EndTagTk = EndTagTk; - global.SelfclosingTagTk = SelfclosingTagTk; - global.NlTk = NlTk; - global.CommentTk = CommentTk; - global.EOFTk = EOFTk; - global.KV = KV; - global.Params = Params; - global.ParserValue = ParserValue; } diff --git a/js/lib/pegTokenizer.pegjs.txt b/js/lib/pegTokenizer.pegjs.txt index d5c7c27..6455e88 100644 --- a/js/lib/pegTokenizer.pegjs.txt +++ b/js/lib/pegTokenizer.pegjs.txt @@ -35,6 +35,17 @@ var Util = require('./mediawiki.Util.js').Util; +// import defines and define some constructor shortcuts + var defines = require('./mediawiki.parser.defines.js'), +KV = defines.KV, +TagTk = defines.TagTk, +SelfclosingTagTk = defines.SelfclosingTagTk, +EndTagTk = defines.EndTagTk, +NlTk = defines.NlTk, +CommentTk = defines.CommentTk, +EOFTk = defines.EOFTk; + + var flattenIfArray = function(e) { function internal_flatten(e, res) { // Don't bother flattening if we dont have an array -- To view, visit https://gerrit.wikimedia.org/r/60357 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If0ada2ea04b680b90caeb4fa76c46ca272e78d43 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Parsoid Gerrit-Branch: master Gerrit-Owner: GWicke gwi...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits