| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 # TODO(vtl): "data" is a pretty vague name. Rename it? | 5 # TODO(vtl): "data" is a pretty vague name. Rename it? |
| 6 | 6 |
| 7 import copy | 7 import copy |
| 8 | 8 |
| 9 import module as mojom | 9 import module as mojom |
| 10 | 10 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 kind = LookupKind(kinds, data, scope) | 116 kind = LookupKind(kinds, data, scope) |
| 117 if kind: | 117 if kind: |
| 118 return kind | 118 return kind |
| 119 | 119 |
| 120 if data.startswith('?'): | 120 if data.startswith('?'): |
| 121 kind = KindFromData(kinds, data[1:], scope).MakeNullableKind() | 121 kind = KindFromData(kinds, data[1:], scope).MakeNullableKind() |
| 122 elif data.startswith('a:'): | 122 elif data.startswith('a:'): |
| 123 kind = mojom.Array(KindFromData(kinds, data[2:], scope)) | 123 kind = mojom.Array(KindFromData(kinds, data[2:], scope)) |
| 124 elif data.startswith('r:'): | 124 elif data.startswith('r:'): |
| 125 kind = mojom.InterfaceRequest(KindFromData(kinds, data[2:], scope)) | 125 kind = mojom.InterfaceRequest(KindFromData(kinds, data[2:], scope)) |
| 126 elif data.startswith('m['): |
| 127 # Isolate the two types from their brackets |
| 128 first_kind = data[2:data.find(']')] |
| 129 second_kind = data[data.rfind('[')+1:data.rfind(']')] |
| 130 kind = mojom.Map(KindFromData(kinds, first_kind, scope), |
| 131 KindFromData(kinds, second_kind, scope)) |
| 126 elif data.startswith('a'): | 132 elif data.startswith('a'): |
| 127 colon = data.find(':') | 133 colon = data.find(':') |
| 128 length = int(data[1:colon]) | 134 length = int(data[1:colon]) |
| 129 kind = mojom.FixedArray(length, KindFromData(kinds, data[colon+1:], scope)) | 135 kind = mojom.FixedArray(length, KindFromData(kinds, data[colon+1:], scope)) |
| 130 else: | 136 else: |
| 131 kind = mojom.Kind(data) | 137 kind = mojom.Kind(data) |
| 132 | 138 |
| 133 kinds[data] = kind | 139 kinds[data] = kind |
| 134 return kind | 140 return kind |
| 135 | 141 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 380 |
| 375 def OrderedModuleFromData(data): | 381 def OrderedModuleFromData(data): |
| 376 module = ModuleFromData(data) | 382 module = ModuleFromData(data) |
| 377 for interface in module.interfaces: | 383 for interface in module.interfaces: |
| 378 next_ordinal = 0 | 384 next_ordinal = 0 |
| 379 for method in interface.methods: | 385 for method in interface.methods: |
| 380 if method.ordinal is None: | 386 if method.ordinal is None: |
| 381 method.ordinal = next_ordinal | 387 method.ordinal = next_ordinal |
| 382 next_ordinal = method.ordinal + 1 | 388 next_ordinal = method.ordinal + 1 |
| 383 return module | 389 return module |
| OLD | NEW |