Added support for templated methods in InoToCPPConverter (#858)

* Added support for templated methods in InoToCPPConverter
This commit is contained in:
Xose Pérez
2016-12-22 01:15:01 +01:00
committed by Ivan Kravets
parent 7f38c85738
commit 1a4c5df14d
3 changed files with 7 additions and 3 deletions

View File

@ -32,6 +32,7 @@ from platformio import util
class InoToCPPConverter(object):
PROTOTYPE_RE = re.compile(r"""^(
(?:template\<.*\>\s*)? # template
([a-z_\d]+\*?\s+){1,2} # return type
([a-z_\d]+\s*) # name of prototype
\([a-z_,\.\*\&\[\]\s\d]*\) # arguments

View File

@ -26,12 +26,15 @@ Foo foo(&fooCallback);
//
template<class T> T Add(T n1, T n2) {
return n1 + n2;
}
void setup() {
struct Item item1;
myFunction(&item1);
}
void loop() {
}
@ -40,7 +43,7 @@ void myFunction(struct Item *item) {
}
#warning "Line number is 43"
#warning "Line number is 46"
void fooCallback(){

View File

@ -42,7 +42,7 @@ def test_warning_line(clirunner, validate_cliresult):
validate_cliresult(result)
assert ('basic.ino:16:14: warning: #warning "Line number is 16"' in
result.output)
assert ('basic.ino:43:2: warning: #warning "Line number is 43"' in
assert ('basic.ino:46:2: warning: #warning "Line number is 46"' in
result.output)
result = clirunner.invoke(
cmd_ci, [join(INOTEST_DIR, "strmultilines"), "-b", "uno"])