Skip to content
Browse files

Use 'use strict'; in generated code too

  • Loading branch information...
1 parent b74569d commit 9e7288ffe1b85e56404aa8c75a18fbeef43d80cc @squaremo committed Dec 2, 2013
Showing with 8 additions and 2 deletions.
  1. +6 −2 Makefile
  2. +2 −0 lib/compile.js
View
8 Makefile
@@ -1,11 +1,15 @@
.PHONY: test all
GRAMMAR=lib/grammar.pegjs
+PEGJS=./node_modules/.bin/pegjs
all: lib/parser.js
-lib/parser.js:
- ./node_modules/pegjs/bin/pegjs $(GRAMMAR) $@
+lib/parser.js: $(PEGJS)
+ $(PEGJS) $(GRAMMAR) $@
+
+$(PEGJS):
+ npm install
test: lib/parser.js
./node_modules/.bin/mocha --check-leaks -R list -u tdd test/*.js
View
2 lib/compile.js
@@ -146,6 +146,7 @@ function variables(segments) {
function compile_pattern(segments) {
$start();
$line("return function(binary, env) {");
+ $line("'use strict';");
$line("var bin = binary, env = env || {};");
$line("var offset = 0, binsize = bin.length * 8;");
$line("var bits, result, byteoffset;");
@@ -275,6 +276,7 @@ function emit_write(segments) {
function compile_ctor(segments) {
$start();
$line('return function(bindings) {');
+ $line("'use strict';");
size_of(segments);
$line('var buf = new Buffer(buffersize);');
$line('var offset = 0;');

0 comments on commit 9e7288f

Please sign in to comment.
Something went wrong with that request. Please try again.