|
47 | 47 | import org.jspecify.annotations.Nullable;
|
48 | 48 |
|
49 | 49 | /**
|
50 |
| - * A class for the internal representation of an input to the compiler. Wraps a {@link SourceAst} |
51 |
| - * and maintain state such as module for the input and whether the input is an extern. Also |
52 |
| - * calculates provided and required types. |
| 50 | + * A class for the internal representation of an input to the compiler. Wraps a {@link JsAst} and |
| 51 | + * maintain state such as module for the input and whether the input is an extern. Also calculates |
| 52 | + * provided and required types. |
53 | 53 | */
|
54 | 54 | public class CompilerInput implements DependencyInfo {
|
55 | 55 |
|
@@ -108,20 +108,20 @@ public CompilerInput(SourceFile file, InputId inputId) {
|
108 | 108 | }
|
109 | 109 |
|
110 | 110 | /**
|
111 |
| - * @deprecated the inputId is read from the SourceAst. Use CompilerInput(ast, isExtern) |
| 111 | + * @deprecated the inputId is read from the SourceFile. Use CompilerInput(file, isExtern) |
112 | 112 | */
|
113 | 113 | @Deprecated
|
114 | 114 | public CompilerInput(SourceFile sourceFile, String inputId, boolean isExtern) {
|
115 | 115 | this(sourceFile, new InputId(inputId), isExtern);
|
116 | 116 | }
|
117 | 117 |
|
118 | 118 | /**
|
119 |
| - * @deprecated the inputId is read from the SourceAst. Use CompilerInput(ast, isExtern) |
| 119 | + * @deprecated the inputId is read from the SourceFile. Use CompilerInput(file, isExtern) |
120 | 120 | */
|
121 | 121 | @Deprecated
|
122 | 122 | public CompilerInput(SourceFile sourceFile, InputId inputId, boolean isExtern) {
|
123 |
| - this.sourceFile = sourceFile; |
124 |
| - this.id = inputId; |
| 123 | + this.sourceFile = checkNotNull(sourceFile); |
| 124 | + this.id = checkNotNull(inputId); |
125 | 125 | if (isExtern) {
|
126 | 126 | setIsExtern();
|
127 | 127 | }
|
@@ -568,17 +568,10 @@ void overrideModule(JSChunk chunk) {
|
568 | 568 | }
|
569 | 569 |
|
570 | 570 | public boolean isExtern() {
|
571 |
| - if (sourceFile == null) { |
572 |
| - return false; |
573 |
| - } |
574 | 571 | return sourceFile.isExtern();
|
575 | 572 | }
|
576 | 573 |
|
577 | 574 | void setIsExtern() {
|
578 |
| - // TODO(tjgq): Add a precondition check here. People are passing in null, but they shouldn't be. |
579 |
| - if (sourceFile == null) { |
580 |
| - return; |
581 |
| - } |
582 | 575 | sourceFile.setKind(SourceKind.EXTERN);
|
583 | 576 | }
|
584 | 577 |
|
|
0 commit comments