Skip to content

Commit

Permalink
codegen: compliant directive recognition
Browse files Browse the repository at this point in the history
test262: 50.96% | πŸ§ͺ 48381 | 🀠 24655 | ❌ 6924 | πŸ’€ 15257 | πŸ—οΈ 146 | πŸ’₯ 329 | ⏰ 134 | πŸ“ 936
  • Loading branch information
CanadaHonk committed Nov 25, 2024
1 parent f3f1b03 commit d0c3beb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
10 changes: 3 additions & 7 deletions compiler/codegen.js
Original file line number Diff line number Diff line change
Expand Up @@ -1786,15 +1786,11 @@ const disposeLeftover = wasm => {
};

const generateExp = (scope, decl) => {
const expression = decl.expression;

if (expression.type === 'Literal' && typeof expression.value === 'string') {
if (expression.value === 'use strict') {
scope.strict = true;
}
if (decl.directive === 'use strict') {
scope.strict = true;
}

const out = generate(scope, expression, undefined, undefined, !scope.inEval);
const out = generate(scope, decl.expression, undefined, undefined, !scope.inEval);
disposeLeftover(out);

return out;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "porffor",
"description": "a basic experimental wip aot optimizing js -> wasm engine/compiler/runtime in js",
"version": "0.50.9",
"version": "0.50.10",
"author": "CanadaHonk",
"license": "MIT",
"scripts": {},
Expand Down
2 changes: 1 addition & 1 deletion runner/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
import fs from 'node:fs';
globalThis.version = '0.50.9';
globalThis.version = '0.50.10';

// deno compat
if (typeof process === 'undefined' && typeof Deno !== 'undefined') {
Expand Down
2 changes: 1 addition & 1 deletion test262/history.json

Large diffs are not rendered by default.

0 comments on commit d0c3beb

Please sign in to comment.