OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # | 2 # |
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Nodes for PPAPI IDL AST.""" | 7 """Nodes for PPAPI IDL AST.""" |
8 | 8 |
9 from idl_namespace import IDLNamespace | 9 from idl_namespace import IDLNamespace |
10 from idl_node import IDLAttribute, IDLFile, IDLNode | 10 from idl_node import IDLAttribute, IDLFile, IDLNode |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 # | 99 # |
100 # IDLAst | 100 # IDLAst |
101 # | 101 # |
102 # A specialized version of the IDLNode for containing the whole of the | 102 # A specialized version of the IDLNode for containing the whole of the |
103 # AST. The specialized BuildTree function pulls the per file namespaces | 103 # AST. The specialized BuildTree function pulls the per file namespaces |
104 # into the global AST namespace and checks for collisions. | 104 # into the global AST namespace and checks for collisions. |
105 # | 105 # |
106 class IDLAst(IDLNode): | 106 class IDLAst(IDLNode): |
107 def __init__(self, children): | 107 def __init__(self, children): |
108 objs = [] | 108 IDLNode.__init__(self, 'AST', 'BuiltIn', 1, 0, children) |
109 | |
110 builtin = None | |
111 extranodes = [] | |
112 for filenode in children: | |
113 if filenode.GetProperty('NAME') == 'pp_stdint.idl': | |
114 builtin = filenode | |
115 break | |
116 | |
117 IDLNode.__init__(self, 'AST', 'BuiltIn', 1, 0, extranodes + children) | |
118 self.Resolve() | 109 self.Resolve() |
119 | 110 |
120 def Resolve(self): | 111 def Resolve(self): |
121 self.namespace = IDLNamespace(None) | 112 self.namespace = IDLNamespace(None) |
122 self.namespace.name = 'AST' | 113 self.namespace.name = 'AST' |
123 IDLNamespaceLabelResolver().Visit(self, self.namespace) | 114 IDLNamespaceLabelResolver().Visit(self, self.namespace) |
124 IDLFileTypeResolver().Visit(self, None) | 115 IDLFileTypeResolver().Visit(self, None) |
125 | 116 |
126 # Build an ordered list of all releases | 117 # Build an ordered list of all releases |
127 self.releases = set() | 118 self.releases = set() |
128 for filenode in self.GetListOf('File'): | 119 for filenode in self.GetListOf('File'): |
129 self.releases |= set(filenode.release_map.GetReleases()) | 120 self.releases |= set(filenode.release_map.GetReleases()) |
130 self.releases = sorted(self.releases) | 121 self.releases = sorted(self.releases) |
131 | 122 |
132 def SetTypeInfo(self, name, properties): | 123 def SetTypeInfo(self, name, properties): |
133 node = self.namespace[name] | 124 node = self.namespace[name] |
134 for prop in properties: | 125 for prop in properties: |
135 node.properties[prop] = properties[prop] | 126 node.properties[prop] = properties[prop] |
136 | 127 |
137 | 128 |
OLD | NEW |