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

Unified Diff: mojom/mojom_parser/mojom/types.go

Issue 1409343009: New Mojom Parser: Make some getters and add a TODO. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | mojom/mojom_parser/parser/parsing.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojom/mojom_parser/mojom/types.go
diff --git a/mojom/mojom_parser/mojom/types.go b/mojom/mojom_parser/mojom/types.go
index 264aa498ef8778e61451a15092f1b7ddcc569f3f..0baa519385ea6d563e44471ede47ac8f06757498 100644
--- a/mojom/mojom_parser/mojom/types.go
+++ b/mojom/mojom_parser/mojom/types.go
@@ -213,6 +213,10 @@ type StringType struct {
nullable bool
}
+func (s StringType) Nullable() bool {
+ return s.nullable
+}
+
// StringLiteralType is a global singleton representing the unique LiteralType string.
var StringLiteralType LiteralType = StringType{}
@@ -282,6 +286,14 @@ type HandleTypeRef struct {
kind HandleKind
}
+func (h HandleTypeRef) Nullable() bool {
+ return h.nullable
+}
+
+func (h HandleTypeRef) HandleKind() HandleKind {
+ return h.kind
+}
+
func (HandleTypeRef) TypeRefKind() TypeKind {
return TypeKindHandle
}
@@ -390,6 +402,18 @@ func NewArrayTypeRef(elementType TypeRef, fixedSize int, nullable bool) *ArrayTy
return &ArrayTypeRef{nullable, fixedSize, elementType}
}
+func (a ArrayTypeRef) Nullable() bool {
+ return a.nullable
+}
+
+func (a ArrayTypeRef) FixedLength() int {
+ return a.fixedLength
+}
+
+func (a ArrayTypeRef) ElementType() TypeRef {
+ return a.elementType
+}
+
// An ArrayTypeRef is a TypeRef:
func (ArrayTypeRef) TypeRefKind() TypeKind {
@@ -408,10 +432,6 @@ func (ArrayTypeRef) MarkTypeCompatible(assignment LiteralAssignment) bool {
return assignment.assignedValue.IsDefault()
}
-func (a ArrayTypeRef) Nullable() bool {
- return a.nullable
-}
-
func (a ArrayTypeRef) String() string {
fixedLengthSpecifier := ""
if a.fixedLength > 0 {
@@ -441,6 +461,18 @@ func NewMapTypeRef(keyType TypeRef, valueType TypeRef, nullable bool) *MapTypeRe
return &MapTypeRef{nullable, keyType, valueType}
}
+func (m MapTypeRef) Nullable() bool {
+ return m.nullable
+}
+
+func (m MapTypeRef) KeyType() TypeRef {
+ return m.keyType
+}
+
+func (m MapTypeRef) ValueType() TypeRef {
+ return m.valueType
+}
+
// A MapTypeRef is a TypeRef:
func (MapTypeRef) TypeRefKind() TypeKind {
@@ -459,10 +491,6 @@ func (MapTypeRef) MarkTypeCompatible(assignment LiteralAssignment) bool {
return assignment.assignedValue.IsDefault()
}
-func (m MapTypeRef) Nullable() bool {
- return m.nullable
-}
-
func (m MapTypeRef) String() string {
nullableSpecifier := ""
if m.nullable {
@@ -521,6 +549,18 @@ func NewResolvedUserTypeRef(identifier string, resolvedType UserDefinedType) *Us
return &UserTypeRef{identifier: identifier, resolvedType: resolvedType}
}
+func (t *UserTypeRef) Nullable() bool {
+ return t.nullable
+}
+
+func (t *UserTypeRef) IsInterfaceRequest() bool {
+ return t.interfaceRequest
+}
+
+func (t *UserTypeRef) Identifier() string {
+ return t.identifier
+}
+
// A UserTypeRef is a TypeRef:
func (UserTypeRef) TypeRefKind() TypeKind {
@@ -555,10 +595,6 @@ func (t *UserTypeRef) MarkTypeCompatible(assignment LiteralAssignment) bool {
return true
}
-func (t *UserTypeRef) Nullable() bool {
- return t.nullable
-}
-
func (ref *UserTypeRef) validateAfterResolution() error {
if ref.resolvedType.Kind() != UserDefinedTypeKindEnum {
// A type ref has resolved to a non-enum type. Make sure it is not
« no previous file with comments | « no previous file | mojom/mojom_parser/parser/parsing.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698