OLD | NEW |
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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 } | 250 } |
251 | 251 |
252 private void visitExportPath(Node crExportPathNode, Node parent) { | 252 private void visitExportPath(Node crExportPathNode, Node parent) { |
253 if (crExportPathNode.getChildCount() < 2) { | 253 if (crExportPathNode.getChildCount() < 2) { |
254 compiler.report(JSError.make(crExportPathNode, CR_EXPORT_PATH_TOO_FE
W_ARGUMENTS)); | 254 compiler.report(JSError.make(crExportPathNode, CR_EXPORT_PATH_TOO_FE
W_ARGUMENTS)); |
255 return; | 255 return; |
256 } | 256 } |
257 | 257 |
258 Node pathArg = crExportPathNode.getChildAtIndex(1); | 258 Node pathArg = crExportPathNode.getChildAtIndex(1); |
259 if (pathArg.isString()) { | 259 if (pathArg.isString()) { |
| 260 // TODO(dbeam): support cr.exportPath('ns').value. |
260 createAndInsertObjectsForQualifiedName(parent, pathArg.getString()); | 261 createAndInsertObjectsForQualifiedName(parent, pathArg.getString()); |
261 } | 262 } |
262 } | 263 } |
263 | 264 |
264 private void createAndInsertObjectsForQualifiedName(Node scriptChild, String
namespace) { | 265 private void createAndInsertObjectsForQualifiedName(Node scriptChild, String
namespace) { |
265 List<Node> objectsForQualifiedName = createObjectsForQualifiedName(names
pace); | 266 List<Node> objectsForQualifiedName = createObjectsForQualifiedName(names
pace); |
266 for (Node n : objectsForQualifiedName) { | 267 for (Node n : objectsForQualifiedName) { |
267 scriptChild.getParent().addChildBefore(n, scriptChild); | 268 scriptChild.getParent().addChildBefore(n, scriptChild); |
268 } | 269 } |
269 } | 270 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 } | 447 } |
447 } | 448 } |
448 | 449 |
449 private Node buildQualifiedName(Node internalName) { | 450 private Node buildQualifiedName(Node internalName) { |
450 String externalName = this.exports.get(internalName.getString()); | 451 String externalName = this.exports.get(internalName.getString()); |
451 return NodeUtil.newQName(compiler, this.namespaceName + "." + extern
alName).srcrefTree( | 452 return NodeUtil.newQName(compiler, this.namespaceName + "." + extern
alName).srcrefTree( |
452 internalName); | 453 internalName); |
453 } | 454 } |
454 } | 455 } |
455 } | 456 } |
OLD | NEW |