Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Compiler.prototype._getRemainderCode = function (ast) {
var remainderAst = Ast.getRemainderAst(ast);
if (remainderAst) {
CallAnalyzer.run(remainderAst, this.filename, this.errs, true, this.sourceIndex, this.src);
if (this.ok) {
var remainderCode = astProcessor.gen_code(remainderAst, {beautify: true});
return Hammerhead.wrapDomAccessors(remainderCode, true);
}
}
return '';
};
Compiler.prototype._addOutputTestStepData = function (testName, testStepData) {
var js = astProcessor.gen_code(['array', testStepData.asts], {beautify: true});
this.out.testsStepData[testName] = {
names: testStepData.names,
js: Hammerhead.wrapDomAccessors(js, true)
};
};
Ast.construct(requireFilename, ownerFilename, function (parsingErr, requireAst, srcCode) {
if (parsingErr)
errs.push(parsingErr);
else if (requireAst) {
descriptor.jsCode = srcCode;
analyzeRequireCode(requireAst, descriptor, errs, sourceIndex);
}
if (!errs.length)
descriptor.jsCode = Hammerhead.wrapDomAccessors(descriptor.jsCode, true);
//NOTE: User can forget ';' at the end of the require js file. In this case, an js exception may occure after
//requires merging. So we add ';' at the end of the require code manually
if (descriptor.jsCode && descriptor.jsCode[descriptor.jsCode.length - 1] !== ';')
descriptor.jsCode += ';';
descriptor.hasErrs = !!errs.length;
callback(errs, descriptor);
});
};