diff --git a/impl/worker/mapping.go b/impl/worker/mapping.go index 5da9ba8..eb34e52 100644 --- a/impl/worker/mapping.go +++ b/impl/worker/mapping.go @@ -33,6 +33,7 @@ var ( "timer.Delay": "delay", "wifi": "WiFi", "wifi.Client": "WiFiClient", + "client.Connect": "client.connect", "wifi.Begin": "WiFi.begin", "wifi.BeginEncrypted": "WiFi.begin", "wifi.BSSID": "WiFi.BSSID", diff --git a/impl/worker/worker.go b/impl/worker/worker.go index ba53701..3e5ee1f 100644 --- a/impl/worker/worker.go +++ b/impl/worker/worker.go @@ -8,6 +8,7 @@ import ( "go/token" "io" "strings" + "os" ) const ( @@ -74,7 +75,7 @@ func (w *Worker) Start() error { } } // Print the AST. - // ast.Fprint(os.Stderr, fset, file, nil) + ast.Fprint(os.Stderr, fset, file, nil) return nil } @@ -152,12 +153,20 @@ func handleExpr(expr ast.Expr) string { code += handleCallExpr(e) case *ast.Ident: code += handleIdent(e) + case *ast.ParenExpr: + code += handleParenExpr(e) case *ast.SelectorExpr: code += handleSelectorExpr(e) } return code } +func handleParenExpr (stmt *ast.ParenExpr) string { + code := "" + code += handleExpr(stmt.X) + return code +} + func handleExprStmt(stmt *ast.ExprStmt) string { code := "" switch x := stmt.X.(type) { diff --git a/impl/worker/worker_test.go b/impl/worker/worker_test.go index 5ce4957..f060bc3 100644 --- a/impl/worker/worker_test.go +++ b/impl/worker/worker_test.go @@ -471,7 +471,7 @@ func Test_WiFiWebClient(t *testing.T) { Serial.print("Connecting to"); Serial.println(host); Serial.print(" ..."); - if(){ + if(client.connect(host, 443){ Serial.println(" Connected!"); } else { Serial.println(" Failed!");