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

Unified Diff: pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart

Issue 2978063002: Move parser helper classes to own files and clean them up. (Closed)
Patch Set: Don't use problems.dart in parser. Created 3 years, 5 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/front_end/lib/src/fasta/builder/formal_parameter_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart b/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart
index ef3f2bf61d31fe8f3951dfd25046f4205889d45e..5be8cd376298acacd4e7eed6c2afb863af377ecf 100644
--- a/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart
@@ -4,7 +4,13 @@
library fasta.formal_parameter_builder;
-import '../parser/parser.dart' show FormalParameterType;
+import '../parser.dart' show FormalParameterKind;
+
+import '../parser/formal_parameter_kind.dart'
+ show
+ isMandatoryFormalParameterKind,
+ isOptionalNamedFormalParameterKind,
+ isOptionalPositionalFormalParameterKind;
import 'builder.dart'
show LibraryBuilder, MetadataBuilder, ModifierBuilder, TypeBuilder;
@@ -25,7 +31,7 @@ abstract class FormalParameterBuilder<T extends TypeBuilder>
/// True if this parameter is on the form `this.name`.
final bool hasThis;
- FormalParameterType kind = FormalParameterType.REQUIRED;
+ FormalParameterKind kind = FormalParameterKind.mandatory;
FormalParameterBuilder(this.metadata, this.modifiers, this.type, this.name,
this.hasThis, LibraryBuilder compilationUnit, this.charOffset)
@@ -33,11 +39,14 @@ abstract class FormalParameterBuilder<T extends TypeBuilder>
String get debugName => "FormalParameterBuilder";
- bool get isRequired => kind.isRequired;
+ bool get isRequired => isMandatoryFormalParameterKind(kind);
- bool get isPositional => kind.isPositional || kind.isRequired;
+ bool get isPositional {
+ return isOptionalPositionalFormalParameterKind(kind) ||
+ isMandatoryFormalParameterKind(kind);
+ }
- bool get isNamed => kind.isNamed;
+ bool get isNamed => isOptionalNamedFormalParameterKind(kind);
bool get isOptional => !isRequired;
« no previous file with comments | « pkg/compiler/lib/src/parser/node_listener.dart ('k') | pkg/front_end/lib/src/fasta/kernel/body_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698