* Create a require statement to be inserted at the top of the program. * * @param {Object} options [description] * @return {Object} [description]
(options)
| 70 | * @return {Object} [description] |
| 71 | */ |
| 72 | function createRequireStatement(options) { |
| 73 | OBLIGATIONS.precondition(options && typeof options === 'object'); |
| 74 | return { |
| 75 | type: 'VariableDeclaration', |
| 76 | kind: 'var', |
| 77 | declarations: [{ |
| 78 | type: 'VariableDeclarator', |
| 79 | id: { |
| 80 | type: 'Identifier', |
| 81 | name: options.libIdentifier |
| 82 | }, |
| 83 | init: { |
| 84 | type: 'CallExpression', |
| 85 | callee: { |
| 86 | type: 'Identifier', |
| 87 | name: 'require' |
| 88 | }, |
| 89 | arguments: [{ |
| 90 | type: 'Literal', |
| 91 | value: options.require, |
| 92 | raw: JSON.stringify(options.require) |
| 93 | }] |
| 94 | } |
| 95 | }] |
| 96 | }; |
| 97 | } |
| 98 | /** |
| 99 | * Processes `FunctionDeclaration` and `FunctionExpression` instances. |
| 100 | * These are the only structures which may contain contracts. |