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

Side by Side Diff: third_party/closure_compiler/runner/src/com/google/javascript/jscomp/ChromePass.java

Issue 543863002: Typecheck chrome://bookmarks using Closure Compiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@true_master
Patch Set: remove runner.jar from CL Created 6 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package com.google.javascript.jscomp; 5 package com.google.javascript.jscomp;
6 6
7 import com.google.javascript.jscomp.NodeTraversal.AbstractPostOrderCallback; 7 import com.google.javascript.jscomp.NodeTraversal.AbstractPostOrderCallback;
8 import com.google.javascript.rhino.IR; 8 import com.google.javascript.rhino.IR;
9 import com.google.javascript.rhino.JSDocInfoBuilder; 9 import com.google.javascript.rhino.JSDocInfoBuilder;
10 import com.google.javascript.rhino.JSTypeExpression; 10 import com.google.javascript.rhino.JSTypeExpression;
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 NodeTraversal.traverse(compiler, functionBlock, new RenameInternalsToExt ernalsCallback( 307 NodeTraversal.traverse(compiler, functionBlock, new RenameInternalsToExt ernalsCallback(
308 namespace, exports, functionBlock)); 308 namespace, exports, functionBlock));
309 } 309 }
310 310
311 private Map<String, String> objectLitToMap(Node objectLit) { 311 private Map<String, String> objectLitToMap(Node objectLit) {
312 Map<String, String> res = new HashMap<String, String>(); 312 Map<String, String> res = new HashMap<String, String>();
313 313
314 for (Node keyNode : objectLit.children()) { 314 for (Node keyNode : objectLit.children()) {
315 String key = keyNode.getString(); 315 String key = keyNode.getString();
316 316
317 // TODO(vitalyp): Can dict value be other than a simple NAME? What i f NAME doesn't 317 Node valueNode = keyNode.getFirstChild();
318 // refer to a function/constructor? 318 if (valueNode.isName()) {
319 String value = keyNode.getFirstChild().getString(); 319 String value = keyNode.getFirstChild().getString();
320 320 res.put(value, key);
321 res.put(value, key); 321 }
322 } 322 }
323 323
324 return res; 324 return res;
325 } 325 }
326 326
327 /** 327 /**
328 * For a string "a.b.c" produce the following JS IR: 328 * For a string "a.b.c" produce the following JS IR:
329 * 329 *
330 * <p><pre> 330 * <p><pre>
331 * var a = a || {}; 331 * var a = a || {};
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } 446 }
447 } 447 }
448 448
449 private Node buildQualifiedName(Node internalName) { 449 private Node buildQualifiedName(Node internalName) {
450 String externalName = this.exports.get(internalName.getString()); 450 String externalName = this.exports.get(internalName.getString());
451 return NodeUtil.newQualifiedNameNode(compiler.getCodingConvention(), 451 return NodeUtil.newQualifiedNameNode(compiler.getCodingConvention(),
452 this.namespaceName + "." + externalName).srcrefTree(internal Name); 452 this.namespaceName + "." + externalName).srcrefTree(internal Name);
453 } 453 }
454 } 454 }
455 } 455 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698