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

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

Issue 613763005: closure: update from closure compiler's src and rebuild runner.jar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebuild runner, too Created 6 years, 2 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
« no previous file with comments | « third_party/closure_compiler/runner/runner.jar ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 private void visitPropertyDefinition(Node call, Node parent) { 117 private void visitPropertyDefinition(Node call, Node parent) {
118 Node callee = call.getFirstChild(); 118 Node callee = call.getFirstChild();
119 String target = call.getChildAtIndex(1).getQualifiedName(); 119 String target = call.getChildAtIndex(1).getQualifiedName();
120 if (callee.matchesQualifiedName(CR_DEFINE_PROPERTY) && !target.endsWith( ".prototype")) { 120 if (callee.matchesQualifiedName(CR_DEFINE_PROPERTY) && !target.endsWith( ".prototype")) {
121 target += ".prototype"; 121 target += ".prototype";
122 } 122 }
123 123
124 Node property = call.getChildAtIndex(2); 124 Node property = call.getChildAtIndex(2);
125 125
126 Node getPropNode = NodeUtil.newQualifiedNameNode(compiler.getCodingConve ntion(), 126 Node getPropNode = NodeUtil.newQName(
127 target + "." + property.getString()).srcrefTree(call); 127 compiler, target + "." + property.getString()).srcrefTree(call);
128 128
129 if (callee.matchesQualifiedName(CR_DEFINE_PROPERTY)) { 129 if (callee.matchesQualifiedName(CR_DEFINE_PROPERTY)) {
130 setJsDocWithType(getPropNode, getTypeByCrPropertyKind(call.getChildA tIndex(3))); 130 setJsDocWithType(getPropNode, getTypeByCrPropertyKind(call.getChildA tIndex(3)));
131 } else { 131 } else {
132 setJsDocWithType(getPropNode, new Node(Token.QMARK)); 132 setJsDocWithType(getPropNode, new Node(Token.QMARK));
133 } 133 }
134 134
135 Node definitionNode = IR.exprResult(getPropNode).srcref(parent); 135 Node definitionNode = IR.exprResult(getPropNode).srcref(parent);
136 136
137 parent.getParent().addChildAfter(definitionNode, parent); 137 parent.getParent().addChildAfter(definitionNode, parent);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 return node.isExprResult() && (getPropNode = node.getFirstChild()).isGet Prop() && 226 return node.isExprResult() && (getPropNode = node.getFirstChild()).isGet Prop() &&
227 getPropNode.getQualifiedName().startsWith(prototype + "."); 227 getPropNode.getQualifiedName().startsWith(prototype + ".");
228 } 228 }
229 229
230 private boolean maybeAddPublicDeclaration(String field, Set<String> publicAP IStrings, 230 private boolean maybeAddPublicDeclaration(String field, Set<String> publicAP IStrings,
231 String className, Node jsDocSourceNode, Node scope, Node exprResult) { 231 String className, Node jsDocSourceNode, Node scope, Node exprResult) {
232 boolean changesMade = false; 232 boolean changesMade = false;
233 if (field.endsWith("_")) { 233 if (field.endsWith("_")) {
234 String publicName = field.substring(0, field.length() - 1); 234 String publicName = field.substring(0, field.length() - 1);
235 if (publicAPIStrings.contains(publicName)) { 235 if (publicAPIStrings.contains(publicName)) {
236 Node methodDeclaration = NodeUtil.newQualifiedNameNode( 236 Node methodDeclaration = NodeUtil.newQName(compiler, className + "." + publicName);
237 compiler.getCodingConvention(), className + "." + public Name);
238 if (jsDocSourceNode.getJSDocInfo() != null) { 237 if (jsDocSourceNode.getJSDocInfo() != null) {
239 methodDeclaration.setJSDocInfo(jsDocSourceNode.getJSDocInfo( )); 238 methodDeclaration.setJSDocInfo(jsDocSourceNode.getJSDocInfo( ));
240 scope.addChildBefore( 239 scope.addChildBefore(
241 IR.exprResult(methodDeclaration).srcrefTree(exprResu lt), 240 IR.exprResult(methodDeclaration).srcrefTree(exprResu lt),
242 exprResult); 241 exprResult);
243 changesMade = true; 242 changesMade = true;
244 } else { 243 } else {
245 compiler.report(JSError.make(jsDocSourceNode, CR_MAKE_PUBLIC _HAS_NO_JSDOC)); 244 compiler.report(JSError.make(jsDocSourceNode, CR_MAKE_PUBLIC _HAS_NO_JSDOC));
246 } 245 }
247 publicAPIStrings.remove(publicName); 246 publicAPIStrings.remove(publicName);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 parent.putBooleanProp(Node.FREE_CALL, false); 440 parent.putBooleanProp(Node.FREE_CALL, false);
442 } 441 }
443 442
444 parent.replaceChild(n, newNode); 443 parent.replaceChild(n, newNode);
445 } 444 }
446 } 445 }
447 } 446 }
448 447
449 private Node buildQualifiedName(Node internalName) { 448 private Node buildQualifiedName(Node internalName) {
450 String externalName = this.exports.get(internalName.getString()); 449 String externalName = this.exports.get(internalName.getString());
451 return NodeUtil.newQualifiedNameNode(compiler.getCodingConvention(), 450 return NodeUtil.newQName(compiler, this.namespaceName + "." + extern alName).srcrefTree(
452 this.namespaceName + "." + externalName).srcrefTree(internal Name); 451 internalName);
453 } 452 }
454 } 453 }
455 } 454 }
OLDNEW
« no previous file with comments | « third_party/closure_compiler/runner/runner.jar ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698