Skip to content

Commit

Permalink
chore: remove unnecessary changes for porting
Browse files Browse the repository at this point in the history
  • Loading branch information
Goonco committed Feb 5, 2025
1 parent fc6bb4f commit d2cfe87
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 870 deletions.
14 changes: 2 additions & 12 deletions .completion
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,21 @@ _esmeta_completions() {
local cur prev opts lastc informats outformats datafiles
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmdList="help extract compile build-cfg tycheck parse eval web construct test262-test fuzz inject mutate dump web-from-dump"
cmdList="help extract compile build-cfg tycheck parse eval web test262-test fuzz inject mutate dump"
globalOpt="-silent -error -status -time -test262dir"
helpOpt=""
extractOpt="-extract:target -extract:log -extract:eval -extract:repl"
compileOpt="-compile:log -compile:log-with-loc -compile:no-opt"
compileOpt="-compile:log -compile:log-with-loc -compile:opt"
buildcfgOpt="-build-cfg:log -build-cfg:dot -build-cfg:pdf"
tycheckOpt="-tycheck:target -tycheck:repl -tycheck:repl-continue -tycheck:ignore -tycheck:update-ignore -tycheck:log -tycheck:detail-log -tycheck:type-sens -tycheck:infer-guard"
parseOpt="-parse:debug"
evalOpt="-eval:timeout -eval:multiple -eval:log -eval:detail-log"
webOpt="-web:port"
constructOpt=""
test262testOpt="-test262-test:target -test262-test:features -test262-test:progress -test262-test:coverage -test262-test:k-fs -test262-test:cp -test262-test:total-coverage -test262-test:timeout -test262-test:with-yet -test262-test:log -test262-test:detail-log -test262-test:concurrent"
fuzzOpt="-fuzz:log -fuzz:log-interval -fuzz:out -fuzz:debug -fuzz:timeout -fuzz:trial -fuzz:duration -fuzz:seed -fuzz:cp -fuzz:init -fuzz:k-fs"
injectOpt="-inject:defs -inject:out -inject:log"
mutateOpt="-mutate:out -mutate:mutator -mutate:untilValid"
dumpOpt=""
webfromdumpOpt="-web-from-dump:port"
# completion for commands
case "${COMP_CWORD}" in
1)
Expand Down Expand Up @@ -72,10 +70,6 @@ _esmeta_completions() {
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt} ${compileOpt} ${buildcfgOpt} ${webOpt}"))
return 0
;;
construct)
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt} ${compileOpt} ${buildcfgOpt} ${constructOpt}"))
return 0
;;
test262-test)
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt} ${compileOpt} ${buildcfgOpt} ${test262testOpt}"))
return 0
Expand All @@ -96,10 +90,6 @@ _esmeta_completions() {
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt} ${compileOpt} ${buildcfgOpt} ${dumpOpt}"))
return 0
;;
web-from-dump)
COMPREPLY=($(compgen -W "${globalOpt} ${extractOpt} ${compileOpt} ${buildcfgOpt} ${dumpOpt} ${webfromdumpOpt}"))
return 0
;;
esac
return 0
;;
Expand Down
18 changes: 0 additions & 18 deletions src/main/scala/esmeta/Command.scala
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ case object CmdCompile extends Command("compile", CmdExtract >> Compile) {
val examples = List(
"esmeta compile # compile spec to IR program.",
"esmeta compile -extract:target=es2022 # compile es2022 spec to IR program",
"esmeta compile -compile:no-opt # compile with out IR optimization",
)
}

Expand Down Expand Up @@ -145,15 +144,6 @@ case object CmdWeb extends Command("web", CmdBuildCFG >> Web) {
)
}

/** `construct` command */
case object CmdConstruct
extends Command("construct", CmdBuildCFG >> Construct) {
val help = "starts a web server for an ECMAScript double debugger."
val examples = List(
"esmeta construct # builds file for ECMAVisualizer.",
)
}

// -----------------------------------------------------------------------------
// Tester for Test262 (ECMAScript Test Suite)
// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -209,11 +199,3 @@ case object CmdDump extends Command("dump", CmdBuildCFG >> Dump) {
"esmeta dump # dump data to data.json",
)
}

case object CmdWebFromDump
extends Command("web-from-dump", CmdDump >> WebFromDump) {
def help = "dump some esmeta data to json."
val examples = List(
"esmeta web-from-dump",
)
}
4 changes: 0 additions & 4 deletions src/main/scala/esmeta/ESMeta.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,13 @@ object ESMeta extends Git(BASE_DIR) {
CmdParse,
CmdEval,
CmdWeb,
CmdConstruct,
// Tester for Test262 (ECMAScript Test Suite)
CmdTest262Test,
// ECMAScript Fuzzer
CmdFuzz,
CmdInject,
CmdMutate,
CmdDump,
CmdWebFromDump,
)
val cmdMap = commands.foldLeft[Map[String, Command[_]]](Map()) {
case (map, cmd) => map + (cmd.name -> cmd)
Expand All @@ -100,15 +98,13 @@ object ESMeta extends Git(BASE_DIR) {
Parse,
Eval,
Web,
Construct,
// Tester for Test262 (ECMAScript Test Suite)
Test262Test,
// ECMAScript Fuzzer
Fuzz,
Inject,
Mutate,
Dump,
WebFromDump,
)

/** command options */
Expand Down
8 changes: 4 additions & 4 deletions src/main/scala/esmeta/compiler/Compiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ object Compiler:
def apply(
spec: Spec,
log: Boolean = false,
noOpt: Boolean = false,
): Program = new Compiler(spec, log, noOpt).result
opt: Boolean = false,
): Program = new Compiler(spec, log, opt).result

/** extensible helper of compiler from metalangauge to IR */
class Compiler(
spec: Spec,
log: Boolean = false,
noOpt: Boolean = false,
opt: Boolean = false,
) {

/** compiled specification */
Expand Down Expand Up @@ -253,7 +253,7 @@ class Compiler(
lazy val e = expr.fold(EUndef())(compile(fb, _))
(expr, fb.returnContext, fb.needReturnComp) match
case (Some(ReturnIfAbruptExpression(expr, check)), None, true) =>
if (check && noOpt)
if (check && !opt)
val e = returnIfAbrupt(fb, compile(fb, expr), check, false, true)
else
val e = returnIfAbrupt(fb, compile(fb, expr), check, true)
Expand Down
Loading

0 comments on commit d2cfe87

Please sign in to comment.