Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Side by Side Diff: Source/devtools/front_end/script_formatter_worker/JavaScriptFormatter.js

Issue 459833002: Revert of Revert of DevTools: Introduce module initializers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 "regexp": FormatterWorker.JavaScriptTokens.DIV, 979 "regexp": FormatterWorker.JavaScriptTokens.DIV,
980 "string": FormatterWorker.JavaScriptTokens.STRING 980 "string": FormatterWorker.JavaScriptTokens.STRING
981 }; 981 };
982 982
983 /** 983 /**
984 * @constructor 984 * @constructor
985 * @param {string} content 985 * @param {string} content
986 */ 986 */
987 FormatterWorker.JavaScriptTokenizer = function(content) 987 FormatterWorker.JavaScriptTokenizer = function(content)
988 { 988 {
989 this._readNextToken = parse.tokenizer(content); 989 this._readNextToken = tokenizerHolder.tokenizer(content);
990 this._state = this._readNextToken.context(); 990 this._state = this._readNextToken.context();
991 } 991 }
992 992
993 FormatterWorker.JavaScriptTokenizer.prototype = { 993 FormatterWorker.JavaScriptTokenizer.prototype = {
994 /** 994 /**
995 * @return {string} 995 * @return {string}
996 */ 996 */
997 content: function() 997 content: function()
998 { 998 {
999 return this._state.text; 999 return this._state.text;
(...skipping 19 matching lines...) Expand all
1019 { 1019 {
1020 var token = FormatterWorker.JavaScriptTokensByType[uglifyToken.type]; 1020 var token = FormatterWorker.JavaScriptTokensByType[uglifyToken.type];
1021 if (typeof token === "number") 1021 if (typeof token === "number")
1022 return token; 1022 return token;
1023 token = FormatterWorker.JavaScriptTokensByValue[uglifyToken.value]; 1023 token = FormatterWorker.JavaScriptTokensByValue[uglifyToken.value];
1024 if (typeof token === "number") 1024 if (typeof token === "number")
1025 return token; 1025 return token;
1026 throw "Unknown token type " + uglifyToken.type; 1026 throw "Unknown token type " + uglifyToken.type;
1027 } 1027 }
1028 } 1028 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698