minjs 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,7 @@ module Minjs
15
15
  if @lex
16
16
  line, col = @lex.line_col(@lex_pos)
17
17
  t << "line: #{line}, col: #{col}\n"
18
- t << @lex.debug_str(@lex_pos)
18
+ t << @lex.debug_str(@lex_pos, line, col)
19
19
  end
20
20
  t
21
21
  end
@@ -5,18 +5,16 @@ module Minjs
5
5
  # 11.1
6
6
  #
7
7
  def primary_exp(lex, context, options)
8
- STDERR.puts "*** primary_exp" if @debug
9
- lex.debug_lit if @debug
10
- #STDERR.puts caller if @debug
11
- #this
8
+ @logger.debug "*** primary_exp"
9
+
12
10
  if lex.match_lit(ECMA262::ID_THIS)
13
- STDERR.puts "*** primary_exp => this" if @debug
11
+ @logger.debug "*** primary_exp => this"
14
12
  return ECMA262::ID_THIS
15
13
  end
16
14
  # (exp)
17
15
  if lex.match_lit(ECMA262::PUNC_LPARENTHESIS)
18
16
  if a=exp(lex, context, options) and lex.match_lit(ECMA262::PUNC_RPARENTHESIS)
19
- STDERR.puts "*** primary_exp => ()" if @debug
17
+ @logger.debug "*** primary_exp => ()"
20
18
  return ECMA262::ExpParen.new(a)
21
19
  else
22
20
  raise ParseError.new("no `)' at end of expression", lex)
@@ -33,7 +31,7 @@ module Minjs
33
31
  } || lex.eval_lit {
34
32
  object_literal(lex, context, options)
35
33
  }
36
- STDERR.puts "*** primary_exp => #{t}" if @debug
34
+ @logger.debug "*** primary_exp => #{t ? t.to_js : t}"
37
35
  t
38
36
  end
39
37
 
@@ -157,22 +155,25 @@ module Minjs
157
155
  # 11.2
158
156
  #
159
157
  def left_hand_side_exp(lex, context, options)
160
- STDERR.puts "*** left_hand_side_exp" if @debug
161
- lex.debug_lit if @debug
158
+ @logger.debug "*** left_hand_side_exp"
162
159
 
163
160
  t = lex.eval_lit{
164
161
  call_exp(lex, context, options)
165
162
  } || lex.eval_lit{
166
163
  new_exp(lex, context, options)
167
164
  }
168
- STDERR.puts "*** left_hand_side_exp => #{t}" if @debug
165
+ @logger.debug "*** left_hand_side_exp => #{t ? t.to_js: t}"
169
166
  t
170
167
  end
171
168
 
172
169
  def new_exp(lex, context, options)
