| 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 library codegen.protocol; | 5 library codegen.protocol; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/codegen/tools.dart'; | 9 import 'package:analyzer/src/codegen/tools.dart'; |
| 10 import 'package:html/dom.dart' as dom; | 10 import 'package:html/dom.dart' as dom; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 final ToHtmlVisitor toHtmlVisitor; | 72 final ToHtmlVisitor toHtmlVisitor; |
| 73 | 73 |
| 74 /** | 74 /** |
| 75 * Types implied by the API. This includes types explicitly named in the | 75 * Types implied by the API. This includes types explicitly named in the |
| 76 * API as well as those implied by the definitions of requests, responses, | 76 * API as well as those implied by the definitions of requests, responses, |
| 77 * notifications, etc. | 77 * notifications, etc. |
| 78 */ | 78 */ |
| 79 final Map<String, ImpliedType> impliedTypes; | 79 final Map<String, ImpliedType> impliedTypes; |
| 80 | 80 |
| 81 CodegenProtocolVisitor(Api api) | 81 CodegenProtocolVisitor(Api api) |
| 82 : super(api), | 82 : toHtmlVisitor = new ToHtmlVisitor(api), |
| 83 toHtmlVisitor = new ToHtmlVisitor(api), | 83 impliedTypes = computeImpliedTypes(api), |
| 84 impliedTypes = computeImpliedTypes(api) { | 84 super(api) { |
| 85 codeGeneratorSettings.commentLineLength = 79; | 85 codeGeneratorSettings.commentLineLength = 79; |
| 86 codeGeneratorSettings.languageName = 'dart'; | 86 codeGeneratorSettings.languageName = 'dart'; |
| 87 } | 87 } |
| 88 | 88 |
| 89 /** | 89 /** |
| 90 * Compute the code necessary to compare two objects for equality. | 90 * Compute the code necessary to compare two objects for equality. |
| 91 */ | 91 */ |
| 92 String compareEqualsCode(TypeDecl type, String thisVar, String otherVar) { | 92 String compareEqualsCode(TypeDecl type, String thisVar, String otherVar) { |
| 93 TypeDecl resolvedType = resolveTypeReferenceChain(type); | 93 TypeDecl resolvedType = resolveTypeReferenceChain(type); |
| 94 if (resolvedType is TypeReference || | 94 if (resolvedType is TypeReference || |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 | 1233 |
| 1234 @override | 1234 @override |
| 1235 String get asClosure => '($type value) => ${callback('value')}'; | 1235 String get asClosure => '($type value) => ${callback('value')}'; |
| 1236 | 1236 |
| 1237 @override | 1237 @override |
| 1238 bool get isIdentity => false; | 1238 bool get isIdentity => false; |
| 1239 | 1239 |
| 1240 @override | 1240 @override |
| 1241 String asSnippet(String value) => callback(value); | 1241 String asSnippet(String value) => callback(value); |
| 1242 } | 1242 } |
| OLD | NEW |