@@ -185,7 +185,7 @@ class Compiler {
185185 getField ( name ) {
186186 const path = name . split ( '/' )
187187 let i = this . scopeStack . length - 1
188- const reserved = { value : true , enum : true }
188+ const reserved = [ ' value' , ' enum' , 'default' , 'size' ]
189189 while ( path . length ) {
190190 const scope = this . scopeStack [ i ]
191191 const field = path . shift ( )
@@ -200,7 +200,7 @@ class Compiler {
200200 }
201201 // Count how many collision occured in the scope
202202 let count = 0
203- if ( reserved [ field ] ) count ++
203+ if ( reserved . includes ( field ) ) count ++
204204 for ( let j = 0 ; j < i ; j ++ ) {
205205 if ( this . scopeStack [ j ] [ field ] ) count ++
206206 }
@@ -269,7 +269,7 @@ class ReadCompiler extends Compiler {
269269 if ( this . types [ type [ 0 ] ] && this . types [ type [ 0 ] ] !== 'native' ) {
270270 return this . wrapCode ( 'return ' + this . callType ( type [ 0 ] , 'offset' , Object . values ( type [ 1 ] ) ) )
271271 }
272- throw new Error ( 'Unknown parametrizable type: ' + type [ 0 ] )
272+ throw new Error ( 'Unknown parametrizable type: ' + JSON . stringify ( type [ 0 ] ) )
273273 } else { // Primitive type
274274 if ( type === 'native' ) return 'null'
275275 if ( this . types [ type ] ) { return 'ctx.' + type }
0 commit comments