| OLD | NEW |
| 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 """ Lint for IDL """ | 5 """ Lint for IDL """ |
| 6 | 6 |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 | 9 |
| 10 from idl_log import ErrOut, InfoOut, WarnOut | 10 from idl_log import ErrOut, InfoOut, WarnOut |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 def Arrive(self, node, errors): | 37 def Arrive(self, node, errors): |
| 38 __pychecker__ = 'unusednames=node,errors' | 38 __pychecker__ = 'unusednames=node,errors' |
| 39 warnings = 0 | 39 warnings = 0 |
| 40 if node.IsA('Interface', 'Member', 'Struct', 'Enum', 'EnumItem', 'Typedef'): | 40 if node.IsA('Interface', 'Member', 'Struct', 'Enum', 'EnumItem', 'Typedef'): |
| 41 comments = node.GetListOf('Comment') | 41 comments = node.GetListOf('Comment') |
| 42 if not comments and not node.GetProperty('wcomment'): | 42 if not comments and not node.GetProperty('wcomment'): |
| 43 node.Warning('Expecting a comment.') | 43 node.Warning('Expecting a comment.') |
| 44 warnings += 1 | 44 warnings += 1 |
| 45 | 45 |
| 46 if node.IsA('File'): |
| 47 labels = node.GetListOf('Label') |
| 48 interfaces = node.GetListOf('Interface') |
| 49 if interfaces and not labels: |
| 50 node.Warning('Expecting a label in a file containing interfaces.') |
| 51 |
| 46 if node.IsA('Struct', 'Typedef') and not node.GetProperty('wpass'): | 52 if node.IsA('Struct', 'Typedef') and not node.GetProperty('wpass'): |
| 47 if node.GetProperty('passByValue'): | 53 if node.GetProperty('passByValue'): |
| 48 pbv = 'is' | 54 pbv = 'is' |
| 49 else: | 55 else: |
| 50 pbv = 'is not' | 56 pbv = 'is not' |
| 51 if node.GetProperty('returnByValue'): | 57 if node.GetProperty('returnByValue'): |
| 52 ret = 'is' | 58 ret = 'is' |
| 53 else: | 59 else: |
| 54 ret = 'is not' | 60 ret = 'is not' |
| 55 if pbv != ret: | 61 if pbv != ret: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 for filenode in ast.GetListOf('File'): | 113 for filenode in ast.GetListOf('File'): |
| 108 name = filenode.GetProperty('NAME') | 114 name = filenode.GetProperty('NAME') |
| 109 if filenode.GetProperty('ERRORS') > 0: | 115 if filenode.GetProperty('ERRORS') > 0: |
| 110 ErrOut.Log('%s : Skipped due to errors.' % name) | 116 ErrOut.Log('%s : Skipped due to errors.' % name) |
| 111 skipList.append(filenode) | 117 skipList.append(filenode) |
| 112 continue | 118 continue |
| 113 warnings = IDLLinter().Visit(filenode, 0) | 119 warnings = IDLLinter().Visit(filenode, 0) |
| 114 if warnings: | 120 if warnings: |
| 115 WarnOut.Log('%s warning(s) for %s\n' % (warnings, name)) | 121 WarnOut.Log('%s warning(s) for %s\n' % (warnings, name)) |
| 116 return skipList | 122 return skipList |
| OLD | NEW |