Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart

Issue 2844273003: Unify the server and plugin versions of the generators (Closed)
Patch Set: add missed files Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart
diff --git a/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart b/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart
index 998570b6dfbc8221629328402c8aa35c30f8a2f7..941b881d85a43f48d50728e83811fb96be7382cb 100644
--- a/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart
+++ b/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -7,6 +7,7 @@ import 'dart:convert';
import 'package:analyzer/src/codegen/tools.dart';
import 'package:front_end/src/codegen/tools.dart';
import 'package:html/dom.dart' as dom;
+import 'package:path/path.dart' as path;
import 'api.dart';
import 'codegen_dart.dart';
@@ -29,7 +30,8 @@ const Map<String, String> specialElementFlags = const {
final GeneratedFile target =
new GeneratedFile('lib/protocol/protocol_generated.dart', (String pkgPath) {
- CodegenProtocolVisitor visitor = new CodegenProtocolVisitor(readApi(pkgPath));
+ CodegenProtocolVisitor visitor =
+ new CodegenProtocolVisitor(path.basename(pkgPath), readApi(pkgPath));
return visitor.collectCode(visitor.visitApi);
});
@@ -66,6 +68,11 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
'Clients may not extend, implement or mix-in this class.';
/**
+ * The name of the package into which code is being generated.
+ */
+ final String packageName;
+
+ /**
* Visitor used to produce doc comments.
*/
final ToHtmlVisitor toHtmlVisitor;
@@ -77,7 +84,7 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
*/
final Map<String, ImpliedType> impliedTypes;
- CodegenProtocolVisitor(Api api)
+ CodegenProtocolVisitor(this.packageName, Api api)
: toHtmlVisitor = new ToHtmlVisitor(api),
impliedTypes = computeImpliedTypes(api),
super(api) {
@@ -1127,9 +1134,9 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
writeln("import 'dart:convert' hide JsonDecoder;");
writeln();
writeln("import 'package:analyzer/src/generated/utilities_general.dart';");
- writeln("import 'package:analyzer_plugin/protocol/protocol.dart';");
+ writeln("import 'package:$packageName/protocol/protocol.dart';");
writeln(
- "import 'package:analyzer_plugin/src/protocol/protocol_internal.dart';");
+ "import 'package:$packageName/src/protocol/protocol_internal.dart';");
emitClasses();
}
}
« no previous file with comments | « pkg/analyzer_plugin/tool/spec/codegen_dart.dart ('k') | pkg/analyzer_plugin/tool/spec/codegen_inttest_methods.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698