OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Dart project authors. | 2 * Copyright 2012 Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
11 * or implied. See the License for the specific language governing permissions a
nd limitations under | 11 * or implied. See the License for the specific language governing permissions a
nd limitations under |
12 * the License. | 12 * the License. |
13 */ | 13 */ |
14 package com.google.dart.compiler.parser; | 14 package com.google.dart.compiler.parser; |
15 | 15 |
| 16 import com.google.dart.compiler.DartCompilerListener; |
| 17 import com.google.dart.compiler.Source; |
16 import com.google.dart.compiler.ast.DartImportDirective; | 18 import com.google.dart.compiler.ast.DartImportDirective; |
17 import com.google.dart.compiler.ast.DartStringLiteral; | 19 import com.google.dart.compiler.ast.DartStringLiteral; |
| 20 import com.google.dart.compiler.metrics.CompilerMetrics; |
18 | 21 |
19 import java.util.Set; | 22 import java.util.Set; |
20 | 23 |
21 /** | 24 /** |
22 * An extension of {@link DartParser} that updates the prefixes collection | 25 * An extension of {@link DartParser} that updates the prefixes collection |
23 */ | 26 */ |
24 public class DartPrefixParser extends DartParser { | 27 public class DartPrefixParser extends DartParser { |
25 | 28 |
26 private final Set<String> prefixes; | 29 private final Set<String> prefixes; |
27 | 30 |
28 public DartPrefixParser(ParserContext parserCtx, boolean isDietParse, Set<Stri
ng> prefixes) { | 31 public DartPrefixParser( |
29 super(parserCtx, isDietParse, prefixes); | 32 Source source, |
| 33 String sourceCode, |
| 34 boolean isDietParse, |
| 35 Set<String> prefixes, |
| 36 DartCompilerListener listener, |
| 37 CompilerMetrics compilerMetrics) { |
| 38 super(source, sourceCode, isDietParse, prefixes, listener, compilerMetrics); |
30 this.prefixes = prefixes; | 39 this.prefixes = prefixes; |
31 } | 40 } |
32 | 41 |
33 @Override | 42 @Override |
34 protected DartImportDirective parseImportDirective() { | 43 protected DartImportDirective parseImportDirective() { |
35 DartImportDirective directive = super.parseImportDirective(); | 44 DartImportDirective directive = super.parseImportDirective(); |
36 DartStringLiteral prefix = directive.getPrefix(); | 45 DartStringLiteral prefix = directive.getPrefix(); |
37 if (prefix != null) { | 46 if (prefix != null) { |
38 prefixes.add(prefix.getValue()); | 47 prefixes.add(prefix.getValue()); |
39 } | 48 } |
40 return directive; | 49 return directive; |
41 } | 50 } |
42 } | 51 } |
43 | 52 |
OLD | NEW |