mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Added support for templated methods in InoToCPPConverter (#858)
* Added support for templated methods in InoToCPPConverter
This commit is contained in:
@ -32,6 +32,7 @@ from platformio import util
|
|||||||
class InoToCPPConverter(object):
|
class InoToCPPConverter(object):
|
||||||
|
|
||||||
PROTOTYPE_RE = re.compile(r"""^(
|
PROTOTYPE_RE = re.compile(r"""^(
|
||||||
|
(?:template\<.*\>\s*)? # template
|
||||||
([a-z_\d]+\*?\s+){1,2} # return type
|
([a-z_\d]+\*?\s+){1,2} # return type
|
||||||
([a-z_\d]+\s*) # name of prototype
|
([a-z_\d]+\s*) # name of prototype
|
||||||
\([a-z_,\.\*\&\[\]\s\d]*\) # arguments
|
\([a-z_,\.\*\&\[\]\s\d]*\) # arguments
|
||||||
|
@ -26,12 +26,15 @@ Foo foo(&fooCallback);
|
|||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
template<class T> T Add(T n1, T n2) {
|
||||||
|
return n1 + n2;
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
struct Item item1;
|
struct Item item1;
|
||||||
myFunction(&item1);
|
myFunction(&item1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -40,7 +43,7 @@ void myFunction(struct Item *item) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#warning "Line number is 43"
|
#warning "Line number is 46"
|
||||||
|
|
||||||
void fooCallback(){
|
void fooCallback(){
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ def test_warning_line(clirunner, validate_cliresult):
|
|||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert ('basic.ino:16:14: warning: #warning "Line number is 16"' in
|
assert ('basic.ino:16:14: warning: #warning "Line number is 16"' in
|
||||||
result.output)
|
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.output)
|
||||||
result = clirunner.invoke(
|
result = clirunner.invoke(
|
||||||
cmd_ci, [join(INOTEST_DIR, "strmultilines"), "-b", "uno"])
|
cmd_ci, [join(INOTEST_DIR, "strmultilines"), "-b", "uno"])
|
||||||
|
Reference in New Issue
Block a user