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

Unified Diff: tools/json_schema_compiler/idl_schema.py

Issue 11826020: IDL schema compiler: Fixed pseudo-random order (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Incorporate upstream changes. Created 7 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/json_schema_compiler/idl_schema_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/idl_schema.py
diff --git a/tools/json_schema_compiler/idl_schema.py b/tools/json_schema_compiler/idl_schema.py
index 907aacf8e865f00897cdd8231afd4e5e38ccdb90..d8b510f5cc3ee99bd84a90b8537fda2dabb14080 100644
--- a/tools/json_schema_compiler/idl_schema.py
+++ b/tools/json_schema_compiler/idl_schema.py
@@ -9,6 +9,7 @@ import os.path
import re
import sys
+from json_parse import OrderedDict
import schema_util
# This file is a peer to json_schema.py. Each of these files understands a
@@ -70,7 +71,7 @@ def ProcessComment(comment):
parent_comment = (parent_comment.strip().replace('\n\n', '<br/><br/>')
.replace('\n', ''))
- params = {}
+ params = OrderedDict()
for (cur_param, next_param) in itertools.izip_longest(parameter_starts,
parameter_starts[1:]):
param_name = cur_param.group(1)
@@ -124,7 +125,7 @@ class Dictionary(object):
self.node = dictionary_node
def process(self, callbacks):
- properties = {}
+ properties = OrderedDict()
for node in self.node.children:
if node.cls == 'Member':
k, v = Member(node).process(callbacks)
@@ -147,13 +148,13 @@ class Member(object):
self.node = member_node
def process(self, callbacks):
- properties = {}
+ properties = OrderedDict()
name = self.node.GetName()
for property_name in ('OPTIONAL', 'nodoc', 'nocompile'):
if self.node.GetProperty(property_name):
properties[property_name.lower()] = True
is_function = False
- parameter_comments = {}
+ parameter_comments = OrderedDict()
for node in self.node.children:
if node.cls == 'Comment':
(parent_comment, parameter_comments) = ProcessComment(node.GetName())
@@ -183,7 +184,7 @@ class Typeref(object):
function parameter, converts into a Python dictionary that the JSON schema
compiler expects to see.
'''
- def __init__(self, typeref, parent, additional_properties={}):
+ def __init__(self, typeref, parent, additional_properties=OrderedDict()):
self.typeref = typeref
self.parent = parent
self.additional_properties = additional_properties
@@ -200,7 +201,7 @@ class Typeref(object):
for sibling in self.parent.GetChildren():
if sibling.cls == 'Array' and sibling.GetName() == self.parent.GetName():
properties['type'] = 'array'
- properties['items'] = {}
+ properties['items'] = OrderedDict()
properties = properties['items']
break
@@ -217,7 +218,7 @@ class Typeref(object):
elif self.typeref == 'object':
properties['type'] = 'object'
if 'additionalProperties' not in properties:
- properties['additionalProperties'] = {}
+ properties['additionalProperties'] = OrderedDict()
properties['additionalProperties']['type'] = 'any'
instance_of = self.parent.GetProperty('instanceOf')
if instance_of:
@@ -283,7 +284,7 @@ class Namespace(object):
self.events = []
self.functions = []
self.types = []
- self.callbacks = {}
+ self.callbacks = OrderedDict()
self.permissions = permissions or []
def process(self):
« no previous file with comments | « no previous file | tools/json_schema_compiler/idl_schema_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698