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 <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits