| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package com.google.dart.compiler.ast; | 5 package com.google.dart.compiler.ast; |
| 6 | 6 |
| 7 import com.google.common.collect.Lists; | 7 import com.google.common.collect.Lists; |
| 8 import com.google.common.collect.Maps; | 8 import com.google.common.collect.Maps; |
| 9 import com.google.dart.compiler.DartCompiler; | 9 import com.google.dart.compiler.DartCompiler; |
| 10 import com.google.dart.compiler.DartCompilerContext; | 10 import com.google.dart.compiler.DartCompilerContext; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 element = Elements.libraryElement(this); | 66 element = Elements.libraryElement(this); |
| 67 | 67 |
| 68 // get the name part of the path, since it needs to be relative | 68 // get the name part of the path, since it needs to be relative |
| 69 // TODO(jbrosenberg): change this to use lazy init | 69 // TODO(jbrosenberg): change this to use lazy init |
| 70 // Note: We don't want an encoded relative path. | 70 // Note: We don't want an encoded relative path. |
| 71 String self = libSource.getUri().getSchemeSpecificPart(); | 71 String self = libSource.getUri().getSchemeSpecificPart(); |
| 72 int lastSlash; | 72 int lastSlash; |
| 73 if ((lastSlash = self.lastIndexOf('/')) > -1) { | 73 if ((lastSlash = self.lastIndexOf('/')) > -1) { |
| 74 self = self.substring(lastSlash + 1); | 74 self = self.substring(lastSlash + 1); |
| 75 } | 75 } |
| 76 selfSourcePath = new LibraryNode(self); | 76 selfSourcePath = new LibraryNode(self); |
| 77 } | 77 } |
| 78 | 78 |
| 79 public void addImportPath(LibraryNode path) { | 79 public void addImportPath(LibraryNode path) { |
| 80 assert path != null; | 80 assert path != null; |
| 81 importPaths.add(path); | 81 importPaths.add(path); |
| 82 } | 82 } |
| 83 | 83 |
| 84 public void addSourcePath(LibraryNode path) { | 84 public void addSourcePath(LibraryNode path) { |
| 85 assert path != null; | 85 assert path != null; |
| 86 sourcePaths.add(path); | 86 sourcePaths.add(path); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 /** | 166 /** |
| 167 * Return all prefixes used by this library. | 167 * Return all prefixes used by this library. |
| 168 */ | 168 */ |
| 169 public Set<String> getPrefixes() { | 169 public Set<String> getPrefixes() { |
| 170 return new HashSet<String>(prefixes.values()); | 170 return new HashSet<String>(prefixes.values()); |
| 171 } | 171 } |
| 172 | 172 |
| 173 /** | 173 /** |
| 174 * Return the path for dart source that corresponds to the same dart file as | 174 * Return the path for dart source that corresponds to the same dart file as |
| 175 * this library unit. This is added to the set of sourcePaths for this unit. | 175 * this library unit. This is added to the set of sourcePaths for this unit. |
| 176 * | 176 * |
| 177 * @return the self source path for this unit. | 177 * @return the self source path for this unit. |
| 178 */ | 178 */ |
| 179 public LibraryNode getSelfSourcePath() { | 179 public LibraryNode getSelfSourcePath() { |
| 180 return selfSourcePath; | 180 return selfSourcePath; |
| 181 } | 181 } |
| 182 | 182 |
| 183 /** | 183 /** |
| 184 * Answer the source associated with this unit | 184 * Answer the source associated with this unit |
| 185 * | 185 * |
| 186 * @return the library source (not <code>null</code>) | 186 * @return the library source (not <code>null</code>) |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 259 |
| 260 /** | 260 /** |
| 261 * Writes this library's associated dependencies. | 261 * Writes this library's associated dependencies. |
| 262 */ | 262 */ |
| 263 public void writeDeps(DartCompilerContext context) throws IOException { | 263 public void writeDeps(DartCompilerContext context) throws IOException { |
| 264 Writer writer = context.getArtifactWriter(libSource, "", DartCompiler.EXTENS
ION_DEPS); | 264 Writer writer = context.getArtifactWriter(libSource, "", DartCompiler.EXTENS
ION_DEPS); |
| 265 deps.write(writer); | 265 deps.write(writer); |
| 266 writer.close(); | 266 writer.close(); |
| 267 } | 267 } |
| 268 } | 268 } |
| OLD | NEW |