Skip to content

Commit fc3da10

Browse files
committed
fix: handle results for undefined part file.
1 parent a1900ff commit fc3da10

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import { main } from './lib/main.js'
22

3-
let ocPath = 'test/objc/NetworkRequest.h'
4-
let javaPath = 'test/java/helloworld.java'
3+
let path = 'test/objc/NetworkRequest.h'
4+
// let path = 'test/java/helloworld.java'
55
let option = {
66
output: 'test/dart',
77
// template: 'plugin',
88
// projectName: 'testPlugin'
99
}
1010

11-
// run objc
12-
main(ocPath, option, true)
13-
// run java
14-
main(javaPath, option, false)
11+
// run
12+
main(path, option, true)

lib/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Worker } from 'worker_threads'
66
import DNObjectiveCConverter from './objc/DNObjectiveCConverter.js'
77
import DNJavaConverter from './java/DNJavaConverter.js'
88

9-
let dnPartExtension = 'dnpart'
9+
const dnPartExtension = 'dnpart'
1010
var outputDir
1111
var projectName
1212
var packageSet = new Set()
@@ -68,7 +68,7 @@ function writeOutputToFileByPath(result, srcPath) {
6868
var srcFile = srcPath.substr(srcPath.lastIndexOf('/') + 1)
6969
var components
7070
if (srcFile.endsWith(dnPartExtension)) {
71-
partExtension = srcFile.split('.').slice(-2).join('.')
71+
const partExtension = srcFile.split('.').slice(-2).join('.')
7272
components = srcFile.split('.').slice(0, -3)
7373
components.push('dart')
7474
components.push(partExtension)
@@ -201,7 +201,7 @@ async function runWorkItems(workItems) {
201201
})
202202
return Promise.all(ps).then((results) => {
203203
// merge files
204-
mergeFiles(results)
204+
mergeFiles(results.filter((f) => f != undefined))
205205
})
206206
})
207207
await Promise.all(promises)

0 commit comments

Comments
 (0)