Skip to content

Commit

Permalink
[DevTools] Roll closure compiler to ToT version
Browse files Browse the repository at this point in the history
Closure version:
commit e89bb281f3dbf72c20f1a86e3313831f943be688
Date:   Mon Mar 7 08:27:56 2016 -0800

Array.prototype.push supports type checking.
Better arrow function support.
Removed third_party/WebKit/Source/devtools/front_end/es6.js.

BUG=591865
[email protected], [email protected], [email protected], [email protected]
[email protected]

Review URL: https://codereview.chromium.org/1774503005 .

Cr-Commit-Position: refs/heads/master@{#379920}
  • Loading branch information
alexkozy committed Mar 8, 2016
1 parent d43ba4a commit 38f07de
Show file tree
Hide file tree
Showing 17 changed files with 71 additions and 1,192 deletions.
1,097 changes: 0 additions & 1,097 deletions front_end/es6.js

This file was deleted.

37 changes: 12 additions & 25 deletions front_end/externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ Event.prototype.isMetaOrCtrlForTest;
/** @type {string} */
Event.prototype.code;

/** @type {function():!Array<!EventTarget>|undefined} */
Event.prototype.deepPath;

/**
* @type {number}
*/
Expand Down Expand Up @@ -81,27 +78,27 @@ Array.prototype.rotate = function(index) {}
*/
Array.prototype.sortNumbers = function() {}
/**
* @param {!T} object
* @param {function(!T,!S):number=} comparator
* @param {!S} object
* @param {function(!S,!T):number=} comparator
* @return {number}
* @this {Array.<S>}
* @template T,S
* @this {Array.<T>}
* @template S
*/
Array.prototype.lowerBound = function(object, comparator) {}
/**
* @param {!T} object
* @param {function(!T,!S):number=} comparator
* @param {!S} object
* @param {function(!S,!T):number=} comparator
* @return {number}
* @this {Array.<S>}
* @template T,S
* @this {Array.<T>}
* @template S
*/
Array.prototype.upperBound = function(object, comparator) {}
/**
* @param {!T} value
* @param {function(!T,!S):number} comparator
* @param {!S} value
* @param {function(!S,!T):number} comparator
* @return {number}
* @this {Array.<S>}
* @template T,S
* @this {Array.<T>}
* @template S
*/
Array.prototype.binaryIndexOf = function(value, comparator) {}
/**
Expand Down Expand Up @@ -174,16 +171,6 @@ Array.prototype.intersectOrdered = function(array, comparator) {}
*/
Array.prototype.mergeOrdered = function(array, comparator) {}

/**
* @param {string|!IArrayLike<T>|!Iterable<T>} arrayLike
* @param {function(this:S, (string|T), number,
* (string|!IArrayLike<T>|!Iterable<T>)): R=} opt_mapFn
* @param {S=} opt_this
* @return {!Array<R>}
* @template T,S,R
*/
Array.from = function(arrayLike, opt_mapFn, opt_this) {};

// File System API
/**
* @constructor
Expand Down
10 changes: 3 additions & 7 deletions front_end/platform/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ Set.prototype.valuesArray = function()
}

/**
* @param {!Iterable<T>} iterable
* @param {!Iterable<T>|!Array<!T>} iterable
* @template T
*/
Set.prototype.addAll = function(iterable)
Expand All @@ -1291,19 +1291,15 @@ Map.prototype.remove = function(key)
}

/**
* @return {!Array.<V>}
* @template K, V
* @this {Map.<K, V>}
* @return {!Array<!VALUE>}
*/
Map.prototype.valuesArray = function()
{
return Array.from(this.values());
}

