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

Unified Diff: mojom/mojom_parser/parser/parsing.go

Issue 1511353002: New Mojom parser: Fix error message for invalid enum value initailizers. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years 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 | « mojom/mojom_parser/mojom/types.go ('k') | mojom/mojom_parser/parser/resolution_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojom/mojom_parser/parser/parsing.go
diff --git a/mojom/mojom_parser/parser/parsing.go b/mojom/mojom_parser/parser/parsing.go
index 2b91cfa8d80de29011547ab9a03fc207e92be903..d0f68793197f27f4ce194c8fc3f0e05ecc7444f7 100644
--- a/mojom/mojom_parser/parser/parsing.go
+++ b/mojom/mojom_parser/parser/parsing.go
@@ -939,7 +939,7 @@ func (p *Parser) parseEnumBody(mojomEnum *mojom.MojomEnum) bool {
nameToken := p.lastConsumed
var valueRef mojom.ValueRef
if p.tryMatch(lexer.Equals) {
- valueRef = p.parseEnumValueInitializer(mojomEnum)
+ valueRef = p.parseEnumValueInitializer(mojomEnum, name)
}
declData := p.DeclData(name, nameToken, attributes)
duplicateNameError = mojomEnum.AddEnumValue(declData, valueRef)
@@ -967,7 +967,7 @@ func (p *Parser) parseEnumBody(mojomEnum *mojom.MojomEnum) bool {
// ENUM_VAL_INITIALIZER -> INTEGER_LITERAL | ENUM_VALUE_REF
// ENUM_VALUE_REF -> IDENTIFIER {{that resolves to a declared enum value}}
-func (p *Parser) parseEnumValueInitializer(mojoEnum *mojom.MojomEnum) mojom.ValueRef {
+func (p *Parser) parseEnumValueInitializer(mojoEnum *mojom.MojomEnum, valueName string) mojom.ValueRef {
if !p.OK() {
return nil
}
@@ -982,7 +982,7 @@ func (p *Parser) parseEnumValueInitializer(mojoEnum *mojom.MojomEnum) mojom.Valu
enumType := mojom.NewResolvedUserTypeRef(mojoEnum.FullyQualifiedName(), mojoEnum)
valueToken := p.peekNextToken("Parsing an enum value initializer type.")
- valueRef := p.parseValue(mojom.AssigneeSpec{"enum value", enumType})
+ valueRef := p.parseValue(mojom.AssigneeSpec{valueName, enumType})
if valueRef == nil {
return nil
}
« no previous file with comments | « mojom/mojom_parser/mojom/types.go ('k') | mojom/mojom_parser/parser/resolution_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698