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 0841cb0b952319df128e26690082c34f66c7e872..8b03889720e7548b812a4043da9f7c6470fcd333 100644 |
--- a/mojom/mojom_parser/mojom/user_defined_types.go |
+++ b/mojom/mojom_parser/mojom/user_defined_types.go |
@@ -544,13 +544,32 @@ type MojomInterface struct { |
methodsByName map[string]*MojomMethod |
methodsByLexicalOrder []*MojomMethod |
+ |
+ // If the declaration of this interface has been annotated with the |
+ // "ServiceName=" attribute then this field contains the value of that |
+ // attribute, otherwise this is null. |
+ ServiceName *string |
} |
+const serviceNameAttribute = "ServiceName" |
azani
2016/02/10 00:06:39
Given that it's used in only one location, I don't
rudominer
2016/02/10 00:43:49
Done.
|
+ |
func NewMojomInterface(declData DeclarationData) *MojomInterface { |
mojomInterface := new(MojomInterface) |
mojomInterface.MethodsByOrdinal = make(map[uint32]*MojomMethod) |
mojomInterface.methodsByName = make(map[string]*MojomMethod) |
mojomInterface.Init(declData, mojomInterface) |
+ // Search for an attribute named "ServiceName" with a string value. |
+ // If that is found take the value as |ServiceName|. |
+ if declData.attributes != nil && declData.attributes.List != nil { |
+ for _, attribute := range declData.attributes.List { |
+ if attribute.Key == serviceNameAttribute { |
+ if valueString, ok := attribute.Value.Value().(string); ok { |
+ mojomInterface.ServiceName = &valueString |
+ break |
+ } |
+ } |
+ } |
+ } |
return mojomInterface |
} |