Skip to content

Commit

Permalink
DevTools: roll closure compiler to 20161201.
Browse files Browse the repository at this point in the history
[email protected]

Review-Url: https://codereview.chromium.org/2563763003 .
Cr-Commit-Position: refs/heads/master@{#437600}
  • Loading branch information
pavelfeldman committed Dec 9, 2016
1 parent a3668d7 commit 5aea9cb
Show file tree
Hide file tree
Showing 21 changed files with 76 additions and 88 deletions.
1 change: 1 addition & 0 deletions front_end/devtools_compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@
}

/**
* @override
* @param {!Array<string>} certChain
*/
showCertificateViewer(certChain) {
Expand Down
2 changes: 1 addition & 1 deletion front_end/elements/StylesSidebarPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ Elements.StylePropertiesSection = class {

var selectorTexts = rule.selectors.map(selector => selector.text);
var matchingSelectorIndexes = this._matchedStyles.matchingSelectors(/** @type {!SDK.CSSStyleRule} */ (rule));
var matchingSelectors = new Array(selectorTexts.length).fill(false);
var matchingSelectors = /** @type {!Array<boolean>} */ (new Array(selectorTexts.length).fill(false));
for (var matchingIndex of matchingSelectorIndexes)
matchingSelectors[matchingIndex] = true;

Expand Down
6 changes: 0 additions & 6 deletions front_end/externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,12 +618,6 @@ CodeMirror.doc;
/** @type {boolean} */
window.dispatchStandaloneTestRunnerMessages;

/**
* @param {*} obj
* @return {boolean}
*/
ArrayBuffer.isView = function(obj) {};

/**
* @param {Array.<Object>} keyframes
* @param {number|Object} timing
Expand Down
2 changes: 1 addition & 1 deletion front_end/ui_lazy/CommandMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ UI.CommandMenuDelegate = class extends UI.FilteredListWidget.Delegate {

/**
* @override
* @param {?number} itemIndex
* @param {number} itemIndex
* @param {string} promptValue
*/
selectItem(itemIndex, promptValue) {
Expand Down
12 changes: 6 additions & 6 deletions front_end/workspace/IsolatedFileSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Workspace.IsolatedFileSystem = class {
getMetadata(path) {
var fulfill;
var promise = new Promise(f => fulfill = f);
this._domFileSystem.root.getFile(path, null, fileEntryLoaded, errorHandler);
this._domFileSystem.root.getFile(path, undefined, fileEntryLoaded, errorHandler);
return promise;

/**
Expand Down Expand Up @@ -228,7 +228,7 @@ Workspace.IsolatedFileSystem = class {
name = 'NewFile';
var nameCandidate;

this._domFileSystem.root.getDirectory(path, null, dirEntryLoaded.bind(this), errorHandler.bind(this));
this._domFileSystem.root.getDirectory(path, undefined, dirEntryLoaded.bind(this), errorHandler.bind(this));

/**
* @param {!DirectoryEntry} dirEntry
Expand Down Expand Up @@ -278,7 +278,7 @@ Workspace.IsolatedFileSystem = class {
* @param {string} path
*/
deleteFile(path) {
this._domFileSystem.root.getFile(path, null, fileEntryLoaded.bind(this), errorHandler.bind(this));
this._domFileSystem.root.getFile(path, undefined, fileEntryLoaded.bind(this), errorHandler.bind(this));

/**
* @param {!FileEntry} fileEntry
Expand Down Expand Up @@ -319,7 +319,7 @@ Workspace.IsolatedFileSystem = class {
* @param {function(?string)} callback
*/
requestFileContent(path, callback) {
this._domFileSystem.root.getFile(path, null, fileEntryLoaded.bind(this), errorHandler.bind(this));
this._domFileSystem.root.getFile(path, undefined, fileEntryLoaded.bind(this), errorHandler.bind(this));

/**
* @param {!FileEntry} entry
Expand Down Expand Up @@ -427,7 +427,7 @@ Workspace.IsolatedFileSystem = class {
var fileEntry;
var dirEntry;

this._domFileSystem.root.getFile(path, null, fileEntryLoaded.bind(this), errorHandler.bind(this));
this._domFileSystem.root.getFile(path, undefined, fileEntryLoaded.bind(this), errorHandler.bind(this));

/**
* @param {!FileEntry} entry
Expand Down Expand Up @@ -522,7 +522,7 @@ Workspace.IsolatedFileSystem = class {
* @param {function(!Array.<!FileEntry>)} callback
*/
_requestEntries(path, callback) {
this._domFileSystem.root.getDirectory(path, null, innerCallback.bind(this), errorHandler);
this._domFileSystem.root.getDirectory(path, undefined, innerCallback.bind(this), errorHandler);

/**
* @param {!DirectoryEntry} dirEntry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def build_artifacts():
manifest_file.write('Class-Path: %s\n' % closure_jar_relpath)
manifest_file.close()
javac_path = os.path.join(java_bin_path, 'javac')
javac_command = '%s -d %s -cp %s %s' % (javac_path, bin_path, rel_to_abs(closure_jar_relpath), ' '.join(java_files))
javac_command = '%s -target 7 -source 7 -d %s -cp %s %s' % (javac_path, bin_path, rel_to_abs(closure_jar_relpath), ' '.join(java_files))
run_and_communicate(javac_command, 'Error: javac returned %d')

print 'Building jar...'
Expand Down
Binary file modified scripts/closure/closure_runner/closure_runner.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public DevToolsCodingConvention() {

@Override
public boolean isPrivate(String name) {
return name.length() > 1 && name.charAt(0) == '_' && name.charAt(1) != '_';
return false; // name.length() > 1 && name.charAt(0) == '_' && name.charAt(1) != '_';
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,6 @@ protected LocalCommandLineRunner(String[] args, PrintStream out, PrintStream err
super(args, out, err);
}

@Override
protected CompilerOptions createOptions() {
CompilerOptions options = super.createOptions();
options.setIdeMode(true);
options.setReportMissingOverride(CheckLevel.ERROR);
return options;
}

@Override
protected void setRunOptions(CompilerOptions options)
throws FlagUsageException, IOException {
Expand All @@ -201,17 +193,12 @@ protected void setRunOptions(CompilerOptions options)
}

int execute() {
int result = 0;
int runs = 1;
try {
for (int i = 0; i < runs && result == 0; i++) {
result = doRun();
}
return doRun();
} catch (Throwable t) {
t.printStackTrace();
result = -2;
return -2;
}
return result;
}
}

Expand Down
Binary file modified scripts/closure/compiler.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions scripts/compile_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,14 @@ def find_java():
common_closure_args = [
'--summary_detail_level', '3',
'--jscomp_error', 'visibility',
'--jscomp_warning', 'missingOverride',
'--compilation_level', 'SIMPLE_OPTIMIZATIONS',
'--warning_level', 'VERBOSE',
'--language_in=ES6_STRICT',
'--language_out=ES5_STRICT',
'--extra_annotation_name', 'suppressReceiverCheck',
'--extra_annotation_name', 'suppressGlobalPropertiesCheck',
'--checks-only',
'--module_output_path_prefix', to_platform_path_exact(modules_dir + path.sep)
]

Expand Down
2 changes: 1 addition & 1 deletion scripts/jsdoc_validator/build_jsdoc_validator_jar.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def build_artifacts():
manifest_file.write('Class-Path: %s\n' % closure_jar_relpath)
manifest_file.close()
javac_path = os.path.join(java_bin_path, 'javac')
javac_command = '%s -d %s -cp %s %s' % (javac_path, bin_path, rel_to_abs(closure_jar_relpath), ' '.join(java_files))
javac_command = '%s -target 7 -source 7 -d %s -cp %s %s' % (javac_path, bin_path, rel_to_abs(closure_jar_relpath), ' '.join(java_files))
run_and_communicate(javac_command, 'Error: javac returned %d')

print 'Building jar...'
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 @@
e944a4d9f5a4bf98fc18b1ccfca6480d1c27c1fbbd5b26598bd872f5174f4515 jsdoc_validator.jar
b6d10c9d0ef12d6051038223351b5fe230b57bf0047aefc5145474c1370c49cd src
319de712ff8525e97a66c586bb06ccdaef4b401fc833b91ba2dba40926226b12 jsdoc_validator.jar
a4bfb6df39509550e4eb5a2ec64c97dcd7b9939a958f5738652e5c145d8ce3f1 src
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 @@ -3,7 +3,10 @@
import com.google.javascript.jscomp.Compiler;
import com.google.javascript.jscomp.NodeTraversal;
import com.google.javascript.jscomp.parsing.Config;
import com.google.javascript.jscomp.parsing.Config.JsDocParsing;
import com.google.javascript.jscomp.parsing.Config.LanguageMode;
import com.google.javascript.jscomp.parsing.Config.StrictMode;
import com.google.javascript.jscomp.parsing.Config.RunMode;
import com.google.javascript.jscomp.parsing.ParserRunner;
import com.google.javascript.rhino.ErrorReporter;
import com.google.javascript.rhino.Node;
Expand Down Expand Up @@ -55,8 +58,9 @@ private String readScriptText() throws IOException {
}

private static Node parseScript(final ValidatorContext context) {
Config config = ParserRunner.createConfig(
true, true, true, LanguageMode.ECMASCRIPT5_STRICT, EXTRA_ANNOTATIONS);
Config config = ParserRunner.createConfig(LanguageMode.ECMASCRIPT6,
JsDocParsing.INCLUDE_DESCRIPTIONS_WITH_WHITESPACE, RunMode.KEEP_GOING,
EXTRA_ANNOTATIONS, true, StrictMode.STRICT);
ErrorReporter errorReporter = new ErrorReporter() {
@Override
public void warning(String message, String sourceName, int line, int lineOffset) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
public class AstUtil {
private static final String PROTOTYPE_SUFFIX = ".prototype";

static Node parentOfType(Node node, int tokenType) {
static Node parentOfType(Node node, Token tokenType) {
Node parent = node.getParent();
return (parent == null || parent.getType() != tokenType) ? null : parent;
return (parent == null || parent.getToken() != tokenType) ? null : parent;
}

/**
Expand All @@ -25,25 +25,25 @@ static Node getFunctionNameNode(Node node) {

Node parent = node.getParent();
if (parent != null) {
switch (parent.getType()) {
case Token.NAME:
switch (parent.getToken()) {
case NAME:
// var name = function() ...
// var name2 = function name1() ...
return parent;
// FIXME: Enable the setter and getter checks.
// case Token.SETTER_DEF:
// case Token.GETTER_DEF:
case Token.STRING_KEY:
// case SETTER_DEF:
// case GETTER_DEF:
case STRING_KEY:
return parent;
case Token.NUMBER:
case NUMBER:
return parent;
case Token.ASSIGN:
int nameType = parent.getFirstChild().getType();
case ASSIGN:
Token nameType = parent.getFirstChild().getToken();
// We only consider these types of name nodes as acceptable.
return nameType == Token.NAME || nameType == Token.GETPROP
? parent.getFirstChild()
: null;
case Token.VAR:
case VAR:
return parent.getFirstChild();
default:
Node funNameNode = node.getFirstChild();
Expand All @@ -66,7 +66,7 @@ static boolean isPrototypeName(String typeName) {
static Node getAssignedTypeNameNode(Node assignment) {
Preconditions.checkState(assignment.isAssign() || assignment.isVar());
Node typeNameNode = assignment.getFirstChild();
if (typeNameNode.getType() != Token.GETPROP && typeNameNode.getType() != Token.NAME) {
if (typeNameNode.getToken() != Token.GETPROP && typeNameNode.getToken() != Token.NAME) {
return null;
}
return typeNameNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ protected void setContext(ValidatorContext context) {

@Override
public void doVisit(Node node) {
switch (node.getType()) {
case Token.ASSIGN:
case Token.VAR:
switch (node.getToken()) {
case ASSIGN:
case VAR:
enterAssignOrVarNode(node);
break;
case Token.FUNCTION:
case FUNCTION:
enterFunctionNode(node);
break;
default:
Expand All @@ -46,11 +46,11 @@ public void doVisit(Node node) {
public void didVisit(Node node) {
leaveNode(node);

switch (node.getType()) {
case Token.ASSIGN:
switch (node.getToken()) {
case ASSIGN:
leaveAssignNode(node);
break;
case Token.FUNCTION:
case FUNCTION:
leaveFunctionNode(node);
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ public final class DisallowedGlobalPropertiesChecker extends ContextTrackingChec

@Override
protected void enterNode(Node node) {
switch (node.getType()) {
case Token.VAR:
switch (node.getToken()) {
case VAR:
handleVar(node);
break;
case Token.NAME:
case NAME:
handleName(node);
break;
case Token.STRING:
case STRING:
handleString(node);
break;
case Token.FUNCTION:
case Token.SCRIPT:
case FUNCTION:
case SCRIPT:
enterFunctionOrScript();
break;
default:
Expand All @@ -54,9 +54,9 @@ protected void enterNode(Node node) {

@Override
protected void leaveNode(Node node) {
switch (node.getType()) {
case Token.FUNCTION:
case Token.SCRIPT:
switch (node.getToken()) {
case FUNCTION:
case SCRIPT:
leaveFunctionOrScript();
break;
default:
Expand Down Expand Up @@ -104,7 +104,7 @@ private void handleVar(Node varNode) {

private void handleName(Node nameNode) {
Node parent = nameNode.getParent();
if (parent != null && parent.getType() == Token.FUNCTION) {
if (parent != null && parent.getToken() == Token.FUNCTION) {
return;
}

Expand All @@ -113,7 +113,7 @@ private void handleName(Node nameNode) {
return;
}

if (parent != null && parent.getType() == Token.GETPROP) {
if (parent != null && parent.getToken() == Token.GETPROP) {
boolean isGlobalPropertyAccess = parent.getFirstChild() == nameNode;
if (!isGlobalPropertyAccess) {
return;
Expand All @@ -129,7 +129,7 @@ private void handleString(Node stringNode) {
}

Node parent = stringNode.getParent();
if (parent == null || parent.getType() != Token.GETPROP) {
if (parent == null || parent.getToken() != Token.GETPROP) {
return;
}

Expand All @@ -151,7 +151,7 @@ private boolean isGlobalObject(Node node) {
if (!GLOBAL_OBJECT_NAMES.contains(name)) {
return false;
}
return node.getType() == Token.NAME
return node.getToken() == Token.NAME
&& !functionHasVisibleIdentifier(getCurrentFunction(), name);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ public final class FunctionReceiverChecker extends ContextTrackingChecker {

@Override
void enterNode(Node node) {
switch (node.getType()) {
case Token.CALL:
switch (node.getToken()) {
case CALL:
handleCall(node);
break;
case Token.FUNCTION: {
case FUNCTION: {
handleFunction(node);
break;
}
case Token.THIS: {
case THIS: {
handleThis();
break;
}
Expand Down Expand Up @@ -164,7 +164,7 @@ private boolean isReceiverSpecified(List<String> arguments) {

@Override
void leaveNode(Node node) {
if (node.getType() != Token.FUNCTION) {
if (node.getToken() != Token.FUNCTION) {
return;
}

Expand Down
Loading

0 comments on commit 5aea9cb

Please sign in to comment.