| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 package com.google.dart.compiler; | |
| 6 | |
| 7 import com.google.dart.compiler.ast.LibraryUnit; | |
| 8 import com.google.dart.compiler.metrics.CompilerMetrics; | |
| 9 | |
| 10 import java.io.IOException; | |
| 11 import java.io.Reader; | |
| 12 import java.io.Writer; | |
| 13 import java.net.URI; | |
| 14 | |
| 15 /** | |
| 16 * An interface used internally by the {@link DartCompiler} for determining wher
e an artifact should | |
| 17 * be generated and providing feedback during the compilation process. This is a
n internal compiler | |
| 18 * construct and as such should not be instantiated or implemented by those outs
ide the compiler | |
| 19 * itself. | |
| 20 */ | |
| 21 public interface DartCompilerContext { | |
| 22 | |
| 23 /** | |
| 24 * Parse the application being compiled and return the result. The "applicatio
n unit" is a | |
| 25 * library that specifies an entry-point. | |
| 26 * | |
| 27 * This method will be removed in favor of {@link #getAppLibraryUnit()}. | |
| 28 * | |
| 29 * @return the parsed result (not <code>null</code>) | |
| 30 */ | |
| 31 LibraryUnit getApplicationUnit(); | |
| 32 | |
| 33 /** | |
| 34 * Parse the application being compiled and return the result. The "app" libra
ry unit is a | |
| 35 * library that specifies an entry-point. | |
| 36 * | |
| 37 * @return the parsed result (not <code>null</code>) | |
| 38 */ | |
| 39 LibraryUnit getAppLibraryUnit(); | |
| 40 | |
| 41 /** | |
| 42 * Parse the specified library and return the result. | |
| 43 * | |
| 44 * @param lib the library to parse (not <code>null</code>) | |
| 45 * @return the parsed result (not <code>null</code>) | |
| 46 */ | |
| 47 LibraryUnit getLibraryUnit(LibrarySource lib); | |
| 48 | |
| 49 /** | |
| 50 * Called by the compiler when a error (fatal or non-fatal) has occurred in a
Dart file. | |
| 51 * | |
| 52 * @param event the event information (not <code>null</code>) | |
| 53 */ | |
| 54 void onError(DartCompilationError event); | |
| 55 | |
| 56 /** | |
| 57 * Gets a reader for an artifact associated with the specified source, which | |
| 58 * must have been written to {@link #getArtifactWriter(Source, String, String)
}. The | |
| 59 * caller is responsible for closing the reader. Only one artifact may be | |
| 60 * associated with the given extension. | |
| 61 * | |
| 62 * @param source the source file (not <code>null</code>) | |
| 63 * @param part a component of the source file to get a reader for (may be empt
y). | |
| 64 * @param extension the file extension for this artifact (not | |
| 65 * <code>null</code>, not empty) | |
| 66 * @return the reader, or <code>null</code> if no such artifact exists | |
| 67 */ | |
| 68 Reader getArtifactReader(Source source, String part, String extension) throws
IOException; | |
| 69 | |
| 70 /** | |
| 71 * Gets the {@link URI} for an artifact associated with this source. | |
| 72 * | |
| 73 * @param source the source file (not <code>null</code>) | |
| 74 * @param part a component of the source file to get a reader for (may be empt
y). | |
| 75 * @param extension the file extension for this artifact (not | |
| 76 * <code>null</code>, not empty) | |
| 77 */ | |
| 78 URI getArtifactUri(DartSource source, String part, String extension); | |
| 79 | |
| 80 /** | |
| 81 * Gets a writer for an artifact associated with this source. The caller is | |
| 82 * responsible for closing the writer. Only one artifact may be associated | |
| 83 * with the given extension. | |
| 84 * | |
| 85 * @param source the source file (not <code>null</code>) | |
| 86 * @param part a component of the source file to get a reader for (may be empt
y). | |
| 87 * @param extension the file extension for this artifact (not | |
| 88 * <code>null</code>, not empty) | |
| 89 */ | |
| 90 Writer getArtifactWriter(Source source, String part, String extension) throws
IOException; | |
| 91 | |
| 92 /** | |
| 93 * Determines whether an artifact for the specified source is out of date | |
| 94 * with respect to some other source. | |
| 95 * | |
| 96 * @param source the source file to check (not <code>null</code>) | |
| 97 * @param base the artifact's base source (not <code>null</code>) | |
| 98 * @param extension the file extension for this artifact (not | |
| 99 * <code>null</code>, not empty) | |
| 100 * @return <code>true</code> if out of date | |
| 101 */ | |
| 102 boolean isOutOfDate(Source source, Source base, String extension); | |
| 103 | |
| 104 /** | |
| 105 * Returns the {@link CompilerMetrics} instance or <code>null</code> if we sho
uld not record | |
| 106 * metrics. | |
| 107 * | |
| 108 * @return the metrics instance, <code>null</code> if metrics should not be re
corded | |
| 109 */ | |
| 110 CompilerMetrics getCompilerMetrics(); | |
| 111 | |
| 112 /** | |
| 113 * Returns the {@link CompilerConfiguration} instance. | |
| 114 * @return the compiler configuration instance. | |
| 115 */ | |
| 116 CompilerConfiguration getCompilerConfiguration(); | |
| 117 | |
| 118 /** | |
| 119 * Return the system library corresponding to the specified "dart:<libname>" s
pec. | |
| 120 */ | |
| 121 LibrarySource getSystemLibraryFor(String importSpec); | |
| 122 } | |
| OLD | NEW |