| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /** | 5 /** |
| 6 * Code generation for the file "matchers.dart". | 6 * Code generation for the file "matchers.dart". |
| 7 */ | 7 */ |
| 8 library codegen.matchers; | 8 library codegen.matchers; |
| 9 | 9 |
| 10 import 'dart:convert'; | 10 import 'dart:convert'; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 context += ' $nameSuffix'; | 44 context += ' $nameSuffix'; |
| 45 nameParts.add(nameSuffix); | 45 nameParts.add(nameSuffix); |
| 46 } | 46 } |
| 47 docComment(toHtmlVisitor.collectHtml(() { | 47 docComment(toHtmlVisitor.collectHtml(() { |
| 48 toHtmlVisitor.p(() { | 48 toHtmlVisitor.p(() { |
| 49 toHtmlVisitor.write(context); | 49 toHtmlVisitor.write(context); |
| 50 }); | 50 }); |
| 51 if (type != null) { | 51 if (type != null) { |
| 52 toHtmlVisitor.showType(null, type); | 52 toHtmlVisitor.showType(null, type); |
| 53 } | 53 } |
| 54 }), false); | 54 })); |
| 55 write('final Matcher ${camelJoin(nameParts)} = '); | 55 write('final Matcher ${camelJoin(nameParts)} = '); |
| 56 if (type == null) { | 56 if (type == null) { |
| 57 write('isNull'); | 57 write('isNull'); |
| 58 } else { | 58 } else { |
| 59 visitTypeDecl(type); | 59 visitTypeDecl(type); |
| 60 } | 60 } |
| 61 writeln(';'); | 61 writeln(';'); |
| 62 writeln(); | 62 writeln(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 @override | 65 @override |
| 66 visitApi() { | 66 visitApi() { |
| 67 outputHeader(); | 67 outputHeader(); |
| 68 writeln(); |
| 68 writeln('/**'); | 69 writeln('/**'); |
| 69 writeln(' * Matchers for data types defined in the analysis server API'); | 70 writeln(' * Matchers for data types defined in the analysis server API'); |
| 70 writeln(' */'); | 71 writeln(' */'); |
| 71 writeln('library test.integration.protocol.matchers;'); | 72 writeln('library test.integration.protocol.matchers;'); |
| 72 writeln(); | 73 writeln(); |
| 73 writeln("import 'package:unittest/unittest.dart';"); | 74 writeln("import 'package:unittest/unittest.dart';"); |
| 74 writeln(); | 75 writeln(); |
| 75 writeln("import 'integration_tests.dart';"); | 76 writeln("import 'integration_tests.dart';"); |
| 76 writeln(); | 77 writeln(); |
| 77 writeln(); | 78 writeln(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 191 |
| 191 /** | 192 /** |
| 192 * Translate spec_input.html into protocol_matchers.dart. | 193 * Translate spec_input.html into protocol_matchers.dart. |
| 193 */ | 194 */ |
| 194 main() { | 195 main() { |
| 195 CodegenMatchersVisitor visitor = new CodegenMatchersVisitor(readApi()); | 196 CodegenMatchersVisitor visitor = new CodegenMatchersVisitor(readApi()); |
| 196 String code = visitor.collectCode(visitor.visitApi); | 197 String code = visitor.collectCode(visitor.visitApi); |
| 197 File outputFile = new File('../../test/integration/protocol_matchers.dart'); | 198 File outputFile = new File('../../test/integration/protocol_matchers.dart'); |
| 198 outputFile.writeAsStringSync(code); | 199 outputFile.writeAsStringSync(code); |
| 199 } | 200 } |
| OLD | NEW |