173
170
  lex.eval_lit{
174
- if lex.match_lit(ECMA262::ID_NEW) and a=new_exp(lex, context, options)
175
- ECMA262::ExpNew.new(a, nil)
171
+ if lex.match_lit(ECMA262::ID_NEW)
172
+ if a=new_exp(lex, context, options)
173
+ ECMA262::ExpNew.new(a, nil)
174
+ else
175
+ raise ParseError.new("unexpceted token", lex)
176
+ end
176
177
  else
177
178
  nil
178
179
  end
@@ -211,10 +212,18 @@ module Minjs
211
212
  while true
212
213
  if b=arguments(lex, context, options)
213
214
  t = ECMA262::ExpCall.new(t, b)
214
- elsif lex.match_lit(ECMA262::PUNC_LSQBRAC) and b=exp(lex, context, options) and lex.match_lit(ECMA262::PUNC_RSQBRAC)
215
- t = ECMA262::ExpPropBrac.new(t, b)
216
- elsif lex.match_lit(ECMA262::PUNC_PERIOD) and (b=lex.fwd_lit()).kind_of?(ECMA262::IdentifierName)
217
- t = ECMA262::ExpProp.new(t, b)
215
+ elsif lex.match_lit(ECMA262::PUNC_LSQBRAC)
216
+ if b=exp(lex, context, options) and lex.match_lit(ECMA262::PUNC_RSQBRAC)
217
+ t = ECMA262::ExpPropBrac.new(t, b)
218
+ else
219
+ raise ParseError.new("unexpceted token", lex)
220
+ end
221
+ elsif lex.match_lit(ECMA262::PUNC_PERIOD)
222
+ if (b=lex.fwd_lit()).kind_of?(ECMA262::IdentifierName)
223
+ t = ECMA262::ExpProp.new(t, b)
224
+ else
225
+ raise ParseError.new("unexpceted token", lex)
226
+ end
218
227
  else
219
228
  break
220
229
  end
@@ -250,10 +259,18 @@ module Minjs
250
259
 
251
260
  lex.eval_lit {
252
261
  while true
253
- if lex.match_lit(ECMA262::PUNC_LSQBRAC) and b=exp(lex, context, options) and lex.match_lit(ECMA262::PUNC_RSQBRAC)
254
- t = ECMA262::ExpPropBrac.new(t, b)
255
- elsif lex.match_lit(ECMA262::PUNC_PERIOD) and (b=lex.fwd_lit()).kind_of?(ECMA262::IdentifierName)
256
- t = ECMA262::ExpProp.new(t, b)
262
+ if lex.match_lit(ECMA262::PUNC_LSQBRAC)
263
+ if b=exp(lex, context, options) and lex.match_lit(ECMA262::PUNC_RSQBRAC)
264
+ t = ECMA262::ExpPropBrac.new(t, b)
265
+ else
266
+ raise ParseError.new("unexpceted token", lex)
267
+ end
268
+ elsif lex.match_lit(ECMA262::PUNC_PERIOD)
269
+ if (b=lex.fwd_lit()).kind_of?(ECMA262::IdentifierName)
270
+ t = ECMA262::ExpProp.new(t, b)
271
+ else
272
+ raise ParseError.new("unexpceted token", lex)
273
+ end
257
274
  else
258
275
  break
259
276
  end
@@ -288,9 +305,6 @@ module Minjs
288
305
  # 11.3
289
306
  #
290
307
  def postfix_exp(lex, context, options)
291
- STDERR.puts "*** postfix_exp" if @debug
292
- lex.debug_lit if @debug
293
-
294
308
  t = lex.eval_lit{
295
309
  a = left_hand_side_exp(lex, context, options)
296
310
  return nil if a.nil?
@@ -305,7 +319,6 @@ module Minjs
305
319
  a
306
320
  end
307
321
  }
308
- STDERR.puts "*** postfix_exp => #{t}" if @debug
309
322
  t
310
323
  end
311
324
 
@@ -313,7 +326,6 @@ module Minjs
313
326
  # 11.4
314
327
  #
315
328
  def unary_exp(lex, context, options)
316
- next_exp = :postfix_exp
317
329
  lex.eval_lit{
318
330
  if punc = (lex.match_lit(ECMA262::ID_DELETE) ||
319
331
  lex.match_lit(ECMA262::ID_VOID) ||
@@ -323,8 +335,11 @@ module Minjs
323
335
  lex.match_lit(ECMA262::PUNC_ADD) ||
324
336
  lex.match_lit(ECMA262::PUNC_SUB) ||
325
337
  lex.match_lit(ECMA262::PUNC_NOT) ||
326
- lex.match_lit(ECMA262::PUNC_LNOT)) and a = unary_exp(lex, context, options)
327
- if punc.val == :delete
338
+ lex.match_lit(ECMA262::PUNC_LNOT))
339
+ a = unary_exp(lex, context, options)
340
+ if a.nil?
341
+ raise ParseError.new("unexpceted token", lex)
342
+ elsif punc.val == :delete
328
343
  ECMA262::ExpDelete.new(a)
329
344
  elsif punc.val == :void
330
345
  ECMA262::ExpVoid.new(a)
@@ -345,7 +360,7 @@ module Minjs
345
360
  end
346
361
  end
347
362
  } || lex.eval_lit{
348
- __send__(next_exp, lex, context, options)
363
+ postfix_exp(lex, context, options)
349
364
  }
350
365
  end
351
366
 
@@ -353,16 +368,15 @@ module Minjs
353
368
  # 11.5
354
369
  #
355
370
  def multiplicative_exp(lex, context, options)
356
- next_exp = :unary_exp
357
371
  lex.eval_lit {
358
- a = __send__(next_exp, lex, context, options)
372
+ a = unary_exp(lex, context, options)
359
373
  next nil if !a
360
374
  t = a
361
375
  while punc = lex.match_lit(ECMA262::PUNC_MUL) ||
362
376
  lex.match_lit(ECMA262::PUNC_DIV, :hint => :div) ||
363
377
  lex.match_lit(ECMA262::PUNC_MOD)
364
378
 
365
- if b = __send__(next_exp, lex, context, options)
379
+ if b = unary_exp(lex, context, options)
366
380
  if punc == ECMA262::PUNC_MUL
367
381
  t = ECMA262::ExpMul.new(t, b)
368
382
  elsif punc == ECMA262::PUNC_DIV
@@ -371,7 +385,7 @@ module Minjs
371
385
  t = ECMA262::ExpMod.new(t, b)
372
386
  end
373
387
  else
374
- break
388
+ raise ParseError.new("unexpceted token", lex)
375
389
  end
376
390
  end
377
391
  t
@@ -382,21 +396,20 @@ module Minjs
382
396
  # 11.6
383
397
  #
384
398
  def additive_exp(lex, context, options)
385
- next_exp = :multiplicative_exp
386
399
  lex.eval_lit {
387
- a = __send__(next_exp, lex, context, options)
400
+ a = multiplicative_exp(lex, context, options)
388
401
  next nil if !a
389
402
 
390
403
  t = a
391
404
  while punc = lex.match_lit(ECMA262::PUNC_ADD) || lex.match_lit(ECMA262::PUNC_SUB)
392
- if b = __send__(next_exp, lex, context, options)
405
+ if b = multiplicative_exp(lex, context, options)
393
406
  if punc == ECMA262::PUNC_ADD
394
407
  t = ECMA262::ExpAdd.new(t, b)
395
408
  else
396
409
  t = ECMA262::ExpSub.new(t, b)
397
410
  end
398
411
  else
399
- break
412
+ raise ParseError.new("unexpceted token", lex)
400
413
  end
401
414
  end
402
415
 
@@ -406,16 +419,15 @@ module Minjs
406
419
  #
407
420
  # 11.7
408
421
  def shift_exp(lex, context, options)
409
- next_exp = :additive_exp
410
422
  lex.eval_lit {
411
- a = __send__(next_exp, lex, context, options)
423
+ a = additive_exp(lex, context, options)
412
424
  next nil if !a
413
425
 
414
426
  t = a
415
427
  while punc = lex.match_lit(ECMA262::PUNC_LSHIFT) ||
416
428
  lex.match_lit(ECMA262::PUNC_RSHIFT) ||
417
429
  lex.match_lit(ECMA262::PUNC_URSHIFT)
418
- if b = __send__(next_exp, lex, context, options)
430
+ if b = additive_exp(lex, context, options)
419
431
  if punc == ECMA262::PUNC_LSHIFT
420
432
  t = ECMA262::ExpLShift.new(t, b)
421
433
  elsif punc == ECMA262::PUNC_RSHIFT
@@ -424,7 +436,7 @@ module Minjs
424
436
  t = ECMA262::ExpURShift.new(t, b)
425
437
  end
426
438
  else
427
- break
439
+ raise ParseError.new("unexpceted token", lex)
428
440
  end
429
441
  end
430
442
  t
@@ -435,16 +447,15 @@ module Minjs
435
447
  # 11.8
436
448
  #
437
449
  def relational_exp(lex, context, options)
438
- next_exp = :shift_exp
439
450
  lex.eval_lit {
440
- a = __send__(next_exp, lex, context, options)
451
+ a = shift_exp(lex, context, options)
441
452
  next nil if !a
442
453
 
443
454
  t = a
444
455
  while (punc = lex.match_lit(ECMA262::PUNC_LT) || lex.match_lit(ECMA262::PUNC_GT) ||
445
456
  lex.match_lit(ECMA262::PUNC_LTEQ) || lex.match_lit(ECMA262::PUNC_GTEQ) ||
446
- lex.match_lit(ECMA262::ID_INSTANCEOF) || lex.match_lit(ECMA262::ID_IN))
447
- if b = __send__(next_exp, lex, context, options)
457
+ lex.match_lit(ECMA262::ID_INSTANCEOF) || (!options[:no_in] && lex.match_lit(ECMA262::ID_IN)))
458
+ if b = shift_exp(lex, context, options)
448
459
  if punc == ECMA262::PUNC_LT
449
460
  t = ECMA262::ExpLt.new(t, b)
450
461
  elsif punc == ECMA262::PUNC_GT
@@ -460,7 +471,7 @@ module Minjs
460
471
  else
461
472
  end
462
473
  else
463
- break
474
+ raise ParseError.new("unexpceted token", lex)
464
475
  end
465
476
  end
466
477
 
@@ -476,9 +487,8 @@ module Minjs
476
487
  # a !== b
477
488
  #
478
489
  def equality_exp(lex, context, options)
479
- next_exp = :relational_exp
480
490
  lex.eval_lit {
481
- a = __send__(next_exp, lex, context, options)
491
+ a = relational_exp(lex, context, options)
482
492
  next nil if !a
483
493
 
484
494
  t = a
@@ -486,7 +496,7 @@ module Minjs
486
496
  lex.match_lit(ECMA262::PUNC_NEQ) ||
487
497
  lex.match_lit(ECMA262::PUNC_SEQ) ||
488
498
  lex.match_lit(ECMA262::PUNC_SNEQ)
489
- if b = __send__(next_exp, lex, context, options)
499
+ if b = relational_exp(lex, context, options)
490
500
  if punc == ECMA262::PUNC_EQ
491
501
  t = ECMA262::ExpEq.new(t, b)
492
502
  elsif punc == ECMA262::PUNC_NEQ
@@ -497,7 +507,7 @@ module Minjs
497
507
  t = ECMA262::ExpStrictNotEq.new(t, b)
498
508
  end
499
509
  else
500
- break
510
+ raise ParseError.new("unexpceted token", lex)
501
511
  end
502
512
  end
503
513
 
@@ -510,17 +520,16 @@ module Minjs
510
520
  # a & b
511
521
  #
512
522
  def bitwise_and_exp(lex, context, options)
513
- next_exp = :equality_exp
514
523
  lex.eval_lit {
515
- a = __send__(next_exp, lex, context, options)
524
+ a = equality_exp(lex, context, options)
516
525
  next nil if !a
517
526
 
518
527
  t = a
519
528
  while punc = lex.match_lit(ECMA262::PUNC_AND)
520
- if b = __send__(next_exp, lex, context, options)
529
+ if b = equality_exp(lex, context, options)
521
530
  t = ECMA262::ExpAnd.new(t, b)
522
531
  else
523
- break
532
+ raise ParseError.new("unexpceted token", lex)
524
533
  end
525
534
  end
526
535
 
@@ -532,17 +541,16 @@ module Minjs
532
541
  # a ^ b
533
542
  #
534
543
  def bitwise_xor_exp(lex, context, options)
535
- next_exp = :bitwise_and_exp
536
544
  lex.eval_lit {
537
- a = __send__(next_exp, lex, context, options)
545
+ a = bitwise_and_exp(lex, context, options)
538
546
  next nil if !a
539
547
 
540
548
  t = a
541
549
  while punc = lex.match_lit(ECMA262::PUNC_XOR)
542
- if b = __send__(next_exp, lex, context, options)
550
+ if b = bitwise_and_exp(lex, context, options)
543
551
  t = ECMA262::ExpXor.new(t, b)
544
552
  else
545
- break
553
+ raise ParseError.new("unexpceted token", lex)
546
554
  end
547
555
  end
548
556
 
@@ -554,17 +562,16 @@ module Minjs
554
562
  # a | b
555
563
  #
556
564
  def bitwise_or_exp(lex, context, options)
557
- next_exp = :bitwise_xor_exp
558
565
  lex.eval_lit {
559
- a = __send__(next_exp, lex, context, options)
566
+ a = bitwise_xor_exp(lex, context, options)
560
567
  next nil if !a
561
568
 
562
569
  t = a
563
570
  while punc = lex.match_lit(ECMA262::PUNC_OR)
564
- if b = __send__(next_exp, lex, context, options)
571
+ if b = bitwise_xor_exp(lex, context, options)
565
572
  t = ECMA262::ExpOr.new(t, b)
566
573
  else
567
- break
574
+ raise ParseError.new("unexpceted token", lex)
568
575
  end
569
576
  end
570
577
 
@@ -576,17 +583,16 @@ module Minjs
576
583
  # a && b
577
584
  #
578
585
  def logical_and_exp(lex, context, options)
579
- next_exp = :bitwise_or_exp
580
586
  lex.eval_lit {
581
- a = __send__(next_exp, lex, context, options)
587
+ a = bitwise_or_exp(lex, context, options)
582
588
  next nil if !a
583
589
 
584
590
  t = a
585
591
  while punc = lex.match_lit(ECMA262::PUNC_LAND)
586
- if b = __send__(next_exp, lex, context, options)
592
+ if b = bitwise_or_exp(lex, context, options)
587
593
  t = ECMA262::ExpLogicalAnd.new(t, b)
588
594
  else
589
- break
595
+ raise ParseError.new("unexpceted token", lex)
590
596
  end
591
597
  end
592
598
 
@@ -595,17 +601,16 @@ module Minjs
595
601
  end
596
602
 
597
603
  def logical_or_exp(lex, context, options)
598
- next_exp = :logical_and_exp
599
604
  lex.eval_lit {
600
- a = __send__(next_exp, lex, context, options)
605
+ a = logical_and_exp(lex, context, options)
601
606
  next nil if !a
602
607
 
603
608
  t = a
604
609
  while punc = lex.match_lit(ECMA262::PUNC_LOR)
605
- if b = __send__(next_exp, lex, context, options)
610
+ if b = logical_and_exp(lex, context, options)
606
611
  t = ECMA262::ExpLogicalOr.new(t, b)
607
612
  else
608
- break
613
+ raise ParseError.new("unexpceted token", lex)
609
614
  end
610
615
  end
611
616
 
@@ -621,8 +626,12 @@ module Minjs
621
626
  a = logical_or_exp(lex, context, options)
622
627
  next nil if !a
623
628
 
624
- if lex.match_lit(ECMA262::PUNC_CONDIF) and b=assignment_exp(lex, context, options) and lex.match_lit(ECMA262::PUNC_CONDELSE) and c=assignment_exp(lex, context, options)
625
- ECMA262::ExpCond.new(a, b, c)
629
+ if lex.match_lit(ECMA262::PUNC_CONDIF)
630
+ if b=assignment_exp(lex, context, options) and lex.match_lit(ECMA262::PUNC_CONDELSE) and c=assignment_exp(lex, context, options)
631
+ ECMA262::ExpCond.new(a, b, c)
632
+ else
633
+ raise ParseError.new("unexpceted token", lex)
634
+ end
626
635
  else
627
636
  a
628
637
  end
@@ -633,8 +642,8 @@ module Minjs
633
642
  #11.13
634
643
  #
635
644
  def assignment_exp(lex, context, options)
636
- STDERR.puts "*** assignment_exp" if @debug
637
- lex.debug_lit if @debug
645
+ @logger.debug "*** assignment_exp"
646
+
638
647
  left_hand = nil
639
648
  t = cond_exp(lex, context, options)
640
649
  return nil if t.nil?
@@ -683,10 +692,11 @@ module Minjs
683
692
  else
684
693
  raise "internal error"
685
694
  end
686
- else # some assignment operator presents but no assignment_expression => fail
687
- return nil
695
+ else
696
+ raise ParseError.new("unexpceted token", lex)
688
697
  end
689
698
  else
699
+ @logger.debug "*** assignment_exp => #{t ? t.to_js : t}"
690
700
  t
691
701
  end
692
702
  }
@@ -696,15 +706,17 @@ module Minjs
696
706
  # 11.14
697
707
  #
698
708
  def exp(lex, context, options)
709
+ @logger.debug "*** expression"
699
710
  lex.eval_lit{
700
711
  t = assignment_exp(lex, context, {:hint => :regexp}.merge(options))
701
712
  while punc = lex.match_lit(ECMA262::PUNC_COMMA)
702
713
  if b = assignment_exp(lex,context, {:hint => :regexp}.merge(options))
703
714
  t = ECMA262::ExpComma.new(t, b)
704
715
  else
705
- break
716
+ raise ParseError.new("unexpceted token", lex)
706
717
  end
707
718
  end
719
+ @logger.debug "*** expression => #{t ? t.to_js : t}"
708
720
  t
709
721
  }
710
722
  end
data/lib/minjs/func.rb CHANGED
@@ -34,8 +34,7 @@ module Minjs
34
34
 
35
35
  def func_exp(lex, context)
36
36
  return nil if lex.match_lit(ECMA262::ID_FUNCTION).nil?
37
- STDERR.puts "*** func_exp" if @debug
38
- lex.debug_lit if @debug
37
+ @logger.debug "*** func_exp"
39
38
 
40
39
  lex.eval_lit {
41
40
  id_opt = identifier(lex, context)
data/lib/minjs/lex.rb CHANGED
@@ -14,9 +14,7 @@ module Minjs
14
14
  @pos = 0
15
15
  @lit_cache = []
16
16
  @lit_nextpos = []
17
- if options[:debug]
18
- @debug = true
19
- end
17
+ @logger = options[:logger]
20
18
  end
21
19
 
22
20
  def next_input_element(options = {})
@@ -391,7 +389,6 @@ module Minjs
391
389
  raise ParseError.new("no `/' end of regular expression", self)
392
390
  end
393
391
  if line_terminator?(@codes[@pos])
394
- debug_lit
395
392
  raise ParseError.new("regular expression has line terminator in body", self)
396
393
  end
397
394
  if @codes[@pos] == 0x5c # \
@@ -535,6 +532,7 @@ module Minjs
535
532
  def decimal_digits
536
533
  pos0 = @pos
537
534
  code = @codes[@pos]
535
+ return nil if code.nil?
538
536
  if code >= 0x30 and code <= 0x39
539
537
  @pos += 1
540
538
  while true
@@ -652,7 +650,6 @@ module Minjs
652
650
  def match_lit(l, options = {})
653
651
  eval_lit {
654
652
  t = fwd_lit(options)
655
- STDERR.puts "match_lit #{t} <=> #{l} #{t==l}" if @debug
656
653
  t == l ? t : nil
657
654
  }
658
655
  end
@@ -717,7 +714,7 @@ module Minjs
717
714
  @codes[from,to].pack("U*")
718
715
  end
719
716
 
720
- def debug_str(pos = nil)
717
+ def debug_str(pos = nil, line = nil, col = nil)
721
718
  if pos.nil?
722
719
  pos = @error_pos
723
720
  if pos.nil?
@@ -731,8 +728,11 @@ module Minjs
731
728
  pos0 = pos
732
729
  pos = 0
733
730
  end
731
+ if col and col > 2
732
+ pos0 = col - 2;
733
+ end
734
734
  t = ''
735
- t << @codes[pos..(pos+80)].collect{|u| u == 10 ? 0x20 : u}.pack("U*")
735
+ t << @codes[pos..(pos+80)].pack("U*")
736
736
  t << "\n"
737
737
  t << (' ' * pos0) + "^"
738
738
  t
@@ -1,8 +1,9 @@
1
1
  require 'tilt'
2
+ require 'logger'
2
3
 
3
4
  module Minjs
4
5
  class MinjsCompressor < Tilt::Template
5
- DEBUG = false
6
+ attr_reader :logger
6
7
 
7
8
  def self.engine_initialized?
8
9
  defined?(::Minjs)
@@ -12,12 +13,14 @@ module Minjs
12
13
  end
13
14
 
14
15
  def prepare
16
+ @logger = Logger.new(STDERR)
17
+ @logger.level = Logger::WARN
15
18
  end
16
19
 
17
20
  def evaluate(context, locals, &block)
18
21
  case context.content_type
19
22
  when 'application/javascript'
20
- if DEBUG
23
+ if logger.debug?
21
24
  @@c = 0 unless defined?(@@c)
22
25
  puts "start: compressing"
23
26
  file = "tmp#{@@c}.js"
@@ -29,8 +32,9 @@ module Minjs
29
32
  tmp.write(data)
30
33
  tmp.close
31
34
  end
32
- t = Minjs::Compressor.new.compress(data)
33
- if DEBUG
35
+ #TODO
36
+ t = Minjs::Compressor.new(:logger => logger).compress(data)
37
+ if logger.debug?
34
38
  tmp = open(output, "w")
35
39
  tmp.write(t)
36
40
  tmp.close
data/lib/minjs/program.rb CHANGED
@@ -13,7 +13,7 @@ module Minjs
13
13
  break
14
14
  end
15
15
  end
16
- ECMA262::Prog.new(context, prog)
16
+ ECMA262::Prog.new(context, ECMA262::SourceElements.new(prog))
17
17
  end
18
18
 
19
19
  def source_element(lex, context)