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

Side by Side Diff: ppapi/generators/idl_namespace.py

Issue 98343005: Pepper: More IDL generator cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for json_schema_compiler Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/generators/idl_log.py ('k') | ppapi/generators/idl_node.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """ 6 """
7 IDLNamespace for PPAPI 7 IDLNamespace for PPAPI
8 8
9 This file defines the behavior of the AST namespace which allows for resolving 9 This file defines the behavior of the AST namespace which allows for resolving
10 a symbol as one or more AST nodes given a release or range of releases. 10 a symbol as one or more AST nodes given a release or range of releases.
(...skipping 10 matching lines...) Expand all
21 21
22 22
23 # 23 #
24 # IDLNamespace 24 # IDLNamespace
25 # 25 #
26 # IDLNamespace provides a mapping between a symbol name and an IDLReleaseList 26 # IDLNamespace provides a mapping between a symbol name and an IDLReleaseList
27 # which contains IDLRelease objects. It provides an interface for fetching 27 # which contains IDLRelease objects. It provides an interface for fetching
28 # one or more IDLNodes based on a release or range of releases. 28 # one or more IDLNodes based on a release or range of releases.
29 # 29 #
30 class IDLNamespace(object): 30 class IDLNamespace(object):
31 def __init__(self, parent, name): 31 def __init__(self, parent):
32 self._name_to_releases = {} 32 self._name_to_releases = {}
33 self._parent = parent 33 self._parent = parent
34 self._name = name
35 34
36 def Dump(self): 35 def Dump(self):
37 for name in self._name_to_releases: 36 for name in self._name_to_releases:
38 InfoOut.Log('NAME=%s' % name) 37 InfoOut.Log('NAME=%s' % name)
39 for cver in self._name_to_releases[name].GetReleases(): 38 for cver in self._name_to_releases[name].GetReleases():
40 InfoOut.Log(' %s' % cver) 39 InfoOut.Log(' %s' % cver)
41 InfoOut.Log('') 40 InfoOut.Log('')
42 41
43 def FindRelease(self, name, release): 42 def FindRelease(self, name, release):
44 verlist = self._name_to_releases.get(name, None) 43 verlist = self._name_to_releases.get(name, None)
(...skipping 21 matching lines...) Expand all
66 return verlist 65 return verlist
67 66
68 def AddNode(self, node): 67 def AddNode(self, node):
69 name = node.GetName() 68 name = node.GetName()
70 verlist = self._name_to_releases.setdefault(name,IDLReleaseList()) 69 verlist = self._name_to_releases.setdefault(name,IDLReleaseList())
71 if GetOption('namespace_debug'): 70 if GetOption('namespace_debug'):
72 print "Adding to namespace: %s" % node 71 print "Adding to namespace: %s" % node
73 return verlist.AddNode(node) 72 return verlist.AddNode(node)
74 73
75 74
76
77 # 75 #
78 # Testing Code 76 # Testing Code
79 # 77 #
80 78
81 # 79 #
82 # MockNode 80 # MockNode
83 # 81 #
84 # Mocks the IDLNode to support error, warning handling, and string functions. 82 # Mocks the IDLNode to support error, warning handling, and string functions.
85 # 83 #
86 class MockNode(IDLRelease): 84 class MockNode(IDLRelease):
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 if errors: 240 if errors:
243 print 'Test failed with %d errors.' % errors 241 print 'Test failed with %d errors.' % errors
244 else: 242 else:
245 print 'Passed.' 243 print 'Passed.'
246 return errors 244 return errors
247 245
248 246
249 if __name__ == '__main__': 247 if __name__ == '__main__':
250 sys.exit(Main(sys.argv[1:])) 248 sys.exit(Main(sys.argv[1:]))
251 249
OLDNEW
« no previous file with comments | « ppapi/generators/idl_log.py ('k') | ppapi/generators/idl_node.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698