OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2017 The Chromium Authors. All rights reserved. | 2 # Copyright 2017 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import logging | 6 import logging |
7 import unittest | 7 import unittest |
8 | 8 |
9 import function_signature | 9 import function_signature |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 'const::{lambda(v8::Object**)#1}>', | 59 'const::{lambda(v8::Object**)#1}>', |
60 '(v8::RelocInfo, v8::Foo<(v8::PointerDirection)1>::Bar(v8::Heap*)::' | 60 '(v8::RelocInfo, v8::Foo<(v8::PointerDirection)1>::Bar(v8::Heap*)::' |
61 '{lambda(v8::SlotType)#2}::operator()(v8::SlotType) const::' | 61 '{lambda(v8::SlotType)#2}::operator()(v8::SlotType) const::' |
62 '{lambda(v8::Object**)#1})') | 62 '{lambda(v8::Object**)#1})') |
63 check('', | 63 check('', |
64 'WTF::StringAppend<WTF::String, WTF::String>::operator WTF::String', | 64 'WTF::StringAppend<WTF::String, WTF::String>::operator WTF::String', |
65 '()', | 65 '()', |
66 ' const') | 66 ' const') |
67 # Make sure []s are not removed from the name part. | 67 # Make sure []s are not removed from the name part. |
68 check('', 'Foo', '()', ' [virtual thunk]') | 68 check('', 'Foo', '()', ' [virtual thunk]') |
| 69 # Template function that accepts an anonymous lambda. |
| 70 check('', |
| 71 'blink::FrameView::ForAllNonThrottledFrameViews<blink::FrameView::Pre' |
| 72 'Paint()::{lambda(FrameView&)#2}>', |
| 73 '(blink::FrameView::PrePaint()::{lambda(FrameView&)#2} const&)', '') |
69 | 74 |
70 # SkArithmeticImageFilter.cpp has class within function body. e.g.: | 75 # SkArithmeticImageFilter.cpp has class within function body. e.g.: |
71 # ArithmeticFP::onCreateGLSLInstance() looks like: | 76 # ArithmeticFP::onCreateGLSLInstance() looks like: |
72 # class ArithmeticFP { | 77 # class ArithmeticFP { |
73 # GrGLSLFragmentProcessor* onCreateGLSLInstance() const { | 78 # GrGLSLFragmentProcessor* onCreateGLSLInstance() const { |
74 # class GLSLFP { | 79 # class GLSLFP { |
75 # void emitCode(EmitArgs& args) { ... } | 80 # void emitCode(EmitArgs& args) { ... } |
76 # }; | 81 # }; |
77 # ... | 82 # ... |
78 # } | 83 # } |
79 # }; | 84 # }; |
80 SIG = '(anonymous namespace)::Foo::Baz() const::GLSLFP::onData(Foo, Bar)' | 85 SIG = '(anonymous namespace)::Foo::Baz() const::GLSLFP::onData(Foo, Bar)' |
81 got_full, got_name = function_signature.Parse(SIG) | 86 got_full, got_name = function_signature.Parse(SIG) |
82 self.assertEqual('(anonymous namespace)::Foo::Baz', got_name) | 87 self.assertEqual('(anonymous namespace)::Foo::Baz', got_name) |
83 self.assertEqual(SIG, got_full) | 88 self.assertEqual(SIG, got_full) |
84 | 89 |
| 90 # Top-level lambda. |
| 91 # Note: Inline lambdas do not seem to be broken into their own symbols. |
| 92 SIG = 'cc::{lambda(cc::PaintOp*)#63}::_FUN(cc::PaintOp*)' |
| 93 got_full, got_name = function_signature.Parse(SIG) |
| 94 self.assertEqual('cc::{lambda#63}', got_name) |
| 95 self.assertEqual('cc::{lambda#63}(cc::PaintOp*)', got_full) |
| 96 |
85 | 97 |
86 if __name__ == '__main__': | 98 if __name__ == '__main__': |
87 logging.basicConfig(level=logging.DEBUG, | 99 logging.basicConfig(level=logging.DEBUG, |
88 format='%(levelname).1s %(relativeCreated)6d %(message)s') | 100 format='%(levelname).1s %(relativeCreated)6d %(message)s') |
89 unittest.main() | 101 unittest.main() |
OLD | NEW |