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

Unified Diff: pkg/fasta/lib/src/builder/metadata_builder.dart

Issue 2629063005: Fasta builders. (Closed)
Patch Set: Created 3 years, 11 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/fasta/lib/src/builder/metadata_builder.dart
diff --git a/pkg/fasta/lib/src/builder/metadata_builder.dart b/pkg/fasta/lib/src/builder/metadata_builder.dart
new file mode 100644
index 0000000000000000000000000000000000000000..8df3a87f3e4cb6d3a4425808b0d35f40cb19069a
--- /dev/null
+++ b/pkg/fasta/lib/src/builder/metadata_builder.dart
@@ -0,0 +1,43 @@
+// Copyright (c) 2016, 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.
+
+library fasta.metadata_builder;
+
+import 'builder.dart' show
+ Builder,
+ TypeBuilder;
+
+import 'constructor_reference_builder.dart' show
+ ConstructorReferenceBuilder;
+
+abstract class MetadataBuilder<T extends TypeBuilder> extends Builder {
+ MetadataBuilder();
+
+ factory MetadataBuilder.fromConstructor(
+ ConstructorReferenceBuilder constructorReference, List arguments) {
+ return new ConstructorMetadataBuilder(constructorReference, arguments);
+ }
+
+ factory MetadataBuilder.fromExpression(String expression, String postfix) {
+ return new ExpressionMetadataBuilder(expression, postfix);
+ }
+}
+
+class ConstructorMetadataBuilder<T extends TypeBuilder>
+ extends MetadataBuilder<T> {
+ final ConstructorReferenceBuilder constructorReference;
+
+ final List arguments;
+
+ ConstructorMetadataBuilder(this.constructorReference, this.arguments);
+}
+
+class ExpressionMetadataBuilder<T extends TypeBuilder>
+ extends MetadataBuilder<T> {
+ final String expression;
Johnni Winther 2017/01/16 13:01:19 Why use String?
ahe 2017/01/16 15:26:33 I generally use Strings to represent identifiers.
+
+ final String postfix;
Johnni Winther 2017/01/16 13:01:19 What is this?
ahe 2017/01/16 15:26:33 I've changed this to: /// Expression metadata (wi
+
+ ExpressionMetadataBuilder(this.expression, this.postfix);
+}

Powered by Google App Engine
This is Rietveld 408576698