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

Side by Side Diff: Source/bindings/scripts/idl_types.py

Issue 722523003: IDL: Use user-friendly type names for error messages (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « LayoutTests/fast/events/constructors/track-event-constructor-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 """IDL type handling. 4 """IDL type handling.
5 5
6 Classes: 6 Classes:
7 IdlTypeBase 7 IdlTypeBase
8 IdlType 8 IdlType
9 IdlUnionType 9 IdlUnionType
10 IdlArrayOrSequenceType 10 IdlArrayOrSequenceType
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 class IdlUnionType(IdlTypeBase): 247 class IdlUnionType(IdlTypeBase):
248 # http://heycam.github.io/webidl/#idl-union 248 # http://heycam.github.io/webidl/#idl-union
249 # IdlUnionType has __hash__() and __eq__() methods because they are stored 249 # IdlUnionType has __hash__() and __eq__() methods because they are stored
250 # in sets. 250 # in sets.
251 def __init__(self, member_types): 251 def __init__(self, member_types):
252 super(IdlUnionType, self).__init__() 252 super(IdlUnionType, self).__init__()
253 self.member_types = member_types 253 self.member_types = member_types
254 254
255 def __str__(self): 255 def __str__(self):
256 return self.name 256 return '(' + ' or '.join(str(member_type) for member_type in self.member _types) + ')'
257 257
258 def __hash__(self): 258 def __hash__(self):
259 return hash(self.name) 259 return hash(self.name)
260 260
261 def __eq__(self, rhs): 261 def __eq__(self, rhs):
262 return self.name == rhs.name 262 return self.name == rhs.name
263 263
264 def __getstate__(self): 264 def __getstate__(self):
265 return { 265 return {
266 'member_types': self.member_types, 266 'member_types': self.member_types,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 def is_nullable(self): 395 def is_nullable(self):
396 return True 396 return True
397 397
398 @property 398 @property
399 def name(self): 399 def name(self):
400 return self.inner_type.name + 'OrNull' 400 return self.inner_type.name + 'OrNull'
401 401
402 def resolve_typedefs(self, typedefs): 402 def resolve_typedefs(self, typedefs):
403 self.inner_type = self.inner_type.resolve_typedefs(typedefs) 403 self.inner_type = self.inner_type.resolve_typedefs(typedefs)
404 return self 404 return self
OLDNEW
« no previous file with comments | « LayoutTests/fast/events/constructors/track-event-constructor-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698