/**
* @return {!Array<K>}
* @template K, V
* @this {Map<K, V>}
* @return {!Array<!KEY>}
*/
Map.prototype.keysArray = function()
{
Expand Down
4 changes: 2 additions & 2 deletions front_end/profiler/HeapSnapshotDataGrids.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ WebInspector.HeapSnapshotViewportDataGrid.prototype = {

/**
* @param {!WebInspector.DataGridNode} parent
* @param {!WebInspector.DataGridNode} node
* @param {!WebInspector.HeapSnapshotGridNode} node
*/
appendNode: function(parent, node)
{
Expand All @@ -540,7 +540,7 @@ WebInspector.HeapSnapshotViewportDataGrid.prototype = {
*/
insertChild: function(parent, node, index)
{
this.allChildren(parent).splice(index, 0, node);
this.allChildren(parent).splice(index, 0, /** @type {!WebInspector.HeapSnapshotGridNode} */(node));
},

removeChildByIndex: function(parent, index)
Expand Down
6 changes: 3 additions & 3 deletions front_end/sass/ASTSourceMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ WebInspector.ASTSourceMap.prototype = {
*/
sassModels: function()
{
var sassModels = new Map(this._models);
var sassModels = /** @type {!Map<string, !WebInspector.SASSSupport.AST>} */(new Map(this._models));
sassModels.delete(this._cssURL);
return sassModels;
},
Expand All @@ -126,7 +126,7 @@ WebInspector.ASTSourceMap.prototype = {
*/
models: function()
{
return new Map(this._models);
return /** @type {!Map<string, !WebInspector.SASSSupport.AST>} */(new Map(this._models));
},

/**
Expand Down Expand Up @@ -206,7 +206,7 @@ WebInspector.ASTSourceMap.prototype = {
outNodeMapping = outNodeMapping || new Map();
outNodeMapping.clear();

var models = new Map(this._models);
var models = /** @type {!Map<string, !WebInspector.SASSSupport.AST>} */(new Map(this._models));
for (var newAST of updated) {
var oldAST = models.get(newAST.document.url);
if (!oldAST.match(newAST, outNodeMapping))
Expand Down
6 changes: 3 additions & 3 deletions front_end/timeline/TimelineFlameChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
reset: function()
{
WebInspector.TimelineFlameChartDataProviderBase.prototype.reset.call(this);
/** @type {!Array<!WebInspector.TracingModel.Event|!WebInspector.TimelineFrame|!WebInspector.TimelineIRModel.Phases>} */
/** @type {!Array<!WebInspector.TracingModel.Event|!WebInspector.TimelineFrame|!WebInspector.TimelineIRModel.Phases|null>} */
this._entryData = [];
/** @type {!Array<!WebInspector.TimelineFlameChartEntryType>} */
this._entryTypeByLevel = [];
Expand Down Expand Up @@ -843,7 +843,7 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
_appendSegment: function(segment)
{
var index = this._entryData.length;
this._entryData.push(segment.data);
this._entryData.push(/** @type {!WebInspector.TimelineIRModel.Phases} */(segment.data));
this._entryIndexToTitle[index] = /** @type {string} */ (segment.data);
this._timelineData.entryLevels[index] = this._currentLevel;
this._timelineData.entryTotalTimes[index] = segment.end - segment.begin;
Expand Down Expand Up @@ -879,7 +879,7 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {

if (this._lastSelection && this._lastSelection.timelineSelection.object() === selection.object())
return this._lastSelection.entryIndex;
var index = this._entryData.indexOf(selection.object());
var index = this._entryData.indexOf(/** @type {!WebInspector.TracingModel.Event|!WebInspector.TimelineFrame|!WebInspector.TimelineIRModel.Phases} */(selection.object()));
if (index !== -1)
this._lastSelection = new WebInspector.TimelineFlameChartView.Selection(selection, index);
return index;
Expand Down
2 changes: 1 addition & 1 deletion front_end/timeline/TimelineProfileTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ WebInspector.TimelineProfileTree.buildBottomUp = function(topDownTree, groupingC
var rootChildren = buRoot.children;
for (var item of rootChildren.entries()) {
if (item[1].selfTime === 0)
rootChildren.delete(item[0]);
rootChildren.delete(/** @type {string} */(item[0]));
}

return buRoot;
Expand Down
2 changes: 1 addition & 1 deletion front_end/timeline/TimelineTreeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ WebInspector.TimelineTreeView.prototype = {
},

/**
* @param {!Array.<!WebInspector.DataGrid.ColumnDescriptor>} columns
* @param {!Array<!WebInspector.DataGrid.ColumnDescriptor>} columns
*/
_populateColumns: function(columns)
{
Expand Down
2 changes: 1 addition & 1 deletion front_end/ui/InspectorView.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ WebInspector.InspectorView.prototype = {
}

WebInspector.startBatchUpdate();
/** @type {!Map.<!WebInspector.PanelDescriptor, number>} */
/** @type {!Map<!WebInspector.PanelDescriptor, number>} */
var panelWeights = new Map();
self.runtime.extensions(WebInspector.PanelFactory).forEach(processPanelExtensions.bind(this));
var sortedPanels = panelWeights.keysArray().sort(orderComparator);
Expand Down
38 changes: 19 additions & 19 deletions front_end/ui_lazy/DataGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ WebInspector.DataGrid = function(columnsArray, editCallback, deleteCallback, ref

for (var i = 0; i < columnsArray.length; ++i) {
var column = columnsArray[i];
var columnIdentifier = column.identifier = column.id || i;
var columnIdentifier = column.identifier = column.id || String(i);
this._columns[columnIdentifier] = column;
if (column.disclosure)
this.disclosureColumnIdentifier = columnIdentifier;
Expand Down Expand Up @@ -160,22 +160,22 @@ WebInspector.DataGrid = function(columnsArray, editCallback, deleteCallback, ref
WebInspector.DataGrid.CornerWidth = 14;

/**
* @constructor
* @typedef {{
* id: string,
* title: string,
* sortable: boolean,
* sort: (?WebInspector.DataGrid.Order|undefined),
* align: (?WebInspector.DataGrid.Align|undefined),
* fixedWidth: (boolean|undefined),
* editable: (boolean|undefined),
* nonSelectable: (boolean|undefined),
* longText: (boolean|undefined),
* disclosure: (boolean|undefined),
* identifier: (string|undefined),
* weight: (number|undefined)
* }}
*/
WebInspector.DataGrid.ColumnDescriptor = function()
{
/** @type {string} */ this.id;
/** @type {string} */ this.title;
/** @type {string} */ this.width;
/** @type {boolean} */ this.fixedWidth;
/** @type {boolean} */ this.sortable;
/** @type {?WebInspector.DataGrid.Order|undefined} */ this.sort;
/** @type {?WebInspector.DataGrid.Align|undefined} */ this.align;
/** @type {boolean|undefined} */ this.editable;
/** @type {boolean|undefined} */ this.nonSelectable;
/** @type {boolean|undefined} */ this.longText;
/** @type {boolean|undefined} */ this.disclosure;
}
WebInspector.DataGrid.ColumnDescriptor;

WebInspector.DataGrid.Events = {
SelectedNode: "SelectedNode",
Expand Down Expand Up @@ -217,7 +217,7 @@ WebInspector.DataGrid.prototype = {

for (var i = 0; i < this._visibleColumnsArray.length; ++i) {
var column = this._visibleColumnsArray[i];
var columnIdentifier = column.identifier;
var columnIdentifier = column.identifier || String(i);
var headerColumn = this._headerTableColumnGroup.createChild("col");
var dataColumn = this._dataTableColumnGroup.createChild("col");
if (column.width) {
Expand Down Expand Up @@ -717,7 +717,7 @@ WebInspector.DataGrid.prototype = {
this._visibleColumnsArray = [];
for (var i = 0; i < this._columnsArray.length; ++i) {
var column = this._columnsArray[i];
if (columnsVisibility[column.identifier])
if (columnsVisibility[column.identifier || String(i)])
this._visibleColumnsArray.push(column);
}
this._refreshHeader();
Expand Down Expand Up @@ -1236,7 +1236,7 @@ WebInspector.DataGridNode.prototype = {
this._element.removeChildren();
var columnsArray = this.dataGrid._visibleColumnsArray;
for (var i = 0; i < columnsArray.length; ++i)
this._element.appendChild(this.createCell(columnsArray[i].identifier));
this._element.appendChild(this.createCell(columnsArray[i].identifier || String(i)));
this._element.appendChild(this._createTDWithClass("corner"));
},

Expand Down
Binary file modified scripts/closure/compiler.jar
Binary file not shown.
3 changes: 0 additions & 3 deletions scripts/compile_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def to_platform_path_exact(filepath):
inspector_path = path.join(path.dirname(devtools_path), 'core', 'inspector')
v8_inspector_path = path.join(path.dirname(devtools_path), 'platform', 'v8_inspector')
devtools_frontend_path = path.join(devtools_path, 'front_end')
patched_es6_externs_file = to_platform_path(path.join(devtools_frontend_path, 'es6.js'))
global_externs_file = to_platform_path(path.join(devtools_frontend_path, 'externs.js'))
protocol_externs_file = path.join(devtools_frontend_path, 'protocol_externs.js')
injected_script_source_name = path.join(v8_inspector_path, 'InjectedScriptSource.js')
Expand Down Expand Up @@ -356,7 +355,6 @@ def dump_module(name, recursively, processed_modules):
checked_modules = modules_to_check()
for name in checked_modules:
closure_args = ' '.join(common_closure_args)
closure_args += ' --externs ' + to_platform_path(patched_es6_externs_file)
closure_args += ' --externs ' + to_platform_path(global_externs_file)
closure_args += ' --externs ' + platform_protocol_externs_file
runtime_module = module_arg(runtime_module_name) + ':1 --js ' + runtime_js_path
Expand All @@ -367,7 +365,6 @@ def dump_module(name, recursively, processed_modules):

modular_compiler_proc = popen(java_exec + ['-jar', closure_runner_jar, '--compiler-args-file', to_platform_path_exact(compiler_args_file.name)])


def unclosure_injected_script(sourceFileName, outFileName):

source = read_file(sourceFileName)
Expand Down
Binary file modified scripts/compiler-runner/closure-runner.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,23 @@ private void runWithExecutor(
List<CompilerInstanceDescriptor> descriptors, ExecutorService executor) {
List<Future<CompilerRunner>> futures = new ArrayList<>(descriptors.size());
for (CompilerInstanceDescriptor descriptor : descriptors) {
CompilerRunner task = new CompilerRunner(descriptor, new ByteArrayOutputStream(512));
futures.add(executor.submit(task));
try {
ByteArrayOutputStream rawStream = new ByteArrayOutputStream(512);
PrintStream errPrintStream = new PrintStream(rawStream, false, "UTF-8");
// We have to create instance of LocalCommandLineRunner object here,
// because its constructor should be executed on a single thread.
// Constructor is parsing flags and creating options object that can
// be used later in parallel during compilation.
LocalCommandLineRunner runner =
new LocalCommandLineRunner(descriptor.commandLine.split(" +"),
System.out, errPrintStream);

CompilerRunner task = new CompilerRunner(descriptor, rawStream, runner);
futures.add(executor.submit(task));
} catch (Exception e) {
System.err.println("ERROR - " + e.getMessage());
e.printStackTrace(System.err);
}
}

for (Future<CompilerRunner> future : futures) {
Expand Down Expand Up @@ -168,24 +183,10 @@ public static void main(String[] args) {

private static class LocalCommandLineRunner extends CommandLineRunner {

private static final String EXCLUDED_EXTERNS_ES6_JS = "externs.zip//es6.js";

protected LocalCommandLineRunner(String[] args, PrintStream out, PrintStream err) {
super(args, out, err);
}

@Override
protected List<SourceFile> createExterns() throws FlagUsageException, IOException {
List<SourceFile> externs = super.createExterns();
ArrayList<SourceFile> result = new ArrayList<>(externs.size());
for (SourceFile sourceFile: externs) {
if (!EXCLUDED_EXTERNS_ES6_JS.equals(sourceFile.getName())) {
result.add(sourceFile);
}
}
return result;
}

@Override
protected CompilerOptions createOptions() {
CompilerOptions options = super.createOptions();
Expand Down Expand Up @@ -220,29 +221,24 @@ private static class CompilerRunner implements Callable<CompilerRunner> {
private final CompilerInstanceDescriptor descriptor;
private final ByteArrayOutputStream errStream;
private int result;
private final LocalCommandLineRunner runner;

public CompilerRunner(
CompilerInstanceDescriptor descriptor, ByteArrayOutputStream errStream) {
CompilerInstanceDescriptor descriptor, ByteArrayOutputStream errStream,
LocalCommandLineRunner runner) {
this.descriptor = descriptor;
this.errStream = errStream;
this.runner = runner;
}

@Override
public CompilerRunner call() throws Exception {
PrintStream errPrintStream = new PrintStream(errStream, false, "UTF-8");
LocalCommandLineRunner runner =
new LocalCommandLineRunner(prepareArgs(), System.out, errPrintStream);
if (!runner.shouldRunCompiler()) {
if (!this.runner.shouldRunCompiler()) {
this.result = -1;
}
this.result = runner.execute();
this.result = this.runner.execute();
return this;
}

private String[] prepareArgs() {
// FIXME: This does not support quoted arguments.
return descriptor.commandLine.split(" +");
}
}

private static class Flags {
Expand Down
4 changes: 2 additions & 2 deletions scripts/jsdoc-validator/hashes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
0ce721f25c7b06eeba9afeb3b189a0c4f582e1d2da04765faf88e20ee7026bf9 src
9899a4645e144a7bd9de90b2541155b131c606e65a991c44c79a71a00ae77c05 jsdoc-validator.jar
7aa5cccefdb107c04602d961cdf0c03b717969367fd286543a551367397d67d3 src
6efef51c1af4c7698803af3d8305ca26e33f19dd6735f4dc2658e913a5492b84 jsdoc-validator.jar
Binary file modified scripts/jsdoc-validator/jsdoc-validator.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private String readScriptText() throws IOException {

private static Node parseScript(final ValidatorContext context) {
Config config = ParserRunner.createConfig(
true, true, LanguageMode.ECMASCRIPT5_STRICT, EXTRA_ANNOTATIONS);
true, true, true, LanguageMode.ECMASCRIPT5_STRICT, EXTRA_ANNOTATIONS);
ErrorReporter errorReporter = new ErrorReporter() {
@Override
public void warning(String message, String sourceName, int line, int lineOffset) {
Expand Down

0 comments on commit 38f07de

Please sign in to comment.