| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'package:analyzer/src/codegen/tools.dart'; | 5 import 'package:analyzer/src/codegen/tools.dart'; |
| 6 | 6 |
| 7 import 'api.dart'; | 7 import 'api.dart'; |
| 8 import 'codegen_dart.dart'; | 8 import 'codegen_dart.dart'; |
| 9 import 'from_html.dart'; | 9 import 'from_html.dart'; |
| 10 | 10 |
| 11 final GeneratedFile target = | 11 final GeneratedFile target = new GeneratedFile( |
| 12 new GeneratedFile('lib/protocol/protocol_constants.dart', (String pkgPath) { | 12 'lib/protocol/protocol_constants.dart', (String pkgPath) async { |
| 13 CodegenVisitor visitor = new CodegenVisitor(readApi(pkgPath)); | 13 CodegenVisitor visitor = new CodegenVisitor(readApi(pkgPath)); |
| 14 return visitor.collectCode(visitor.visitApi); | 14 return visitor.collectCode(visitor.visitApi); |
| 15 }); | 15 }); |
| 16 | 16 |
| 17 /** | 17 /** |
| 18 * A visitor that produces Dart code defining constants associated with the API. | 18 * A visitor that produces Dart code defining constants associated with the API. |
| 19 */ | 19 */ |
| 20 class CodegenVisitor extends DartCodegenVisitor with CodeGenerator { | 20 class CodegenVisitor extends DartCodegenVisitor with CodeGenerator { |
| 21 CodegenVisitor(Api api) : super(api) { | 21 CodegenVisitor(Api api) : super(api) { |
| 22 codeGeneratorSettings.commentLineLength = 79; | 22 codeGeneratorSettings.commentLineLength = 79; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 int index = first.indexOf(regExp, start); | 160 int index = first.indexOf(regExp, start); |
| 161 while (index >= 0) { | 161 while (index >= 0) { |
| 162 components.add(first.substring(start - 1, index)); | 162 components.add(first.substring(start - 1, index)); |
| 163 start = index + 1; | 163 start = index + 1; |
| 164 index = first.indexOf(regExp, start); | 164 index = first.indexOf(regExp, start); |
| 165 } | 165 } |
| 166 components.add(first.substring(start - 1)); | 166 components.add(first.substring(start - 1)); |
| 167 return components; | 167 return components; |
| 168 } | 168 } |
| 169 } | 169 } |
| OLD | NEW |