|
3 | 3 | const async = require('async'); |
4 | 4 | const fs = require('fs'); |
5 | 5 | const RuntimeError = require('./error/Runtime'); |
| 6 | +const path = require('path'); |
6 | 7 |
|
7 | 8 | const Parser = require('./Parser'); |
8 | 9 | const Lexer = require('./Lexer'); |
@@ -63,9 +64,13 @@ class Runner { |
63 | 64 | const tasks = {}; |
64 | 65 |
|
65 | 66 | for (const value of sources) { |
66 | | - const path = value.type === PARSER_TYPE_VARIABLE ? this.getValueFromVariable(value.name) : value.value; |
| 67 | + const templatePath = path.resolve( |
| 68 | + value.type === PARSER_TYPE_VARIABLE |
| 69 | + ? this.getValueFromVariable(value.name) |
| 70 | + : value.value |
| 71 | + ); |
67 | 72 |
|
68 | | - tasks[path] = fs.readFile.bind(fs, path); |
| 73 | + tasks[templatePath] = fs.readFile.bind(fs, templatePath); |
69 | 74 | } |
70 | 75 |
|
71 | 76 | async.parallel(tasks, (err, files) => { |
@@ -97,13 +102,11 @@ class Runner { |
97 | 102 | } |
98 | 103 |
|
99 | 104 | invokeInclude(statement) { |
100 | | - const path = statement.value.type === PARSER_TYPE_VARIABLE |
| 105 | + const templatePath = statement.value.type === PARSER_TYPE_VARIABLE |
101 | 106 | ? this.getValueFromVariable(statement.value.name) |
102 | 107 | : statement.value.value; |
103 | 108 |
|
104 | | - if (this.astCache[path]) { |
105 | | - this.invokeStatements(this.astCache[path].statements); |
106 | | - } |
| 109 | + this.invokeStatements(this.astCache[templatePath].statements); |
107 | 110 | } |
108 | 111 |
|
109 | 112 | invokeBranch(statement) { |
|
0 commit comments