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 |
Brian Wilkerson
2012/06/25 14:24:38
nit: copyright year
scheglov
2012/06/26 19:46:34
Done.
| |
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; | 5 package com.google.dart.compiler; |
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.common.collect.Sets; | |
9 import com.google.dart.compiler.ast.DartUnit; | 10 import com.google.dart.compiler.ast.DartUnit; |
10 import com.google.dart.compiler.ast.LibraryUnit; | 11 import com.google.dart.compiler.ast.LibraryUnit; |
11 import com.google.dart.compiler.metrics.CompilerMetrics; | 12 import com.google.dart.compiler.metrics.CompilerMetrics; |
12 import com.google.dart.compiler.parser.DartParser; | 13 import com.google.dart.compiler.parser.DartParser; |
13 | 14 |
14 import java.io.IOException; | 15 import java.io.IOException; |
15 import java.io.Reader; | 16 import java.io.Reader; |
16 import java.io.Writer; | 17 import java.io.Writer; |
17 import java.net.URI; | 18 import java.net.URI; |
18 import java.util.Collections; | 19 import java.util.Collections; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 return getAppLibraryUnit(); | 84 return getAppLibraryUnit(); |
84 } | 85 } |
85 | 86 |
86 @Override | 87 @Override |
87 public LibraryUnit getAppLibraryUnit() { | 88 public LibraryUnit getAppLibraryUnit() { |
88 // use double-checked looking pattern with use of volatile | 89 // use double-checked looking pattern with use of volatile |
89 if (appLibraryUnit == null) { | 90 if (appLibraryUnit == null) { |
90 synchronized (this) { | 91 synchronized (this) { |
91 if (appLibraryUnit == null) { | 92 if (appLibraryUnit == null) { |
92 try { | 93 try { |
93 appLibraryUnit = | 94 appLibraryUnit = new DartParser(lib, DartParser.read(lib), false, |
94 DartParser.getSourceParser(lib, listener).preProcessLibraryDirec tives(lib); | 95 Sets.<String> newHashSet(), listener, null).preProcessLibraryDir ectives(lib); |
95 } catch (IOException e) { | 96 } catch (IOException e) { |
96 onError(new DartCompilationError(lib, DartCompilerErrorCode.IO, e.ge tMessage())); | 97 onError(new DartCompilationError(lib, DartCompilerErrorCode.IO, e.ge tMessage())); |
97 return null; | 98 return null; |
98 } | 99 } |
99 } | 100 } |
100 } | 101 } |
101 } | 102 } |
102 return appLibraryUnit; | 103 return appLibraryUnit; |
103 } | 104 } |
104 | 105 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 public int getTypeErrorCount() { | 142 public int getTypeErrorCount() { |
142 return typeErrorCount.get(); | 143 return typeErrorCount.get(); |
143 } | 144 } |
144 | 145 |
145 @Override | 146 @Override |
146 public LibraryUnit getLibraryUnit(LibrarySource libSrc) { | 147 public LibraryUnit getLibraryUnit(LibrarySource libSrc) { |
147 if (libSrc == lib) { | 148 if (libSrc == lib) { |
148 return getApplicationUnit(); | 149 return getApplicationUnit(); |
149 } | 150 } |
150 try { | 151 try { |
151 return DartParser.getSourceParser(libSrc, listener).preProcessLibraryDirec tives(libSrc); | 152 return new DartParser(libSrc, DartParser.read(libSrc), false, |
153 Sets.<String> newHashSet(), listener, null).preProcessLibraryDirective s(libSrc); | |
152 } catch (IOException e) { | 154 } catch (IOException e) { |
153 onError(new DartCompilationError(libSrc, DartCompilerErrorCode.IO, e.getMe ssage())); | 155 onError(new DartCompilationError(libSrc, DartCompilerErrorCode.IO, e.getMe ssage())); |
154 return null; | 156 return null; |
155 } | 157 } |
156 } | 158 } |
157 | 159 |
158 @Override | 160 @Override |
159 public boolean isOutOfDate(Source source, Source base, String extension) { | 161 public boolean isOutOfDate(Source source, Source base, String extension) { |
160 return provider.isOutOfDate(source, base, extension); | 162 return provider.isOutOfDate(source, base, extension); |
161 } | 163 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 @Override | 203 @Override |
202 public void unitAboutToCompile(DartSource source, boolean diet) { | 204 public void unitAboutToCompile(DartSource source, boolean diet) { |
203 listener.unitAboutToCompile(source, diet); | 205 listener.unitAboutToCompile(source, diet); |
204 } | 206 } |
205 | 207 |
206 @Override | 208 @Override |
207 public void unitCompiled(DartUnit unit) { | 209 public void unitCompiled(DartUnit unit) { |
208 listener.unitCompiled(unit); | 210 listener.unitCompiled(unit); |
209 } | 211 } |
210 } | 212 } |
OLD | NEW |