Skip to content

Commit 2d81cc8

Browse files
committed
migrate include/require to new structure
1 parent 9732468 commit 2d81cc8

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/nodes/external.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66
'use strict';
77

8-
var node = require('../data/node');
9-
var expr = require('./expr');
8+
var Node = require('../data/node');
9+
var Expr = require('./expr');
1010

1111
/**
1212
* ** Extends from {@link NODE.md|:link: node} **
@@ -19,16 +19,17 @@ var expr = require('./expr');
1919
* @property {Boolean} once If true it's a include_once or require_once statement
2020
* @property {Boolean} strict If true then it's a require statement
2121
*/
22-
var External = node.extends('external');
22+
var External = Node.extends('external');
2323

2424

2525
/**
2626
* @protected Consumes the current ast node
2727
*/
28-
External.prototype.consume = function(ast) {
28+
External.prototype.consume = function(file, parent, ast) {
2929
this.strict = ast.require;
3030
this.once = ast.once;
31-
this.target = expr.resolve(this, ast.target);
31+
this.target = Expr.resolve(this, ast.target);
32+
Node.prototype.consume.apply(this, arguments);
3233
};
3334

3435
/**
@@ -38,7 +39,8 @@ External.prototype.consume = function(ast) {
3839
External.prototype.getTargetFile = function() {
3940
if (typeof this.target === 'string') {
4041
if (!this._file) {
41-
this._file = this.getRepository().get(this.target);
42+
// @todo this part should be rewrite
43+
this._file = this.getRepository().getFile(this.target);
4244
if (!this._file) {
4345
return this.getRepository().parse(
4446
this.target

0 commit comments

Comments
 (0)