OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.src.task.html; | 5 library analyzer.src.task.html; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/src/context/cache.dart'; | 9 import 'package:analyzer/src/context/cache.dart'; |
10 import 'package:analyzer/src/dart/scanner/scanner.dart'; | 10 import 'package:analyzer/src/dart/scanner/scanner.dart'; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 libraries.isEmpty ? Source.EMPTY_LIST : libraries; | 159 libraries.isEmpty ? Source.EMPTY_LIST : libraries; |
160 outputs[DART_SCRIPTS] = | 160 outputs[DART_SCRIPTS] = |
161 inlineScripts.isEmpty ? DartScript.EMPTY_LIST : inlineScripts; | 161 inlineScripts.isEmpty ? DartScript.EMPTY_LIST : inlineScripts; |
162 } | 162 } |
163 | 163 |
164 /** | 164 /** |
165 * Return a map from the names of the inputs of this kind of task to the task | 165 * Return a map from the names of the inputs of this kind of task to the task |
166 * input descriptors describing those inputs for a task with the | 166 * input descriptors describing those inputs for a task with the |
167 * given [target]. | 167 * given [target]. |
168 */ | 168 */ |
169 static Map<String, TaskInput> buildInputs(Source target) { | 169 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
170 return <String, TaskInput>{DOCUMENT_INPUT: HTML_DOCUMENT.of(target)}; | 170 return <String, TaskInput>{DOCUMENT_INPUT: HTML_DOCUMENT.of(target)}; |
171 } | 171 } |
172 | 172 |
173 /** | 173 /** |
174 * Create a [DartScriptsTask] based on the given [target] in the given | 174 * Create a [DartScriptsTask] based on the given [target] in the given |
175 * [context]. | 175 * [context]. |
176 */ | 176 */ |
177 static DartScriptsTask createTask( | 177 static DartScriptsTask createTask( |
178 AnalysisContext context, AnalysisTarget target) { | 178 AnalysisContext context, AnalysisTarget target) { |
179 return new DartScriptsTask(context, target); | 179 return new DartScriptsTask(context, target); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // Record outputs. | 230 // Record outputs. |
231 // | 231 // |
232 outputs[HTML_ERRORS] = AnalysisError.mergeLists(errorLists); | 232 outputs[HTML_ERRORS] = AnalysisError.mergeLists(errorLists); |
233 } | 233 } |
234 | 234 |
235 /** | 235 /** |
236 * Return a map from the names of the inputs of this kind of task to the task | 236 * Return a map from the names of the inputs of this kind of task to the task |
237 * input descriptors describing those inputs for a task with the | 237 * input descriptors describing those inputs for a task with the |
238 * given [target]. | 238 * given [target]. |
239 */ | 239 */ |
240 static Map<String, TaskInput> buildInputs(Source target) { | 240 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
241 EnginePlugin enginePlugin = AnalysisEngine.instance.enginePlugin; | 241 EnginePlugin enginePlugin = AnalysisEngine.instance.enginePlugin; |
242 Map<String, TaskInput> inputs = <String, TaskInput>{ | 242 Map<String, TaskInput> inputs = <String, TaskInput>{ |
243 DART_ERRORS_INPUT: DART_SCRIPTS.of(target).toListOf(DART_ERRORS) | 243 DART_ERRORS_INPUT: DART_SCRIPTS.of(target).toListOf(DART_ERRORS) |
244 }; | 244 }; |
245 for (ResultDescriptor result in enginePlugin.htmlErrors) { | 245 for (ResultDescriptor result in enginePlugin.htmlErrors) { |
246 String inputName = result.name + INPUT_SUFFIX; | 246 String inputName = result.name + INPUT_SUFFIX; |
247 inputs[inputName] = result.of(target); | 247 inputs[inputName] = result.of(target); |
248 } | 248 } |
249 return inputs; | 249 return inputs; |
250 } | 250 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 outputs[HTML_DOCUMENT_ERRORS] = errors; | 335 outputs[HTML_DOCUMENT_ERRORS] = errors; |
336 outputs[LINE_INFO] = _computeLineInfo(content); | 336 outputs[LINE_INFO] = _computeLineInfo(content); |
337 } | 337 } |
338 } | 338 } |
339 | 339 |
340 /** | 340 /** |
341 * Return a map from the names of the inputs of this kind of task to the task | 341 * Return a map from the names of the inputs of this kind of task to the task |
342 * input descriptors describing those inputs for a task with the given | 342 * input descriptors describing those inputs for a task with the given |
343 * [source]. | 343 * [source]. |
344 */ | 344 */ |
345 static Map<String, TaskInput> buildInputs(Source source) { | 345 static Map<String, TaskInput> buildInputs(AnalysisTarget source) { |
346 return <String, TaskInput>{CONTENT_INPUT_NAME: CONTENT.of(source)}; | 346 return <String, TaskInput>{CONTENT_INPUT_NAME: CONTENT.of(source)}; |
347 } | 347 } |
348 | 348 |
349 /** | 349 /** |
350 * Create a [ParseHtmlTask] based on the given [target] in the given [context]
. | 350 * Create a [ParseHtmlTask] based on the given [target] in the given [context]
. |
351 */ | 351 */ |
352 static ParseHtmlTask createTask( | 352 static ParseHtmlTask createTask( |
353 AnalysisContext context, AnalysisTarget target) { | 353 AnalysisContext context, AnalysisTarget target) { |
354 return new ParseHtmlTask(context, target); | 354 return new ParseHtmlTask(context, target); |
355 } | 355 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 * The content of the fragment. | 402 * The content of the fragment. |
403 */ | 403 */ |
404 final String content; | 404 final String content; |
405 | 405 |
406 /** | 406 /** |
407 * Initialize a newly created script fragment to have the given [offset] and | 407 * Initialize a newly created script fragment to have the given [offset] and |
408 * [content]. | 408 * [content]. |
409 */ | 409 */ |
410 ScriptFragment(this.offset, this.line, this.column, this.content); | 410 ScriptFragment(this.offset, this.line, this.column, this.content); |
411 } | 411 } |
OLD | NEW |