@@ -110,11 +110,12 @@ FEATURES.forEach(function(feature) {
110
110
111
111
112
112
/// Lexer
113
- function Lexer ( filename , buffer ) {
113
+ function Lexer ( filename , buffer , errors ) {
114
114
this . filenameObj = allocateCString ( filename ) ;
115
115
this . bufferObj = allocateBuffer ( buffer ) ;
116
116
this . addr = Module . _wabt_new_wast_buffer_lexer (
117
- this . filenameObj . addr , this . bufferObj . addr , this . bufferObj . size ) ;
117
+ this . filenameObj . addr , this . bufferObj . addr , this . bufferObj . size ,
118
+ errors . addr ) ;
118
119
}
119
120
Lexer . prototype = Object . create ( Object . prototype ) ;
120
121
@@ -159,10 +160,9 @@ OutputBuffer.prototype.destroy = function() {
159
160
160
161
161
162
/// Errors
162
- function Errors ( kind , lexer ) {
163
+ function Errors ( kind ) {
163
164
this . kind = kind ;
164
165
this . addr = Module . _wabt_new_errors ( ) ;
165
- this . lexer = lexer ;
166
166
}
167
167
Errors . prototype = Object . create ( Object . prototype ) ;
168
168
@@ -194,8 +194,9 @@ Errors.prototype.destroy = function() {
194
194
195
195
/// parseWat
196
196
function parseWat ( filename , buffer , options ) {
197
- var lexer = new Lexer ( filename , buffer ) ;
198
- var errors = new Errors ( 'text' , lexer ) ;
197
+ var errors = new Errors ( 'text' ) ;
198
+ var lexer = new Lexer ( filename , buffer , errors ) ;
199
+ errors . lexer = lexer ;
199
200
var features = new Features ( options || { } ) ;
200
201
201
202
try {
0 commit comments