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

Side by Side Diff: tools/json_schema_compiler/model.py

Issue 515983003: Fixing json compiler preview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 import os.path 5 import os.path
6 6
7 from json_parse import OrderedDict 7 from json_parse import OrderedDict
8 from memoize import memoize 8 from memoize import memoize
9 9
10 10
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 self.types = _GetTypes(self, json, self, toplevel_origin) 123 self.types = _GetTypes(self, json, self, toplevel_origin)
124 self.functions = _GetFunctions(self, json, self) 124 self.functions = _GetFunctions(self, json, self)
125 self.events = _GetEvents(self, json, self) 125 self.events = _GetEvents(self, json, self)
126 self.properties = _GetProperties(self, json, self, toplevel_origin) 126 self.properties = _GetProperties(self, json, self, toplevel_origin)
127 if include_compiler_options: 127 if include_compiler_options:
128 self.compiler_options = json.get('compiler_options', {}) 128 self.compiler_options = json.get('compiler_options', {})
129 else: 129 else:
130 self.compiler_options = {} 130 self.compiler_options = {}
131 self.environment = environment 131 self.environment = environment
132 self.documentation_options = json.get('documentation_options', {}) 132 self.documentation_options = json.get('documentation_options', {})
133 self.dependencies = json.get('dependencies', [])
not at google - send to devlin 2014/08/28 19:22:09 When is this populated?
lfg 2014/08/28 19:33:35 This came directly from the json file (currently,
not at google - send to devlin 2014/08/28 19:41:35 Ah ok. Yeah we used to use a "dependencies" proper
lfg 2014/08/28 23:14:59 Acknowledged.
133 134
134 135
135 class Origin(object): 136 class Origin(object):
136 """Stores the possible origin of model object as a pair of bools. These are: 137 """Stores the possible origin of model object as a pair of bools. These are:
137 138
138 |from_client| indicating that instances can originate from users of 139 |from_client| indicating that instances can originate from users of
139 generated code (for example, function results), or 140 generated code (for example, function results), or
140 |from_json| indicating that instances can originate from the JSON (for 141 |from_json| indicating that instances can originate from the JSON (for
141 example, function parameters) 142 example, function parameters)
142 143
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 # Sanity check: platforms should not be an empty list. 597 # Sanity check: platforms should not be an empty list.
597 if not json['platforms']: 598 if not json['platforms']:
598 raise ValueError('"platforms" cannot be an empty list') 599 raise ValueError('"platforms" cannot be an empty list')
599 platforms = [] 600 platforms = []
600 for platform_name in json['platforms']: 601 for platform_name in json['platforms']:
601 for platform_enum in _Enum.GetAll(Platforms): 602 for platform_enum in _Enum.GetAll(Platforms):
602 if platform_name == platform_enum.name: 603 if platform_name == platform_enum.name:
603 platforms.append(platform_enum) 604 platforms.append(platform_enum)
604 break 605 break
605 return platforms 606 return platforms
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698