OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package mojom | 5 package mojom |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "fmt" | 9 "fmt" |
10 "mojom/mojom_parser/lexer" | 10 "mojom/mojom_parser/lexer" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 return mojomUnion.RegisterInScope(f.FileScope) | 245 return mojomUnion.RegisterInScope(f.FileScope) |
246 } | 246 } |
247 | 247 |
248 func (f *MojomFile) AddConstant(declaredConst *UserDefinedConstant) DuplicateNam
eError { | 248 func (f *MojomFile) AddConstant(declaredConst *UserDefinedConstant) DuplicateNam
eError { |
249 f.DeclaredObjects = append(f.DeclaredObjects, declaredConst) | 249 f.DeclaredObjects = append(f.DeclaredObjects, declaredConst) |
250 f.Constants = append(f.Constants, declaredConst) | 250 f.Constants = append(f.Constants, declaredConst) |
251 f.checkInit() | 251 f.checkInit() |
252 return declaredConst.RegisterInScope(f.FileScope) | 252 return declaredConst.RegisterInScope(f.FileScope) |
253 } | 253 } |
254 | 254 |
| 255 func (f *MojomFile) FileContents() string { |
| 256 return f.fileContents |
| 257 } |
| 258 |
255 func (f *MojomFile) checkInit() { | 259 func (f *MojomFile) checkInit() { |
256 if f.FileScope == nil { | 260 if f.FileScope == nil { |
257 panic("InitializeFileScope must be invoked first.") | 261 panic("InitializeFileScope must be invoked first.") |
258 } | 262 } |
259 } | 263 } |
260 | 264 |
261 ////////////////////////////////////////////////////////////////// | 265 ////////////////////////////////////////////////////////////////// |
262 /// type MojomDescriptor | 266 /// type MojomDescriptor |
263 /// ////////////////////////////////////////////////////////////// | 267 /// ////////////////////////////////////////////////////////////// |
264 | 268 |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 typeKey = fmt.Sprintf("TYPE_KEY:%s", fullyQualifiedName) | 758 typeKey = fmt.Sprintf("TYPE_KEY:%s", fullyQualifiedName) |
755 fqnToTypeKey[fullyQualifiedName] = typeKey | 759 fqnToTypeKey[fullyQualifiedName] = typeKey |
756 return | 760 return |
757 } | 761 } |
758 | 762 |
759 var fqnToTypeKey map[string]string | 763 var fqnToTypeKey map[string]string |
760 | 764 |
761 func init() { | 765 func init() { |
762 fqnToTypeKey = make(map[string]string) | 766 fqnToTypeKey = make(map[string]string) |
763 } | 767 } |
OLD | NEW |