Index: mojom/mojom_parser/mojom/user_defined_types.go |
diff --git a/mojom/mojom_parser/mojom/user_defined_types.go b/mojom/mojom_parser/mojom/user_defined_types.go |
index 6f6b877d2cf6d30cfa234b3720a0934cf195c13f..6d1833b951c4f6eae9208bd1b086024d8648294b 100644 |
--- a/mojom/mojom_parser/mojom/user_defined_types.go |
+++ b/mojom/mojom_parser/mojom/user_defined_types.go |
@@ -534,69 +534,6 @@ func (s *MojomStruct) ComputeFieldOrdinals() error { |
return nil |
} |
-var ErrMinVersionIllformed = errors.New("MinVersion attribute value illformed") |
-var ErrMinVersionOutOfOrder = errors.New("MinVersion attribute value out of order") |
-var ErrMinVersionNotNullable = errors.New("Non-Zero MinVersion attribute value on non-nullable field") |
- |
-type StructFieldMinVersionError struct { |
- // The field whose MinVersion is being set. |
- field *StructField |
- |
- // The MinValue of the previous field. Only used for ErrMinVersionOutOfOrder |
- previousValue uint32 |
- |
- // The LiteralValue of the attribute assignment. |
- // NOTE: We use the following convention: literalValue.token == nil indicates that |
- // there was no MinVersion attribute on the given field. This can only happen with |
- // ErrMinVersionOutOfOrder |
- literalValue LiteralValue |
- |
- // The type of error (ErrMinVersionIllfromed, ErrMinVersionOutOfOrder, ErrMinVersionNotNullable) |
- err error |
-} |
- |
-// StructFieldMinVersionError implements error. |
-func (e *StructFieldMinVersionError) Error() string { |
- var message string |
- var token lexer.Token |
- switch e.err { |
- case ErrMinVersionIllformed: |
- message = fmt.Sprintf("Invalid MinVersion attribute for field %s: %s. "+ |
- "The value must be a non-negative 32-bit integer value.", |
- e.field.SimpleName(), e.literalValue) |
- token = *e.literalValue.token |
- case ErrMinVersionOutOfOrder: |
- if e.literalValue.token == nil { |
- message = fmt.Sprintf("Invalid missing MinVersion for field %s. "+ |
- "The MinVersion must be non-decreasing as a function of the ordinal. "+ |
- "This field must have a MinVersion attribute with a value at least %d.", |
- e.field.SimpleName(), e.previousValue) |
- token = e.field.NameToken() |
- } else { |
- message = fmt.Sprintf("Invalid MinVersion attribute for field %s: %s. "+ |
- "The MinVersion must be non-decreasing as a function of the ordinal. "+ |
- "This field's MinVersion must be at least %d.", |
- e.field.SimpleName(), e.literalValue.token.Text, e.previousValue) |
- token = *e.literalValue.token |
- } |
- case ErrMinVersionNotNullable: |
- message = fmt.Sprintf("Invalid type for field %s: %s. "+ |
- "Non-nullable fields are only allowed in version 0 of of a struct. "+ |
- "This field's MinVersion is %s.", |
- e.field.SimpleName(), e.field.FieldType.TypeName(), e.literalValue.token.Text) |
- switch fieldType := e.field.FieldType.(type) { |
- case *UserTypeRef: |
- token = fieldType.token |
- default: |
- // It would be nice for the green carets in the snippit in the error message to point at |
- // the type name, but other than for user type refs we don't store that token so |
- // instead we use the field's name. |
- token = e.field.NameToken() |
- } |
- } |
- return UserErrorMessage(e.field.OwningFile(), token, message) |
-} |
- |
func (m MojomStruct) String() string { |
s := fmt.Sprintf("\n---------struct--------------\n") |
s += fmt.Sprintf("%s\n", m.UserDefinedTypeBase) |