Chromium Code Reviews| 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.dart; | 5 library analyzer.src.task.dart; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/visitor.dart'; | 10 import 'package:analyzer/dart/ast/visitor.dart'; |
| (...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1222 TaskDescriptor get descriptor => DESCRIPTOR; | 1222 TaskDescriptor get descriptor => DESCRIPTOR; |
| 1223 | 1223 |
| 1224 @override | 1224 @override |
| 1225 void internalPerform() { | 1225 void internalPerform() { |
| 1226 // | 1226 // |
| 1227 // Prepare inputs. | 1227 // Prepare inputs. |
| 1228 // | 1228 // |
| 1229 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); | 1229 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
| 1230 CompilationUnit unit = getRequiredInput(UNIT_INPUT); | 1230 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 1231 // | 1231 // |
| 1232 // Build the enum members if they have not already been created. | |
| 1233 // | |
| 1234 EnumDeclaration findFirstEnum() { | |
| 1235 for (CompilationUnitMember member in unit.declarations) { | |
| 1236 if (member is EnumDeclaration) { | |
| 1237 return member; | |
| 1238 } | |
| 1239 } | |
| 1240 return null; | |
| 1241 } | |
| 1242 EnumDeclaration firstEnum = findFirstEnum(); | |
|
scheglov
2016/01/26 21:51:04
This could be done with less code.
EnumDeclara
Brian Wilkerson
2016/01/26 21:59:42
I discovered firstWhere, but didn't notice the orE
| |
| 1243 if (firstEnum != null && firstEnum.element.accessors.isEmpty) { | |
| 1244 EnumMemberBuilder builder = new EnumMemberBuilder(typeProvider); | |
| 1245 unit.accept(builder); | |
| 1246 } | |
| 1247 // | |
| 1232 // Record outputs. | 1248 // Record outputs. |
| 1233 // | 1249 // |
| 1234 EnumMemberBuilder builder = new EnumMemberBuilder(typeProvider); | |
| 1235 unit.accept(builder); | |
| 1236 outputs[CREATED_RESOLVED_UNIT2] = true; | 1250 outputs[CREATED_RESOLVED_UNIT2] = true; |
| 1237 outputs[RESOLVED_UNIT2] = unit; | 1251 outputs[RESOLVED_UNIT2] = unit; |
| 1238 } | 1252 } |
| 1239 | 1253 |
| 1240 /** | 1254 /** |
| 1241 * Return a map from the names of the inputs of this kind of task to the task | 1255 * Return a map from the names of the inputs of this kind of task to the task |
| 1242 * input descriptors describing those inputs for a task with the | 1256 * input descriptors describing those inputs for a task with the |
| 1243 * given [target]. | 1257 * given [target]. |
| 1244 */ | 1258 */ |
| 1245 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 1259 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| (...skipping 4202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5448 | 5462 |
| 5449 @override | 5463 @override |
| 5450 bool moveNext() { | 5464 bool moveNext() { |
| 5451 if (_newSources.isEmpty) { | 5465 if (_newSources.isEmpty) { |
| 5452 return false; | 5466 return false; |
| 5453 } | 5467 } |
| 5454 currentTarget = _newSources.removeLast(); | 5468 currentTarget = _newSources.removeLast(); |
| 5455 return true; | 5469 return true; |
| 5456 } | 5470 } |
| 5457 } | 5471 } |
| OLD | NEW |