id
stringlengths 1
6
| tokens
sequence | labels
sequence |
---|---|---|
100 | [
"exports",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"Config",
"}",
"from",
"'../../src/lib/config'",
";",
"import",
"{",
"getFileConfig",
"}",
"from",
"'../../src/lib/config/loader'",
";",
"async",
"return",
"{",
"Config",
"}",
"export",
"async",
"function",
"setup",
"(",
")",
"{",
"const",
"configPath",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'../fixture/config.js'",
")",
";",
"return",
"getFileConfig",
"(",
"configPath",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
101 | [
"/**\n * houston/test/utility/app.ts\n * Utility for setting up a new app for testing.\n */",
"import",
"{",
"App",
"}",
"from",
"'../../src/app'",
";",
"import",
"{",
"setup",
"as",
"setupConfig",
"}",
"from",
"'./config'",
";",
"return",
"{",
"App",
"}",
"export",
"async",
"function",
"create",
"(",
")",
"{",
"const",
"config",
"=",
"await",
"setupConfig",
"(",
")",
";",
"return",
"new",
"App",
"(",
"config",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
102 | [
"/**\n * houston/test/utility/worker/repository.ts\n * A third party repository that implements all of our needed interfaces.\n * Used for testing without any side effects.\n */",
"import",
"*",
"as",
"type",
"from",
"'../../../src/lib/service/type'",
";",
"import",
"{",
"sanitize",
"}",
"from",
"'../../../src/lib/utility/rdnn'",
";",
"export",
"class",
"Repository",
"implements",
"type",
".",
"ICodeRepository",
",",
"type",
".",
"IPackageRepository",
",",
"type",
".",
"ILogRepository",
"{",
"public",
"url",
":",
"string",
";",
"public",
"serviceName",
"=",
"'mock Repository'",
";",
"constructor",
"(",
"url",
")",
"{",
"this",
".",
"url",
"=",
"url",
";",
"}",
"public",
"get",
"rdnn",
"(",
")",
"{",
"const",
"[",
"host",
",",
"...",
"paths",
"]",
"=",
"this",
".",
"url",
".",
"split",
"(",
"'://'",
")",
"[",
"1",
"]",
".",
"split",
"(",
"'/'",
")",
";",
"const",
"h",
"=",
"host",
".",
"split",
"(",
"'.'",
")",
".",
"reverse",
"(",
")",
".",
"join",
"(",
"'.'",
")",
";",
"const",
"p",
"=",
"paths",
".",
"join",
"(",
"'.'",
")",
";",
"return",
"sanitize",
"(",
"`${",
"h",
"}${",
"p",
"}`",
")",
";",
"}",
"public",
"async",
"clone",
"(",
"p",
",",
"reference",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Unimplimented in mock repository'",
")",
";",
"}",
"public",
"async",
"references",
"(",
")",
"{",
"return",
"[",
"'refs/origin/master'",
"]",
";",
"}",
"public",
"async",
"uploadPackage",
"(",
"pkg",
",",
"stage",
",",
"reference",
"?",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Unimplimented in mock repository'",
")",
";",
"}",
"public",
"async",
"uploadLog",
"(",
"log",
",",
"stage",
",",
"reference",
"?",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Unimplimented in mock repository'",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
0,
null,
0,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
0,
null,
0,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
103 | [
"/**\n * houston/test/utililty/worker/worker.ts\n * Helpful functions to test the worker process\n */",
"import",
"*",
"as",
"fs",
"from",
"'fs-extra'",
";",
"import",
"*",
"as",
"os",
"from",
"'os'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"*",
"as",
"uuid",
"from",
"'uuid'",
";",
"import",
"{",
"Worker",
"}",
"from",
"'../../../src/worker/worker'",
";",
"export",
"class",
"TestWorker",
"extends",
"Worker",
"{",
"param",
"{",
"Config",
"}",
"config",
"param",
"{",
"Repository",
"}",
"repository",
"param",
"{",
"IContext",
"}",
"context",
"constructor",
"(",
"config",
",",
"repository",
",",
"storage",
")",
"{",
"super",
"(",
"config",
",",
"repository",
",",
"storage",
")",
";",
"this",
".",
"workspace",
"=",
"path",
".",
"resolve",
"(",
"os",
".",
"tmpdir",
"(",
")",
",",
"'houston-test/worker'",
",",
"uuid",
"(",
")",
")",
";",
"}",
"param",
"{",
"string",
"}",
"p",
"return",
"{",
"string",
"}",
"public",
"get",
"(",
"p",
")",
"{",
"return",
"path",
".",
"resolve",
"(",
"this",
".",
"workspace",
",",
"p",
")",
";",
"}",
"async",
"param",
"{",
"String",
"}",
"from",
"param",
"{",
"String",
"}",
"to",
"return",
"{",
"void",
"}",
"public",
"async",
"mock",
"(",
"from",
",",
"to",
")",
"{",
"const",
"fullFrom",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'../../fixture/worker'",
",",
"from",
")",
";",
"return",
"fs",
".",
"copy",
"(",
"fullFrom",
",",
"this",
".",
"get",
"(",
"to",
")",
",",
"{",
"overwrite",
":",
"true",
"}",
")",
";",
"}",
"async",
"param",
"{",
"string",
"}",
"p",
"return",
"{",
"string",
"}",
"public",
"async",
"readFile",
"(",
"p",
")",
"{",
"return",
"fs",
".",
"readFile",
"(",
"this",
".",
"get",
"(",
"p",
")",
",",
"'utf8'",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
104 | [
"/**\n * houston/test/utililty/worker.ts\n * Helpful functions to test the worker process\n */",
"import",
"{",
"create",
"}",
"from",
"'../app'",
";",
"import",
"{",
"context",
"}",
"from",
"'./context'",
";",
"import",
"{",
"Repository",
"}",
"from",
"'./repository'",
";",
"import",
"{",
"TestWorker",
"}",
"from",
"'./worker'",
";",
"export",
"async",
"function",
"mock",
"(",
"values",
"=",
"{",
"}",
")",
"{",
"const",
"app",
"=",
"await",
"create",
"(",
")",
";",
"const",
"store",
"=",
"context",
"(",
"values",
")",
";",
"const",
"repo",
"=",
"new",
"Repository",
"(",
"'testrepo'",
")",
";",
"return",
"new",
"TestWorker",
"(",
"app",
",",
"repo",
",",
"store",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
6,
null,
null,
null,
null,
null,
null,
189,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
112,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
105 | [
"/**\n * houston/src/worker/task/upload/log.spec.ts\n * Tests uploading logs to third party services\n */",
"import",
"*",
"as",
"sinon",
"from",
"'sinon'",
";",
"import",
"{",
"packageRepository",
"}",
"from",
"'../../../lib/service'",
";",
"import",
"{",
"UploadLog",
"}",
"from",
"'./log'",
";",
"import",
"{",
"fixture",
"}",
"from",
"'../../../../test/utility/fs'",
";",
"import",
"{",
"mock",
"}",
"from",
"'../../../../test/utility/worker'",
";",
"test",
"(",
"'uploads logs to codeRepository if also logRepository'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"distribution",
":",
"'loki'",
",",
"logs",
":",
"[",
"{",
"title",
":",
"'test'",
",",
"body",
":",
"'testy test test'",
"}",
"]",
",",
"nameDomain",
":",
"'com.github.elementary.houston'",
",",
"package",
":",
"{",
"type",
":",
"'deb'",
"}",
",",
"references",
":",
"[",
"'refs/heads/loki'",
"]",
"}",
")",
";",
"worker",
".",
"repository",
".",
"uploadLog",
"=",
"sinon",
".",
"fake",
".",
"resolves",
"(",
")",
";",
"const",
"setup",
"=",
"new",
"UploadLog",
"(",
"worker",
")",
";",
"await",
"setup",
".",
"run",
"(",
")",
";",
"expect",
"(",
"worker",
".",
"repository",
".",
"uploadLog",
".",
"callCount",
")",
".",
"not",
".",
"toBe",
"(",
"0",
")",
";",
"}",
",",
"300000",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
106 | [
"/**\n * houston/src/worker/task/upload/package.spec.ts\n * Tests uploading package assets\n */",
"import",
"*",
"as",
"sinon",
"from",
"'sinon'",
";",
"import",
"{",
"packageRepository",
"}",
"from",
"'../../../lib/service'",
";",
"import",
"{",
"UploadPackage",
"}",
"from",
"'./package'",
";",
"import",
"{",
"fixture",
"}",
"from",
"'../../../../test/utility/fs'",
";",
"import",
"{",
"mock",
"}",
"from",
"'../../../../test/utility/worker'",
";",
"test",
"(",
"'uploads package to codeRepository if also packageRepository'",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"distribution",
":",
"'loki'",
",",
"nameDomain",
":",
"'com.github.elementary.houston'",
",",
"package",
":",
"{",
"path",
":",
"fixture",
"(",
"'worker/docker/image1/Dockerfile'",
")",
",",
"type",
":",
"'deb'",
"}",
",",
"references",
":",
"[",
"'refs/heads/loki'",
"]",
"}",
")",
";",
"const",
"setup",
"=",
"new",
"UploadPackage",
"(",
"worker",
")",
";",
"worker",
".",
"repository",
".",
"uploadPackage",
"=",
"sinon",
".",
"fake",
".",
"resolves",
"(",
")",
";",
"setup",
".",
"uploadToPackageRepositories",
"=",
"sinon",
".",
"fake",
".",
"resolves",
"(",
")",
";",
"await",
"setup",
".",
"run",
"(",
")",
";",
"expect",
"(",
"worker",
".",
"repository",
".",
"uploadPackage",
".",
"callCount",
")",
".",
"not",
".",
"toBe",
"(",
"0",
")",
";",
"}",
",",
"300000",
")",
";",
"test",
"(",
"'concats error logs to something easy to read'",
",",
"async",
"(",
")",
"=>",
"{",
"expect",
".",
"assertions",
"(",
"1",
")",
";",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"distribution",
":",
"'loki'",
",",
"nameDomain",
":",
"'com.github.elementary.houston'",
",",
"package",
":",
"{",
"path",
":",
"fixture",
"(",
"'worker/docker/image1/Dockerfile'",
")",
",",
"type",
":",
"'deb'",
"}",
",",
"references",
":",
"[",
"'refs/heads/loki'",
"]",
"}",
")",
";",
"worker",
".",
"app",
".",
"unbind",
"(",
"packageRepository",
")",
";",
"const",
"setup",
"=",
"new",
"UploadPackage",
"(",
"worker",
")",
";",
"try",
"{",
"await",
"setup",
".",
"run",
"(",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"expect",
"(",
"err",
".",
"body",
")",
".",
"toMatch",
"(",
"/mock Repository/",
")",
";",
"}",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
107 | [
"/**\n * houston/test/e2e/lib/log/outputs/console.ts\n * Tests console out logging. End to End testing due to mocks of the console\n */",
"import",
"baseTest",
",",
"{",
"Macro",
",",
"TestInterface",
"}",
"from",
"'ava'",
";",
"import",
"{",
"stub",
"}",
"from",
"'sinon'",
";",
"import",
"{",
"create",
"}",
"from",
"'../../../../utility/app'",
";",
"import",
"{",
"App",
"}",
"from",
"'../../../../../src/app'",
";",
"import",
"{",
"Config",
"}",
"from",
"'../../../../../src/lib/config'",
";",
"import",
"{",
"Level",
"}",
"from",
"'../../../../../src/lib/log/level'",
";",
"import",
"{",
"Log",
"}",
"from",
"'../../../../../src/lib/log/log'",
";",
"import",
"{",
"Logger",
"}",
"from",
"'../../../../../src/lib/log/logger'",
";",
"import",
"{",
"Console",
"}",
"from",
"'../../../../../src/lib/log/outputs/console'",
";",
"interface",
"IContext",
"{",
"app",
":",
"App",
";",
"config",
":",
"Config",
";",
"logger",
":",
"Logger",
";",
"output",
":",
"Console",
";",
"info",
":",
"stub",
";",
"warn",
":",
"stub",
";",
"error",
":",
"stub",
";",
"}",
"const",
"test",
"=",
"baseTest",
"as",
"TestInterface",
"<",
"IContext",
">",
";",
"const",
"testOutput",
"=",
"(",
"t",
",",
"input",
",",
"fn",
",",
"expected",
")",
"=>",
"{",
"const",
"log",
"=",
"new",
"Log",
"(",
"t",
".",
"context",
".",
"logger",
")",
".",
"setLevel",
"(",
"input",
")",
";",
"t",
".",
"context",
".",
"output",
"[",
"fn",
"]",
"(",
"log",
")",
";",
"t",
".",
"true",
"(",
"t",
".",
"context",
"[",
"expected",
"]",
".",
"called",
")",
";",
"}",
";",
"testOutput",
".",
"title",
"=",
"(",
"_",
",",
"input",
",",
"fn",
",",
"expected",
")",
"=>",
"{",
"return",
"`${",
"fn",
"} gets outputted to console ${",
"expected",
"}`",
";",
"}",
";",
"test",
".",
"beforeEach",
"(",
"'setup application'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"context",
".",
"app",
"=",
"await",
"create",
"(",
")",
";",
"t",
".",
"context",
".",
"config",
"=",
"t",
".",
"context",
".",
"app",
".",
"get",
"<",
"Config",
">",
"(",
"Config",
")",
";",
"t",
".",
"context",
".",
"config",
".",
"unfreeze",
"(",
")",
";",
"t",
".",
"context",
".",
"config",
".",
"set",
"(",
"'log.console'",
",",
"'debug'",
")",
";",
"t",
".",
"context",
".",
"config",
".",
"freeze",
"(",
")",
";",
"t",
".",
"context",
".",
"logger",
"=",
"new",
"Logger",
"(",
"t",
".",
"context",
".",
"config",
")",
";",
"t",
".",
"context",
".",
"output",
"=",
"new",
"Console",
"(",
"t",
".",
"context",
".",
"config",
")",
";",
"}",
")",
";",
"test",
".",
"beforeEach",
"(",
"'setup console stubs'",
",",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"context",
".",
"info",
"=",
"stub",
"(",
"console",
",",
"'info'",
")",
";",
"t",
".",
"context",
".",
"warn",
"=",
"stub",
"(",
"console",
",",
"'warn'",
")",
";",
"t",
".",
"context",
".",
"error",
"=",
"stub",
"(",
"console",
",",
"'error'",
")",
";",
"}",
")",
";",
"test",
".",
"afterEach",
".",
"always",
"(",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"context",
".",
"info",
".",
"restore",
"(",
")",
";",
"t",
".",
"context",
".",
"warn",
".",
"restore",
"(",
")",
";",
"t",
".",
"context",
".",
"error",
".",
"restore",
"(",
")",
";",
"}",
")",
";",
"test",
".",
"serial",
"(",
"testOutput",
",",
"Level",
".",
"DEBUG",
",",
"'debug'",
",",
"'info'",
")",
";",
"test",
".",
"serial",
"(",
"testOutput",
",",
"Level",
".",
"INFO",
",",
"'info'",
",",
"'info'",
")",
";",
"test",
".",
"serial",
"(",
"testOutput",
",",
"Level",
".",
"WARN",
",",
"'warn'",
",",
"'warn'",
")",
";",
"test",
".",
"serial",
"(",
"testOutput",
",",
"Level",
".",
"ERROR",
",",
"'error'",
",",
"'error'",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6309,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3230,
null,
null,
48,
null,
1228,
null,
2,
null,
2,
null,
null,
null,
null,
735,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
1228,
null,
2,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
108 | [
"/**\n * houston/test/utility/http.ts\n * Utilities for when you are testing http related things\n */",
"import",
"*",
"as",
"nock",
"from",
"'nock'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"nock",
".",
"back",
".",
"fixtures",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'../fixture'",
")",
";",
"export",
"interface",
"INockOptions",
"{",
"ignoreBody",
"?",
":",
"boolean",
";",
"}",
"param",
"{",
"String",
"}",
"p",
"param",
"{",
"INockOptions",
"}",
"opts",
"return",
"{",
"Object",
"}",
"return",
"{",
"Function",
"}",
"export",
"async",
"function",
"record",
"(",
"p",
",",
"opts",
"?",
")",
"{",
"const",
"options",
"=",
"{",
"}",
";",
"if",
"(",
"opts",
"!=",
"null",
"&&",
"opts",
".",
"ignoreBody",
"===",
"true",
")",
"{",
"options",
".",
"before",
"=",
"(",
"scope",
")",
"=>",
"{",
"scope",
".",
"filteringRequestBody",
"=",
"(",
")",
"=>",
"'*'",
";",
"}",
";",
"}",
"const",
"{",
"nockDone",
"}",
"=",
"await",
"nock",
".",
"back",
"(",
"p",
",",
"options",
")",
";",
"return",
"{",
"done",
":",
"nockDone",
"}",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
2,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
109 | [
"/**\n * houston/test/e2e/lib/service/aptly.ts\n * Tests the Aptly package repository class.\n */",
"import",
"baseTest",
",",
"{",
"TestInterface",
"}",
"from",
"'ava'",
";",
"import",
"*",
"as",
"fs",
"from",
"'fs-extra'",
";",
"import",
"*",
"as",
"os",
"from",
"'os'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"*",
"as",
"uuid",
"from",
"'uuid/v4'",
";",
"import",
"{",
"App",
"}",
"from",
"'../../../../src/lib/app'",
";",
"import",
"{",
"Config",
"}",
"from",
"'../../../../src/lib/config'",
";",
"import",
"*",
"as",
"Log",
"from",
"'../../../../src/lib/log'",
";",
"import",
"{",
"Aptly",
"}",
"from",
"'../../../../src/lib/service/aptly'",
";",
"import",
"*",
"as",
"type",
"from",
"'../../../../src/lib/service/type'",
";",
"import",
"{",
"tmp",
"}",
"from",
"'../../../utility/fs'",
";",
"import",
"{",
"record",
"}",
"from",
"'../../../utility/http'",
";",
"const",
"test",
"=",
"baseTest",
"as",
"TestInterface",
"<",
"{",
"app",
":",
"App",
";",
"}",
">",
";",
"const",
"DEFAULT_PKG",
"=",
"{",
"architecture",
":",
"'amd64'",
",",
"distribution",
":",
"'xenial'",
",",
"name",
":",
"'package'",
",",
"path",
":",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'../../../test/fixture/lib/service/github/vocal.deb'",
")",
",",
"type",
":",
"'deb'",
"}",
";",
"test",
".",
"failing",
"(",
"'can upload a package to aptly'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"{",
"done",
"}",
"=",
"await",
"record",
"(",
"'lib/service/aptly/asset.json'",
",",
"{",
"ignoreBody",
":",
"true",
"}",
")",
";",
"const",
"config",
"=",
"t",
".",
"context",
".",
"app",
".",
"get",
"(",
"Config",
")",
";",
"config",
".",
"unfreeze",
"(",
")",
";",
"config",
".",
"set",
"(",
"'service.aptly.review'",
",",
"'testing'",
")",
";",
"config",
".",
"freeze",
"(",
")",
";",
"const",
"aptly",
"=",
"t",
".",
"context",
".",
"app",
".",
"get",
"(",
"Aptly",
")",
";",
"const",
"details",
"=",
"await",
"aptly",
".",
"uploadPackage",
"(",
"DEFAULT_PKG",
",",
"'review'",
")",
";",
"t",
".",
"is",
"(",
"details",
".",
"aptlyId",
",",
"'Pamd64 com.github.needle-and-thread.vocal 2.1.6 9a6a0ef178f67a1e'",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6309,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
10980,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
110 | [
"/**\n * houston/test/e2e/lib/service/github.ts\n * Tests the GitHub repository class.\n */",
"import",
"baseTest",
",",
"{",
"TestInterface",
"}",
"from",
"'ava'",
";",
"import",
"*",
"as",
"fs",
"from",
"'fs-extra'",
";",
"import",
"*",
"as",
"os",
"from",
"'os'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"*",
"as",
"uuid",
"from",
"'uuid/v4'",
";",
"import",
"*",
"as",
"Log",
"from",
"'../../../../src/lib/log'",
";",
"import",
"{",
"github",
",",
"IGitHubFactory",
"}",
"from",
"'../../../../src/lib/service/github'",
";",
"import",
"*",
"as",
"type",
"from",
"'../../../../src/lib/service/type'",
";",
"import",
"{",
"create",
"as",
"createApp",
"}",
"from",
"'../../../utility/app'",
";",
"import",
"{",
"tmp",
"}",
"from",
"'../../../utility/fs'",
";",
"import",
"{",
"record",
"}",
"from",
"'../../../utility/http'",
";",
"const",
"test",
"=",
"baseTest",
"as",
"TestInterface",
"<",
"{",
"folder",
":",
"string",
";",
"factory",
":",
"IGitHubFactory",
";",
"}",
">",
";",
"test",
".",
"beforeEach",
"(",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"app",
"=",
"await",
"createApp",
"(",
")",
";",
"t",
".",
"context",
".",
"folder",
"=",
"await",
"tmp",
"(",
"`lib/service/github/${",
"uuid",
"(",
")",
"}`",
")",
";",
"t",
".",
"context",
".",
"factory",
"=",
"(",
"url",
")",
"=>",
"{",
"const",
"instance",
"=",
"app",
".",
"get",
"<",
"IGitHubFactory",
">",
"(",
"github",
")",
"(",
"url",
")",
";",
"instance",
".",
"tmpFolder",
"=",
"t",
".",
"context",
".",
"folder",
";",
"return",
"instance",
";",
"}",
";",
"}",
")",
";",
"test",
".",
"afterEach",
".",
"always",
"(",
"async",
"(",
"t",
")",
"=>",
"{",
"await",
"fs",
".",
"remove",
"(",
"t",
".",
"context",
".",
"folder",
")",
";",
"}",
")",
";",
"test",
".",
"serial",
"(",
"'can clone a repository'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"repo",
"=",
"t",
".",
"context",
".",
"factory",
"(",
"'https://github.com/elementary/houston'",
")",
";",
"const",
"folder",
"=",
"path",
".",
"resolve",
"(",
"t",
".",
"context",
".",
"folder",
",",
"uuid",
"(",
")",
")",
";",
"await",
"fs",
".",
"mkdirs",
"(",
"folder",
")",
";",
"await",
"repo",
".",
"clone",
"(",
"folder",
",",
"'refs/remotes/origin/master'",
")",
";",
"const",
"stat",
"=",
"await",
"fs",
".",
"stat",
"(",
"folder",
")",
";",
"t",
".",
"true",
"(",
"stat",
".",
"isDirectory",
"(",
")",
")",
";",
"}",
")",
";",
"test",
".",
"serial",
"(",
"'can clone a repository with tag'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"repo",
"=",
"t",
".",
"context",
".",
"factory",
"(",
"'https://github.com/elementary/houston'",
")",
";",
"const",
"folder",
"=",
"path",
".",
"resolve",
"(",
"t",
".",
"context",
".",
"folder",
",",
"uuid",
"(",
")",
")",
";",
"await",
"fs",
".",
"mkdirs",
"(",
"folder",
")",
";",
"await",
"repo",
".",
"clone",
"(",
"folder",
",",
"'refs/tags/0.2.0'",
")",
";",
"const",
"stat",
"=",
"await",
"fs",
".",
"stat",
"(",
"folder",
")",
";",
"t",
".",
"true",
"(",
"stat",
".",
"isDirectory",
"(",
")",
")",
";",
"const",
"pkg",
"=",
"require",
"(",
"path",
".",
"resolve",
"(",
"folder",
",",
"'package.json'",
")",
")",
";",
"t",
".",
"is",
"(",
"pkg",
".",
"version",
",",
"'0.1.8'",
")",
";",
"}",
")",
";",
"test",
".",
"serial",
"(",
"'can clone a repository with a non-annotated tag (#511)'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"repo",
"=",
"t",
".",
"context",
".",
"factory",
"(",
"'https://github.com/fluks-eos/gdice'",
")",
";",
"const",
"folder",
"=",
"path",
".",
"resolve",
"(",
"t",
".",
"context",
".",
"folder",
",",
"uuid",
"(",
")",
")",
";",
"await",
"fs",
".",
"mkdirs",
"(",
"folder",
")",
";",
"await",
"repo",
".",
"clone",
"(",
"folder",
",",
"'refs/tags/v1.0.1'",
")",
";",
"const",
"stat",
"=",
"await",
"fs",
".",
"stat",
"(",
"folder",
")",
";",
"t",
".",
"true",
"(",
"stat",
".",
"isDirectory",
"(",
")",
")",
";",
"}",
")",
";",
"test",
".",
"serial",
"(",
"'can list all references for a repository'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"repo",
"=",
"t",
".",
"context",
".",
"factory",
"(",
"'https://github.com/elementary/houston'",
")",
";",
"const",
"references",
"=",
"await",
"repo",
".",
"references",
"(",
")",
";",
"t",
".",
"not",
"(",
"references",
".",
"indexOf",
"(",
"'refs/remotes/origin/master'",
")",
",",
"-",
"1",
")",
";",
"t",
".",
"not",
"(",
"references",
".",
"indexOf",
"(",
"'refs/remotes/origin/v2'",
")",
",",
"-",
"1",
")",
";",
"}",
")",
";",
"test",
".",
"serial",
".",
"failing",
"(",
"'can post assets to reference'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"{",
"done",
"}",
"=",
"await",
"record",
"(",
"'lib/service/github/asset.json'",
")",
";",
"const",
"repo",
"=",
"t",
".",
"context",
".",
"factory",
"(",
"'https://github.com/btkostner/vocal'",
")",
";",
"const",
"pkg",
"=",
"{",
"architecture",
":",
"'amd64'",
",",
"description",
":",
"'Vocal 3.2.6 Loki (amd64)'",
",",
"distribution",
":",
"'xenial'",
",",
"name",
":",
"'package.deb'",
",",
"path",
":",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'../../../fixture/lib/service/github/vocal.deb'",
")",
",",
"type",
":",
"'deb'",
"}",
"as",
"type",
".",
"IPackage",
";",
"const",
"newPkg",
"=",
"await",
"repo",
".",
"uploadPackage",
"(",
"pkg",
",",
"'review'",
",",
"'3.2.6'",
")",
";",
"t",
".",
"is",
"(",
"newPkg",
".",
"githubId",
",",
"6174740",
")",
";",
"await",
"done",
"(",
")",
";",
"}",
")",
";",
"test",
".",
"serial",
"(",
"'can post an log'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"{",
"done",
"}",
"=",
"await",
"record",
"(",
"'lib/service/github/log.json'",
")",
";",
"const",
"repo",
"=",
"t",
".",
"context",
".",
"factory",
"(",
"'https://github.com/btkostner/vocal'",
")",
";",
"const",
"log",
"=",
"{",
"body",
":",
"'testy test test'",
",",
"level",
":",
"Log",
".",
"Level",
".",
"ERROR",
",",
"title",
":",
"'test'",
"}",
"as",
"type",
".",
"ILog",
";",
"const",
"newLog",
"=",
"await",
"repo",
".",
"uploadLog",
"(",
"log",
",",
"'review'",
",",
"'3.2.6'",
")",
";",
"t",
".",
"is",
"(",
"newLog",
".",
"githubId",
",",
"326839748",
")",
";",
"await",
"done",
"(",
")",
";",
"}",
")",
";",
"test",
".",
"serial",
"(",
"'generates authentication with installation number'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"{",
"done",
"}",
"=",
"await",
"record",
"(",
"'lib/service/github/installation.json'",
")",
";",
"const",
"repo",
"=",
"t",
".",
"context",
".",
"factory",
"(",
"'https://installation:[email protected]/btkostner/vocal'",
")",
";",
"const",
"auth",
"=",
"await",
"repo",
".",
"getAuthorization",
"(",
")",
";",
"t",
".",
"is",
"(",
"auth",
",",
"'token v1.2474f2e312406721d0f20ef317948573101e6144'",
")",
";",
"await",
"done",
"(",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6309,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
189,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
4219,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
4219,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
4219,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
4219,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
4219,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4219,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
10980,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
10980,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4219,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5992,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4219,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
111 | [
"exports",
"import",
"*",
"as",
"Dockerode",
"from",
"'dockerode'",
";",
"import",
"{",
"Config",
"}",
"from",
"'../../src/lib/config'",
";",
"async",
"param",
"{",
"Config",
"}",
"config",
"param",
"{",
"string",
"}",
"image",
"return",
"{",
"void",
"}",
"export",
"async",
"function",
"removeImages",
"(",
"config",
",",
"image",
")",
"{",
"const",
"docker",
"=",
"new",
"Dockerode",
"(",
"config",
".",
"get",
"(",
"'docker'",
")",
")",
";",
"const",
"images",
"=",
"await",
"docker",
".",
"listImages",
"(",
")",
".",
"then",
"(",
"(",
"imageInfos",
")",
"=>",
"{",
"return",
"imageInfos",
".",
"filter",
"(",
"(",
"imageInfo",
")",
"=>",
"{",
"return",
"(",
"imageInfo",
".",
"RepoTags",
"||",
"[",
"]",
")",
".",
"some",
"(",
"(",
"tag",
")",
"=>",
"tag",
".",
"startsWith",
"(",
"image",
")",
")",
";",
"}",
")",
";",
"}",
")",
".",
"then",
"(",
"(",
"imageInfos",
")",
"=>",
"{",
"return",
"imageInfos",
".",
"map",
"(",
"(",
"imageInfo",
")",
"=>",
"docker",
".",
"getImage",
"(",
"imageInfo",
".",
"Id",
")",
")",
";",
"}",
")",
";",
"await",
"Promise",
".",
"all",
"(",
"images",
".",
"map",
"(",
"(",
"i",
")",
"=>",
"{",
"i",
".",
"remove",
"(",
"{",
"force",
":",
"true",
"}",
")",
".",
"catch",
"(",
"(",
"err",
")",
"=>",
"{",
"if",
"(",
"err",
".",
"statusCode",
"!==",
"404",
"&&",
"err",
".",
"statusCode",
"!==",
"409",
")",
"{",
"console",
".",
"error",
"(",
"'Unable to remove docker image'",
",",
"err",
")",
";",
"}",
"}",
")",
";",
"}",
")",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
87,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
112 | [
"/**\n * houston/test/e2e/worker/docker.ts\n * Tests docker usage ability\n */",
"import",
"baseTest",
",",
"{",
"TestInterface",
"}",
"from",
"'ava'",
";",
"import",
"*",
"as",
"fs",
"from",
"'fs-extra'",
";",
"import",
"*",
"as",
"os",
"from",
"'os'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"*",
"as",
"uuid",
"from",
"'uuid/v4'",
";",
"import",
"{",
"Config",
"}",
"from",
"'../../../src/lib/config'",
";",
"import",
"{",
"Docker",
"}",
"from",
"'../../../src/worker/docker'",
";",
"import",
"{",
"setup",
"as",
"setupConfig",
"}",
"from",
"'../../utility/config'",
";",
"import",
"*",
"as",
"dockerUtility",
"from",
"'../../utility/docker'",
";",
"interface",
"IContext",
"{",
"config",
":",
"Config",
";",
"images",
":",
"string",
"[",
"]",
";",
"}",
"const",
"test",
"=",
"baseTest",
"as",
"TestInterface",
"<",
"IContext",
">",
";",
"test",
".",
"beforeEach",
"(",
"async",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"context",
".",
"config",
"=",
"await",
"setupConfig",
"(",
")",
";",
"t",
".",
"context",
".",
"images",
"=",
"[",
"]",
";",
"}",
")",
";",
"test",
".",
"afterEach",
"(",
"async",
"(",
"t",
")",
"=>",
"{",
"await",
"Promise",
".",
"all",
"(",
"t",
".",
"context",
".",
"images",
".",
"map",
"(",
"(",
"image",
")",
"=>",
"{",
"return",
"dockerUtility",
".",
"removeImages",
"(",
"t",
".",
"context",
".",
"config",
",",
"image",
")",
";",
"}",
")",
")",
";",
"}",
")",
";",
"test",
"(",
"'can check if image exists'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"context",
".",
"images",
"=",
"[",
"`houston-${",
"uuid",
"(",
")",
"}`",
"]",
";",
"const",
"docker",
"=",
"new",
"Docker",
"(",
"t",
".",
"context",
".",
"config",
",",
"t",
".",
"context",
".",
"images",
"[",
"0",
"]",
")",
";",
"t",
".",
"false",
"(",
"await",
"docker",
".",
"exists",
"(",
")",
")",
";",
"}",
")",
";",
"test",
"(",
"'can create a docker image'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"context",
".",
"images",
"=",
"[",
"`houston-${",
"uuid",
"(",
")",
"}`",
"]",
";",
"const",
"docker",
"=",
"new",
"Docker",
"(",
"t",
".",
"context",
".",
"config",
",",
"t",
".",
"context",
".",
"images",
"[",
"0",
"]",
")",
";",
"const",
"imageDirectory",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'../../fixture/worker/docker/image1'",
")",
";",
"await",
"docker",
".",
"create",
"(",
"imageDirectory",
")",
";",
"t",
".",
"true",
"(",
"await",
"docker",
".",
"exists",
"(",
")",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6309,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
18787,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
18787,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
113 | [
"/**\n * houston/test/e2e/worker/worker.ts\n * Runs some repositories through tests for end to end testing\n */",
"import",
"baseTest",
",",
"{",
"TestInterface",
"}",
"from",
"'ava'",
";",
"import",
"*",
"as",
"fs",
"from",
"'fs-extra'",
";",
"import",
"*",
"as",
"os",
"from",
"'os'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"*",
"as",
"uuid",
"from",
"'uuid/v4'",
";",
"import",
"{",
"App",
"}",
"from",
"'../../../src/lib/app'",
";",
"import",
"{",
"Config",
"}",
"from",
"'../../../src/lib/config'",
";",
"import",
"{",
"codeRepositoryFactory",
",",
"ICodeRepositoryFactory",
"}",
"from",
"'../../../src/lib/service'",
";",
"import",
"{",
"Build",
"}",
"from",
"'../../../src/worker/preset/build'",
";",
"import",
"*",
"as",
"type",
"from",
"'../../../src/worker/type'",
";",
"import",
"{",
"create",
"}",
"from",
"'../../utility/app'",
";",
"import",
"{",
"tmp",
"}",
"from",
"'../../utility/fs'",
";",
"interface",
"IContext",
"{",
"app",
":",
"App",
";",
"config",
":",
"Config",
";",
"directory",
":",
"string",
";",
"factory",
":",
"ICodeRepositoryFactory",
";",
"}",
"const",
"test",
"=",
"baseTest",
"as",
"TestInterface",
"<",
"IContext",
">",
";",
"test",
".",
"beforeEach",
"(",
"async",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"context",
".",
"app",
"=",
"await",
"create",
"(",
")",
";",
"t",
".",
"context",
".",
"config",
"=",
"t",
".",
"context",
".",
"app",
".",
"get",
"<",
"Config",
">",
"(",
"Config",
")",
";",
"t",
".",
"context",
".",
"directory",
"=",
"await",
"tmp",
"(",
"'worker'",
")",
";",
"t",
".",
"context",
".",
"factory",
"=",
"t",
".",
"context",
".",
"app",
".",
"get",
"<",
"ICodeRepositoryFactory",
">",
"(",
"codeRepositoryFactory",
")",
";",
"}",
")",
";",
"test",
"(",
"'cassidyjames/palette passes build process'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"repo",
"=",
"await",
"t",
".",
"context",
".",
"factory",
"(",
"'https://github.com/cassidyjames/palette'",
")",
";",
"const",
"context",
"=",
"{",
"appcenter",
":",
"{",
"}",
",",
"appstream",
":",
"''",
",",
"architecture",
":",
"''",
",",
"changelog",
":",
"[",
"]",
",",
"distribution",
":",
"''",
",",
"logs",
":",
"[",
"]",
",",
"nameDeveloper",
":",
"'Palette'",
",",
"nameDomain",
":",
"'com.github.cassidyjames.palette'",
",",
"nameHuman",
":",
"'Palette'",
",",
"references",
":",
"[",
"'refs/tags/2.2.0'",
"]",
",",
"type",
":",
"'app'",
",",
"version",
":",
"'2.2.0'",
"}",
";",
"const",
"proc",
"=",
"Build",
"(",
"t",
".",
"context",
".",
"app",
",",
"repo",
",",
"context",
")",
";",
"proc",
".",
"workspace",
"=",
"path",
".",
"resolve",
"(",
"t",
".",
"context",
".",
"directory",
",",
"uuid",
"(",
")",
")",
";",
"proc",
".",
"on",
"(",
"'run:error'",
",",
"(",
"e",
")",
"=>",
"t",
".",
"log",
"(",
"e",
")",
")",
";",
"await",
"proc",
".",
"setup",
"(",
")",
";",
"await",
"proc",
".",
"run",
"(",
")",
";",
"await",
"proc",
".",
"teardown",
"(",
")",
";",
"t",
".",
"true",
"(",
"proc",
".",
"passes",
")",
";",
"t",
".",
"is",
"(",
"proc",
".",
"result",
".",
"packages",
".",
"length",
",",
"1",
")",
";",
"t",
".",
"is",
"(",
"proc",
".",
"result",
".",
"packages",
"[",
"0",
"]",
".",
"name",
",",
"'com.github.cassidyjames.palette_2.2.0_amd64.deb'",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6309,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
592,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
114 | [
"/**\n * houston/test/e2e/worker/task/debian/changelog.ts\n * Tests that the changelog task works as needed\n */",
"import",
"test",
"from",
"'ava'",
";",
"import",
"{",
"DebianChangelog",
"}",
"from",
"'../../../../../src/worker/task/debian/changelog'",
";",
"import",
"{",
"mock",
"}",
"from",
"'../../../../utility/worker'",
";",
"test",
"(",
"'changelog renders correctly'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"changelog",
":",
"[",
"{",
"author",
":",
"'Blake Kostner'",
",",
"changes",
":",
"'updated some fun things'",
",",
"date",
":",
"new",
"Date",
"(",
")",
",",
"version",
":",
"'0.0.1'",
"}",
",",
"{",
"author",
":",
"'Blake Kostner'",
",",
"changes",
":",
"'resion release'",
",",
"date",
":",
"new",
"Date",
"(",
")",
",",
"version",
":",
"'1.0.0'",
"}",
"]",
",",
"nameDomain",
":",
"'com.github.elementary.houston'",
"}",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"DebianChangelog",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"const",
"changelog",
"=",
"await",
"worker",
".",
"readFile",
"(",
"'dirty/debian/changelog'",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"t",
".",
"not",
"(",
"changelog",
".",
"indexOf",
"(",
"'resion release'",
")",
",",
"-",
"1",
")",
";",
"t",
".",
"not",
"(",
"changelog",
".",
"indexOf",
"(",
"'updated some fun things'",
")",
",",
"-",
"1",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
115 | [
"/**\n * houston/test/spec/lib/config/index.ts\n * Tests the configuration class\n */",
"import",
"test",
"from",
"'ava'",
";",
"import",
"{",
"Config",
"}",
"from",
"'../../../../src/lib/config/index'",
";",
"test",
"(",
"'can be created with an object'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"new",
"Config",
"(",
"{",
"key",
":",
"'value'",
"}",
")",
";",
"t",
".",
"is",
"(",
"config",
".",
"get",
"(",
"'key'",
")",
",",
"'value'",
")",
";",
"}",
")",
";",
"test",
"(",
"'can get a value'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"new",
"Config",
"(",
"{",
"key",
":",
"'value'",
"}",
")",
";",
"t",
".",
"is",
"(",
"config",
".",
"get",
"(",
"'key'",
")",
",",
"'value'",
")",
";",
"t",
".",
"is",
"(",
"config",
".",
"get",
"(",
"'noop'",
")",
",",
"undefined",
")",
";",
"}",
")",
";",
"test",
"(",
"'get uses a default value'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"new",
"Config",
"(",
"{",
"key",
":",
"'value'",
"}",
")",
";",
"t",
".",
"is",
"(",
"config",
".",
"get",
"(",
"'noop'",
",",
"'value'",
")",
",",
"'value'",
")",
";",
"t",
".",
"is",
"(",
"config",
".",
"get",
"(",
"'key'",
",",
"'invalid'",
")",
",",
"'value'",
")",
";",
"}",
")",
";",
"test",
"(",
"'has returns boolean for existing value'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"new",
"Config",
"(",
"{",
"key",
":",
"'value'",
"}",
")",
";",
"t",
".",
"true",
"(",
"config",
".",
"has",
"(",
"'key'",
")",
")",
";",
"t",
".",
"false",
"(",
"config",
".",
"has",
"(",
"'noop'",
")",
")",
";",
"}",
")",
";",
"test",
"(",
"'set sets new values'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"new",
"Config",
"(",
")",
";",
"config",
".",
"set",
"(",
"'key'",
",",
"'value'",
")",
";",
"t",
".",
"is",
"(",
"config",
".",
"get",
"(",
"'key'",
")",
",",
"'value'",
")",
";",
"}",
")",
";",
"test",
"(",
"'set sets nested values'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"new",
"Config",
"(",
")",
";",
"config",
".",
"set",
"(",
"'key.nested'",
",",
"'value'",
")",
";",
"t",
".",
"is",
"(",
"config",
".",
"get",
"(",
"'key.nested'",
")",
",",
"'value'",
")",
";",
"}",
")",
";",
"test",
"(",
"'merge sets values'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"new",
"Config",
"(",
"{",
"key",
":",
"'value'",
"}",
")",
";",
"config",
".",
"merge",
"(",
"{",
"key",
":",
"{",
"nested",
":",
"'value'",
"}",
"}",
")",
";",
"t",
".",
"is",
"(",
"config",
".",
"get",
"(",
"'key.nested'",
")",
",",
"'value'",
")",
";",
"}",
")",
";",
"test",
"(",
"'freeze makes the config immutable'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"new",
"Config",
"(",
"{",
"key",
":",
"'value'",
"}",
")",
";",
"config",
".",
"freeze",
"(",
")",
";",
"t",
".",
"throws",
"(",
"(",
")",
"=>",
"config",
".",
"set",
"(",
"'key'",
",",
"'bad'",
")",
",",
"/immutable/",
")",
";",
"}",
")",
";",
"test",
"(",
"'unfreeze makes the config editable'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"new",
"Config",
"(",
"{",
"key",
":",
"'value'",
"}",
")",
";",
"config",
".",
"unfreeze",
"(",
")",
";",
"t",
".",
"notThrows",
"(",
"(",
")",
"=>",
"config",
".",
"set",
"(",
"'key'",
",",
"'good'",
")",
")",
";",
"}",
")",
";",
"test",
"(",
"'freeze does not mess up with a null value'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"new",
"Config",
"(",
"{",
"key",
":",
"null",
"}",
")",
";",
"config",
".",
"freeze",
"(",
")",
";",
"t",
".",
"throws",
"(",
"(",
")",
"=>",
"config",
".",
"set",
"(",
"'key'",
",",
"'bad'",
")",
",",
"/immutable/",
")",
";",
"}",
")",
";",
"test",
"(",
"'merge fails on immutable tree'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"new",
"Config",
"(",
"{",
"key",
":",
"'value'",
"}",
")",
";",
"config",
".",
"freeze",
"(",
")",
";",
"t",
".",
"throws",
"(",
"(",
")",
"=>",
"config",
".",
"merge",
"(",
"{",
"more",
":",
"'value'",
"}",
")",
",",
"/immutable/",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
116 | [
"exports",
"return",
"{",
"boolean",
"}",
"export",
"function",
"isCi",
"(",
")",
"{",
"if",
"(",
"process",
".",
"env",
".",
"CI",
"===",
"'true'",
"||",
"process",
".",
"env",
".",
"CI",
"===",
"'1'",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
117 | [
"/**\n * houston/test/spec/lib/config/loader.ts\n * Tests configuration loading functions.\n */",
"import",
"baseTest",
",",
"{",
"TestInterface",
"}",
"from",
"'ava'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"*",
"as",
"loader",
"from",
"'../../../../src/lib/config/loader'",
";",
"import",
"{",
"isCi",
"}",
"from",
"'../../../utility/ci'",
";",
"const",
"test",
"=",
"baseTest",
"as",
"TestInterface",
"<",
"{",
"testingConfigPath",
":",
"string",
";",
"}",
">",
";",
"test",
".",
"beforeEach",
"(",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"context",
".",
"testingConfigPath",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'..'",
",",
"'..'",
",",
"'..'",
",",
"'fixture'",
",",
"'config.js'",
")",
";",
"}",
")",
";",
"test",
"(",
"'can convert houston environment variables to dot notation'",
",",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"is",
"(",
"loader",
".",
"stringToDot",
"(",
"'HOUSTON_SERVER_PORT'",
")",
",",
"'server.port'",
")",
";",
"}",
")",
";",
"test",
"(",
"'converts env to environment'",
",",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"is",
"(",
"loader",
".",
"stringToDot",
"(",
"'HOUSTON_ENV'",
")",
",",
"'environment'",
")",
";",
"}",
")",
";",
"test",
"(",
"'can find houston environment variables'",
",",
"(",
"t",
")",
"=>",
"{",
"process",
".",
"env",
".",
"HOUSTON_SERVER_PORT",
"=",
"'3000'",
";",
"const",
"config",
"=",
"loader",
".",
"getEnvironmentConfig",
"(",
")",
";",
"t",
".",
"is",
"(",
"config",
".",
"get",
"(",
"'server.port'",
")",
",",
"3000",
")",
";",
"}",
")",
";",
"test",
"(",
"'assigns environment based on NODE_ENV'",
",",
"(",
"t",
")",
"=>",
"{",
"process",
".",
"env",
".",
"NODE_ENV",
"=",
"'development'",
";",
"const",
"config",
"=",
"loader",
".",
"getEnvironmentConfig",
"(",
")",
";",
"t",
".",
"is",
"(",
"config",
".",
"get",
"(",
"'environment'",
")",
",",
"'development'",
")",
";",
"}",
")",
";",
"test",
"(",
"'assigns console log based on NODE_DEBUG'",
",",
"(",
"t",
")",
"=>",
"{",
"process",
".",
"env",
".",
"NODE_DEBUG",
"=",
"'true'",
";",
"const",
"config",
"=",
"loader",
".",
"getEnvironmentConfig",
"(",
")",
";",
"t",
".",
"is",
"(",
"config",
".",
"get",
"(",
"'log.console'",
")",
",",
"'debug'",
")",
";",
"}",
")",
";",
"test",
"(",
"'can find the package version'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"loader",
".",
"getProgramConfig",
"(",
")",
";",
"t",
".",
"true",
"(",
"config",
".",
"has",
"(",
"'houston.version'",
")",
")",
";",
"t",
".",
"true",
"(",
"config",
".",
"has",
"(",
"'houston.major'",
")",
")",
";",
"t",
".",
"true",
"(",
"config",
".",
"has",
"(",
"'houston.minor'",
")",
")",
";",
"t",
".",
"true",
"(",
"config",
".",
"has",
"(",
"'houston.patch'",
")",
")",
";",
"}",
")",
";",
"if",
"(",
"isCi",
"(",
")",
"===",
"false",
")",
"{",
"test",
"(",
"'can find the git commit'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"loader",
".",
"getProgramConfig",
"(",
")",
";",
"t",
".",
"true",
"(",
"config",
".",
"has",
"(",
"'houston.commit'",
")",
")",
";",
"}",
")",
";",
"test",
"(",
"'can find the git change'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"loader",
".",
"getProgramConfig",
"(",
")",
";",
"t",
".",
"true",
"(",
"config",
".",
"has",
"(",
"'houston.change'",
")",
")",
";",
"}",
")",
";",
"}",
"test",
"(",
"'can read configuration from file'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"{",
"testingConfigPath",
"}",
"=",
"t",
".",
"context",
";",
"const",
"config",
"=",
"loader",
".",
"getFileConfig",
"(",
"testingConfigPath",
")",
";",
"t",
".",
"is",
"(",
"config",
".",
"get",
"(",
"'environment'",
")",
",",
"'testing'",
")",
";",
"}",
")",
";",
"test",
"(",
"'can read configuration from relative path'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"{",
"testingConfigPath",
"}",
"=",
"t",
".",
"context",
";",
"const",
"relativeConfigPath",
"=",
"path",
".",
"relative",
"(",
"process",
".",
"cwd",
"(",
")",
",",
"testingConfigPath",
")",
";",
"const",
"config",
"=",
"loader",
".",
"getFileConfig",
"(",
"relativeConfigPath",
")",
";",
"t",
".",
"is",
"(",
"config",
".",
"get",
"(",
"'environment'",
")",
",",
"'testing'",
")",
";",
"}",
")",
";",
"test",
"(",
"'getConfig loads environment variables'",
",",
"(",
"t",
")",
"=>",
"{",
"process",
".",
"env",
".",
"HOUSTON_KEY",
"=",
"'value'",
";",
"const",
"{",
"testingConfigPath",
"}",
"=",
"t",
".",
"context",
";",
"const",
"config",
"=",
"loader",
".",
"getConfig",
"(",
"testingConfigPath",
")",
";",
"t",
".",
"is",
"(",
"config",
".",
"get",
"(",
"'key'",
")",
",",
"'value'",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6309,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
118 | [
"/**\n * houston/test/spec/lib/log/log.ts\n * Tests the log class.\n * NOTE: Because of typescript enum values, we compare the enum index value\n */",
"import",
"test",
",",
"{",
"Macro",
"}",
"from",
"'ava'",
";",
"import",
"*",
"as",
"Level",
"from",
"'../../../../src/lib/log/level'",
";",
"const",
"testParseLevel",
"=",
"(",
"t",
",",
"input",
",",
"expected",
")",
"=>",
"{",
"t",
".",
"is",
"(",
"Level",
".",
"parseLevel",
"(",
"input",
")",
",",
"expected",
")",
";",
"}",
";",
"testParseLevel",
".",
"title",
"=",
"(",
"_",
",",
"input",
",",
"expected",
")",
"=>",
"{",
"return",
"`parseLevel ${",
"input",
"} = ${",
"expected",
"}`",
";",
"}",
";",
"const",
"testLevelString",
"=",
"(",
"t",
",",
"input",
",",
"expected",
")",
"=>",
"{",
"t",
".",
"is",
"(",
"Level",
".",
"levelString",
"(",
"input",
")",
",",
"expected",
")",
";",
"}",
";",
"testLevelString",
".",
"title",
"=",
"(",
"_",
",",
"input",
",",
"expected",
")",
"=>",
"{",
"return",
"`levelString ${",
"input",
"} = ${",
"expected",
"}`",
";",
"}",
";",
"test",
"(",
"testParseLevel",
",",
"'DEBUG'",
",",
"0",
")",
";",
"test",
"(",
"testParseLevel",
",",
"'debug'",
",",
"0",
")",
";",
"test",
"(",
"testParseLevel",
",",
"'info'",
",",
"1",
")",
";",
"test",
"(",
"testParseLevel",
",",
"'warn'",
",",
"2",
")",
";",
"test",
"(",
"testParseLevel",
",",
"'error'",
",",
"3",
")",
";",
"test",
"(",
"testLevelString",
",",
"0",
",",
"'debug'",
")",
";",
"test",
"(",
"testLevelString",
",",
"1",
",",
"'info'",
")",
";",
"test",
"(",
"testLevelString",
",",
"2",
",",
"'warn'",
")",
";",
"test",
"(",
"testLevelString",
",",
"3",
",",
"'error'",
")",
";",
"test",
"(",
"'returns a default value if no matching level found'",
",",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"is",
"(",
"Level",
".",
"parseLevel",
"(",
"'noop'",
")",
",",
"1",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3230,
null,
null,
48,
null,
2,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3230,
null,
null,
48,
null,
3,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
3,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
119 | [
"/**\n * houston/test/spec/lib/log/log.ts\n * Tests the log class.\n */",
"import",
"baseTest",
",",
"{",
"TestInterface",
"}",
"from",
"'ava'",
";",
"import",
"{",
"create",
"}",
"from",
"'../../../utility/app'",
";",
"import",
"{",
"App",
"}",
"from",
"'../../../../src/app'",
";",
"import",
"{",
"Level",
"}",
"from",
"'../../../../src/lib/log/level'",
";",
"import",
"{",
"Log",
"}",
"from",
"'../../../../src/lib/log/log'",
";",
"import",
"{",
"Logger",
"}",
"from",
"'../../../../src/lib/log/logger'",
";",
"const",
"test",
"=",
"baseTest",
"as",
"TestInterface",
"<",
"{",
"app",
":",
"App",
";",
"logger",
":",
"Logger",
";",
"}",
">",
";",
"test",
".",
"beforeEach",
"(",
"async",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"context",
".",
"app",
"=",
"await",
"create",
"(",
")",
";",
"t",
".",
"context",
".",
"logger",
"=",
"t",
".",
"context",
".",
"app",
".",
"get",
"<",
"Logger",
">",
"(",
"Logger",
")",
";",
"}",
")",
";",
"test",
"(",
"'log can set level'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"log",
"=",
"new",
"Log",
"(",
"t",
".",
"context",
".",
"logger",
")",
".",
"setLevel",
"(",
"Level",
".",
"ERROR",
")",
";",
"t",
".",
"is",
"(",
"log",
".",
"level",
",",
"Level",
".",
"ERROR",
")",
";",
"}",
")",
";",
"test",
"(",
"'log can set message'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"log",
"=",
"new",
"Log",
"(",
"t",
".",
"context",
".",
"logger",
")",
".",
"setMessage",
"(",
"'testing log message'",
")",
";",
"t",
".",
"is",
"(",
"log",
".",
"message",
",",
"'testing log message'",
")",
";",
"}",
")",
";",
"test",
"(",
"'log can attach arbitrary data to error'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"log",
"=",
"new",
"Log",
"(",
"t",
".",
"context",
".",
"logger",
")",
".",
"setData",
"(",
"'user'",
",",
"'me!'",
")",
";",
"t",
".",
"deepEqual",
"(",
"log",
".",
"data",
",",
"{",
"user",
":",
"'me!'",
"}",
")",
";",
"}",
")",
";",
"test",
"(",
"'log can attach an error'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"error",
"=",
"new",
"Error",
"(",
"'testing'",
")",
";",
"const",
"log",
"=",
"new",
"Log",
"(",
"t",
".",
"context",
".",
"logger",
")",
".",
"setError",
"(",
"error",
")",
";",
"t",
".",
"is",
"(",
"log",
".",
"error",
",",
"error",
")",
";",
"}",
")",
";",
"test",
"(",
"'log sets date on creation'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"log",
"=",
"new",
"Log",
"(",
"t",
".",
"context",
".",
"logger",
")",
";",
"t",
".",
"true",
"(",
"log",
".",
"getDate",
"(",
")",
"instanceof",
"Date",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6309,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
735,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
735,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
735,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
25,
null,
null,
null,
null,
null,
null,
null,
null,
735,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
735,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
120 | [
"/**\n * houston/test/spec/lib/queue/provider.ts\n * Tests out the container system for the queue. I'm sorry am a IoC noob\n */",
"import",
"baseTest",
",",
"{",
"TestInterface",
"}",
"from",
"'ava'",
";",
"import",
"{",
"App",
"}",
"from",
"'../../../../src/lib/app'",
";",
"import",
"{",
"Config",
"}",
"from",
"'../../../../src/lib/config'",
";",
"import",
"{",
"IQueue",
",",
"IQueueConstructor",
",",
"Queue",
",",
"workerQueue",
"}",
"from",
"'../../../../src/lib/queue'",
";",
"import",
"{",
"create",
"}",
"from",
"'../../../utility/app'",
";",
"const",
"test",
"=",
"baseTest",
"as",
"TestInterface",
"<",
"{",
"app",
":",
"App",
";",
"}",
">",
";",
"test",
".",
"beforeEach",
"(",
"'setup app container'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"context",
".",
"app",
"=",
"await",
"create",
"(",
")",
";",
"}",
")",
";",
"test",
"(",
"'Queue throws error if configuration is unset'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"{",
"app",
"}",
"=",
"t",
".",
"context",
";",
"const",
"config",
"=",
"app",
".",
"get",
"<",
"Config",
">",
"(",
"Config",
")",
";",
"const",
"queueFactory",
"=",
"app",
".",
"get",
"<",
"IQueueConstructor",
">",
"(",
"Queue",
")",
";",
"config",
".",
"unfreeze",
"(",
")",
";",
"config",
".",
"set",
"(",
"'queue.client'",
",",
"null",
")",
";",
"t",
".",
"throws",
"(",
"(",
")",
"=>",
"queueFactory",
"(",
"'testing'",
")",
",",
"/config/",
")",
";",
"}",
")",
";",
"test",
"(",
"'Queue resolves to a factory function'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"{",
"app",
"}",
"=",
"t",
".",
"context",
";",
"const",
"queueFactory",
"=",
"app",
".",
"get",
"<",
"IQueueConstructor",
">",
"(",
"Queue",
")",
";",
"t",
".",
"is",
"(",
"typeof",
"queueFactory",
",",
"'function'",
")",
";",
"}",
")",
";",
"test",
"(",
"'workerQueue is a resolved Queue instance'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"{",
"app",
"}",
"=",
"t",
".",
"context",
";",
"const",
"queue",
"=",
"app",
".",
"get",
"<",
"IQueue",
">",
"(",
"workerQueue",
")",
";",
"t",
".",
"is",
"(",
"typeof",
"queue",
".",
"send",
",",
"'function'",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6309,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
121 | [
"/**\n * houston/test/spec/lib/service/aptly.ts\n * Tests the Aptly class.\n */",
"import",
"baseTest",
",",
"{",
"TestInterface",
"}",
"from",
"'ava'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"App",
"}",
"from",
"'../../../../src/lib/app'",
";",
"import",
"{",
"Config",
"}",
"from",
"'../../../../src/lib/config'",
";",
"import",
"{",
"Aptly",
",",
"createUrl",
"}",
"from",
"'../../../../src/lib/service/aptly'",
";",
"import",
"*",
"as",
"type",
"from",
"'../../../../src/lib/service/type'",
";",
"import",
"{",
"create",
"}",
"from",
"'../../../utility/app'",
";",
"import",
"{",
"record",
"}",
"from",
"'../../../utility/http'",
";",
"const",
"test",
"=",
"baseTest",
"as",
"TestInterface",
"<",
"{",
"app",
":",
"App",
";",
"}",
">",
";",
"test",
".",
"beforeEach",
"(",
"async",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"context",
".",
"app",
"=",
"await",
"create",
"(",
")",
";",
"}",
")",
";",
"const",
"DEFAULT_PKG",
"=",
"{",
"architecture",
":",
"'amd64'",
",",
"distribution",
":",
"'xenial'",
",",
"name",
":",
"'package'",
",",
"path",
":",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'../../../test/fixture/lib/service/github/vocal.deb'",
")",
",",
"type",
":",
"'deb'",
"}",
";",
"test",
"(",
"'createUrl removes undefined values'",
",",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"is",
"(",
"createUrl",
"(",
"'test'",
",",
"null",
",",
"'things'",
",",
"undefined",
",",
"5",
")",
",",
"'test/things/5'",
")",
";",
"}",
")",
";",
"test",
"(",
"'resolves aptly details from a config string'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"t",
".",
"context",
".",
"app",
".",
"get",
"(",
"Config",
")",
";",
"config",
".",
"unfreeze",
"(",
")",
";",
"config",
".",
"set",
"(",
"'service.aptly.review'",
",",
"'prefix'",
")",
";",
"config",
".",
"freeze",
"(",
")",
";",
"const",
"aptly",
"=",
"t",
".",
"context",
".",
"app",
".",
"get",
"(",
"Aptly",
")",
";",
"const",
"details",
"=",
"aptly",
".",
"getAptlyDetails",
"(",
"DEFAULT_PKG",
",",
"'review'",
")",
";",
"t",
".",
"is",
"(",
"details",
".",
"prefix",
",",
"'prefix'",
")",
";",
"}",
")",
";",
"test",
"(",
"'resolves aptly details from a config function'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"config",
"=",
"t",
".",
"context",
".",
"app",
".",
"get",
"(",
"Config",
")",
";",
"config",
".",
"unfreeze",
"(",
")",
";",
"config",
".",
"set",
"(",
"'service.aptly.review'",
",",
"(",
")",
"=>",
"(",
"{",
"architectures",
":",
"[",
"'architecture'",
"]",
",",
"distribution",
":",
"'distribution'",
",",
"prefix",
":",
"'prefix'",
"}",
")",
")",
";",
"config",
".",
"freeze",
"(",
")",
";",
"const",
"aptly",
"=",
"t",
".",
"context",
".",
"app",
".",
"get",
"(",
"Aptly",
")",
";",
"const",
"details",
"=",
"aptly",
".",
"getAptlyDetails",
"(",
"DEFAULT_PKG",
",",
"'review'",
")",
";",
"t",
".",
"true",
"(",
"details",
".",
"architectures",
".",
"indexOf",
"(",
"'architecture'",
")",
"!==",
"-",
"1",
")",
";",
"t",
".",
"is",
"(",
"details",
".",
"distribution",
",",
"'distribution'",
")",
";",
"t",
".",
"is",
"(",
"details",
".",
"prefix",
",",
"'prefix'",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6309,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
87,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
122 | [
"/**\n * houston/test/spec/lib/service/github.ts\n * Tests the GitHub class.\n */",
"import",
"baseTest",
",",
"{",
"TestInterface",
"}",
"from",
"'ava'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"github",
",",
"IGitHubFactory",
"}",
"from",
"'../../../../src/lib/service'",
";",
"import",
"*",
"as",
"type",
"from",
"'../../../../src/lib/service/type'",
";",
"import",
"{",
"create",
"as",
"createApp",
"}",
"from",
"'../../../utility/app'",
";",
"const",
"test",
"=",
"baseTest",
"as",
"TestInterface",
"<",
"{",
"factory",
":",
"IGitHubFactory",
";",
"}",
">",
";",
"test",
".",
"beforeEach",
"(",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"app",
"=",
"await",
"createApp",
"(",
")",
";",
"t",
".",
"context",
".",
"factory",
"=",
"app",
".",
"get",
"<",
"IGitHubFactory",
">",
"(",
"github",
")",
";",
"}",
")",
";",
"test",
"(",
"'url returns correct string without authentication'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"repo",
"=",
"t",
".",
"context",
".",
"factory",
"(",
"'https://github.com/elementary/houston'",
")",
";",
"t",
".",
"is",
"(",
"repo",
".",
"url",
",",
"'https://github.com/elementary/houston.git'",
")",
";",
"}",
")",
";",
"test",
"(",
"'url returns correct string with authentication'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"repo",
"=",
"t",
".",
"context",
".",
"factory",
"(",
"'https://x-access-token:[email protected]/elementary/houston'",
")",
";",
"t",
".",
"is",
"(",
"repo",
".",
"url",
",",
"'https://x-access-token:[email protected]/elementary/houston.git'",
")",
";",
"}",
")",
";",
"test",
"(",
"'can set values based on url'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"repo",
"=",
"t",
".",
"context",
".",
"factory",
"(",
"'https://github.com/noop/repo'",
")",
";",
"repo",
".",
"url",
"=",
"'https://github.com/elementary/houston'",
";",
"t",
".",
"is",
"(",
"repo",
".",
"username",
",",
"'elementary'",
")",
";",
"t",
".",
"is",
"(",
"repo",
".",
"repository",
",",
"'houston'",
")",
";",
"}",
")",
";",
"test",
"(",
"'can set values based on url with auth'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"repo",
"=",
"t",
".",
"context",
".",
"factory",
"(",
"'https://[email protected]/test/test'",
")",
";",
"repo",
".",
"url",
"=",
"'https://[email protected]/elementary/houston'",
";",
"t",
".",
"is",
"(",
"repo",
".",
"username",
",",
"'elementary'",
")",
";",
"t",
".",
"is",
"(",
"repo",
".",
"repository",
",",
"'houston'",
")",
";",
"t",
".",
"is",
"(",
"repo",
".",
"authUsername",
",",
"'x-access-token'",
")",
";",
"t",
".",
"is",
"(",
"repo",
".",
"authPassword",
",",
"'auth'",
")",
";",
"}",
")",
";",
"test",
"(",
"'can set values based on ssh url'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"repo",
"=",
"t",
".",
"context",
".",
"factory",
"(",
"'https://[email protected]/test/test'",
")",
";",
"repo",
".",
"url",
"=",
"'[email protected]:elementary/houston.git'",
";",
"t",
".",
"is",
"(",
"repo",
".",
"username",
",",
"'elementary'",
")",
";",
"t",
".",
"is",
"(",
"repo",
".",
"repository",
",",
"'houston'",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6309,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
189,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
4219,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
4219,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
4219,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
4219,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
4219,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
123 | [
"/**\n * houston/test/spec/lib/utility/eventemitter.ts\n * Tests we can do the things we need to do in fun node event like fashion\n */",
"import",
"test",
"from",
"'ava'",
";",
"import",
"{",
"EventEmitter",
"}",
"from",
"'../../../../src/lib/utility/eventemitter'",
";",
"test",
"(",
"'it can modify a value with sync listeners'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"em",
"=",
"new",
"EventEmitter",
"(",
")",
";",
"em",
".",
"on",
"(",
"'test'",
",",
"(",
"v",
")",
"=>",
"(",
"v",
"+",
"2",
")",
")",
";",
"const",
"value",
"=",
"await",
"em",
".",
"emitAsyncChain",
"(",
"'test'",
",",
"1",
")",
";",
"t",
".",
"is",
"(",
"value",
",",
"3",
")",
";",
"}",
")",
";",
"test",
"(",
"'it can modify a value with async listeners'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"em",
"=",
"new",
"EventEmitter",
"(",
")",
";",
"em",
".",
"on",
"(",
"'test'",
",",
"async",
"(",
"v",
")",
"=>",
"(",
"v",
"+",
"1",
")",
")",
";",
"em",
".",
"on",
"(",
"'test'",
",",
"async",
"(",
"v",
")",
"=>",
"(",
"v",
"+",
"2",
")",
")",
";",
"const",
"value",
"=",
"await",
"em",
".",
"emitAsyncChain",
"(",
"'test'",
",",
"1",
")",
";",
"t",
".",
"is",
"(",
"value",
",",
"4",
")",
";",
"}",
")",
";",
"test",
"(",
"'thrown errors in listeners appear on emitter'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"em",
"=",
"new",
"EventEmitter",
"(",
")",
";",
"const",
"err",
"=",
"new",
"Error",
"(",
"'this is an error!'",
")",
";",
"em",
".",
"on",
"(",
"'test'",
",",
"async",
"(",
"v",
")",
"=>",
"(",
"v",
"+",
"1",
")",
")",
";",
"em",
".",
"on",
"(",
"'test'",
",",
"async",
"(",
"v",
")",
"=>",
"{",
"throw",
"err",
";",
"}",
")",
";",
"await",
"t",
".",
"throwsAsync",
"(",
"em",
".",
"emitAsyncChain",
"(",
"'test'",
",",
"1",
")",
",",
"err",
".",
"message",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
400,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
400,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
400,
null,
null,
null,
null,
null,
null,
null,
25,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
124 | [
"/**\n * houston/src/lib/utility/glob.spec.ts\n * Tests glob functions\n */",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"test",
"from",
"'ava'",
";",
"import",
"{",
"glob",
"}",
"from",
"'../../../../src/lib/utility/glob'",
";",
"test",
"(",
"'it returns a promise from globbing'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"files",
"=",
"await",
"glob",
"(",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'**'",
")",
")",
";",
"t",
".",
"not",
"(",
"files",
".",
"indexOf",
"(",
"__filename",
")",
",",
"-",
"1",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
125 | [
"/**\n * houston/test/spec/lib/utility/rdnn.ts\n * Tests RDNN functions\n */",
"import",
"test",
",",
"{",
"Macro",
"}",
"from",
"'ava'",
";",
"import",
"*",
"as",
"rdnn",
"from",
"'../../../../src/lib/utility/rdnn'",
";",
"const",
"sanitize",
"=",
"(",
"t",
",",
"input",
",",
"expected",
")",
"=>",
"{",
"t",
".",
"is",
"(",
"rdnn",
".",
"sanitize",
"(",
"input",
")",
",",
"expected",
")",
";",
"}",
";",
"sanitize",
".",
"title",
"=",
"(",
"t",
",",
"input",
",",
"expected",
")",
"=>",
"{",
"return",
"`sanitize converts \"${",
"input",
"}\" to \"${",
"expected",
"}\"`",
";",
"}",
";",
"test",
"(",
"sanitize",
",",
"'com.github.btkostner.this is a repo'",
",",
"'com.github.btkostner.this_is_a_repo'",
")",
";",
"test",
"(",
"sanitize",
",",
"'com.github.btkostner.this-is-a-repo'",
",",
"'com.github.btkostner.this_is_a_repo'",
")",
";",
"test",
"(",
"sanitize",
",",
"'com.github.4u.2test'",
",",
"'com.github._4u._2test'",
")",
";",
"test",
"(",
"sanitize",
",",
"'org.7-zip.archiver'",
",",
"'org._7_zip.archiver'",
")",
";",
"test",
"(",
"sanitize",
",",
"'com.github.Username.RePoSiToRy'",
",",
"'com.github.username.repository'",
")",
";",
"test",
"(",
"'sanitize uses normalizer string'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"input",
"=",
"'com.github.testing.this-domain'",
";",
"const",
"expected",
"=",
"'com.github.testing.thisisadomain'",
";",
"t",
".",
"is",
"(",
"rdnn",
".",
"sanitize",
"(",
"input",
",",
"'isa'",
")",
",",
"expected",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3230,
null,
null,
48,
null,
2,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
126 | [
"/**\n * houston/test/spec/worker/log.ts\n * Tests the worker Log can do log related things :shrug:\n */",
"import",
"test",
"from",
"'ava'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"Log",
"}",
"from",
"'../../../src/worker/log'",
";",
"test",
"(",
"'it can render a template'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"test1",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'../../fixture/worker/log/test1.md'",
")",
";",
"const",
"log",
"=",
"Log",
".",
"template",
"(",
"Log",
".",
"Level",
".",
"ERROR",
",",
"test1",
",",
"{",
"body",
":",
"'## This is a subheader'",
",",
"title",
":",
"'testing'",
"}",
")",
";",
"t",
".",
"is",
"(",
"log",
".",
"title",
",",
"'testing'",
")",
";",
"t",
".",
"is",
"(",
"log",
".",
"body",
",",
"'This is a basic test1 Log template.\\n\\n## This is a subheader'",
")",
";",
"}",
")",
";",
"test",
"(",
"'setError will change the error message'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"error",
"=",
"new",
"Error",
"(",
"'this is a test'",
")",
";",
"const",
"log",
"=",
"new",
"Log",
"(",
"Log",
".",
"Level",
".",
"ERROR",
",",
"'test'",
",",
"'body'",
")",
";",
"log",
".",
"setError",
"(",
"error",
")",
";",
"t",
".",
"is",
"(",
"log",
".",
"message",
",",
"error",
".",
"message",
")",
";",
"}",
")",
";",
"test",
"(",
"'setError will add error object to the log'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"error",
"=",
"new",
"Error",
"(",
"'this is a test'",
")",
";",
"const",
"log",
"=",
"new",
"Log",
"(",
"Log",
".",
"Level",
".",
"ERROR",
",",
"'test'",
",",
"'body'",
")",
";",
"log",
".",
"setError",
"(",
"error",
")",
";",
"t",
".",
"is",
"(",
"log",
".",
"error",
",",
"error",
")",
";",
"}",
")",
";",
"test",
"(",
"'toString returns a nice templated log'",
",",
"(",
"t",
")",
"=>",
"{",
"const",
"err",
"=",
"new",
"Log",
"(",
"Log",
".",
"Level",
".",
"ERROR",
",",
"'title'",
",",
"'body'",
")",
";",
"t",
".",
"is",
"(",
"err",
".",
"toString",
"(",
")",
",",
"'# title\\n\\nbody'",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
735,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
25,
null,
null,
null,
null,
null,
null,
null,
null,
735,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
25,
null,
null,
null,
null,
null,
null,
null,
null,
735,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
735,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
127 | [
"/**\n * houston/test/spec/worker/preset/release.ts\n * Tests that the release preset has all the tasks we need\n */",
"import",
"baseTest",
",",
"{",
"TestInterface",
"}",
"from",
"'ava'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"{",
"App",
"}",
"from",
"'../../../../src/lib/app'",
";",
"import",
"{",
"Release",
"}",
"from",
"'../../../../src/worker/preset/release'",
";",
"import",
"{",
"Upload",
"}",
"from",
"'../../../../src/worker/task/upload'",
";",
"import",
"{",
"IContext",
"}",
"from",
"'../../../../src/worker/type'",
";",
"import",
"{",
"create",
"as",
"createApp",
"}",
"from",
"'../../../utility/app'",
";",
"import",
"{",
"context",
"as",
"createContext",
"}",
"from",
"'../../../utility/worker'",
";",
"import",
"{",
"Repository",
"}",
"from",
"'../../../utility/worker/repository'",
";",
"const",
"test",
"=",
"baseTest",
"as",
"TestInterface",
"<",
"{",
"app",
":",
"App",
";",
"repo",
":",
"Repository",
";",
"context",
":",
"IContext",
";",
"}",
">",
";",
"test",
".",
"beforeEach",
"(",
"async",
"(",
"t",
")",
"=>",
"{",
"t",
".",
"context",
".",
"app",
"=",
"await",
"createApp",
"(",
")",
";",
"t",
".",
"context",
".",
"repo",
"=",
"new",
"Repository",
"(",
"'https://github.com/elementary/houston'",
")",
";",
"t",
".",
"context",
".",
"context",
"=",
"await",
"createContext",
"(",
")",
";",
"}",
")",
";",
"test",
"(",
"'includes regular tasks from Build preset'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"Release",
"(",
"t",
".",
"context",
".",
"app",
",",
"t",
".",
"context",
".",
"repo",
",",
"t",
".",
"context",
".",
"context",
")",
";",
"t",
".",
"not",
"(",
"worker",
".",
"tasks",
".",
"length",
",",
"0",
")",
";",
"}",
")",
";",
"test",
"(",
"'includes upload post task'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"Release",
"(",
"t",
".",
"context",
".",
"app",
",",
"t",
".",
"context",
".",
"repo",
",",
"t",
".",
"context",
".",
"context",
")",
";",
"t",
".",
"not",
"(",
"worker",
".",
"postTasks",
".",
"indexOf",
"(",
"Upload",
")",
",",
"-",
"1",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6309,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
592,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
592,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
128 | [
"/**\n * houston/test/spec/worker/task/appstream/id.ts\n * Tests the appstream id test\n */",
"import",
"test",
"from",
"'ava'",
";",
"import",
"{",
"AppstreamId",
"}",
"from",
"'../../../../../src/worker/task/appstream/id'",
";",
"import",
"{",
"mock",
"}",
"from",
"'../../../../utility/worker'",
";",
"test",
"(",
"'passes with a matching ID'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"nameDomain",
":",
"'com.github.philip-scott.spice-up'",
"}",
")",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/appstream/spice-up.xml'",
",",
"'package/usr/share/metainfo/com.github.philip-scott.spice-up.appdata.xml'",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"AppstreamId",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"worker",
".",
"context",
".",
"logs",
".",
"forEach",
"(",
"(",
"l",
")",
"=>",
"t",
".",
"log",
"(",
"l",
")",
")",
";",
"t",
".",
"true",
"(",
"worker",
".",
"passes",
")",
";",
"}",
")",
";",
"test",
"(",
"'fails with an incorrect ID'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"nameDomain",
":",
"'com.github.philip-scott.spice-up'",
"}",
")",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/appstream/spice-up.xml'",
",",
"'package/usr/share/metainfo/com.github.elementary.houston.appdata.xml'",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"AppstreamId",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"worker",
".",
"context",
".",
"logs",
".",
"forEach",
"(",
"(",
"l",
")",
"=>",
"t",
".",
"log",
"(",
"l",
")",
")",
";",
"t",
".",
"true",
"(",
"worker",
".",
"fails",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5992,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5992,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
129 | [
"/**\n * houston/test/spec/worker/task/appstream/index.ts\n * Tests that known good appstream files pass appstream testing\n */",
"import",
"test",
"from",
"'ava'",
";",
"import",
"{",
"Appstream",
"}",
"from",
"'../../../../../src/worker/task/appstream/index'",
";",
"import",
"{",
"mock",
"}",
"from",
"'../../../../utility/worker'",
";",
"test",
"(",
"'failures stop the build'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"Appstream",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"t",
".",
"true",
"(",
"worker",
".",
"fails",
")",
";",
"}",
")",
";",
"test",
"(",
"'com.github.philip-scott.spice-up passes appstream tests'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"nameDomain",
":",
"'com.github.philip-scott.spice-up'",
"}",
")",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/appstream/spice-up.xml'",
",",
"'package/usr/share/metainfo/com.github.philip-scott.spice-up.appdata.xml'",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"Appstream",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"t",
".",
"true",
"(",
"worker",
".",
"passes",
")",
";",
"}",
")",
";",
"test",
"(",
"'basic errors get concated to single log'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"nameDomain",
":",
"'com.github.philip-scott.spice-up'",
"}",
")",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/appstream/blank.xml'",
",",
"'package/usr/share/metainfo/com.github.philip-scott.spice-up.appdata.xml'",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"Appstream",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"worker",
".",
"context",
".",
"logs",
".",
"forEach",
"(",
"(",
"l",
")",
"=>",
"t",
".",
"log",
"(",
"l",
")",
")",
";",
"const",
"combinedLog",
"=",
"worker",
".",
"context",
".",
"logs",
".",
"find",
"(",
"(",
"log",
")",
"=>",
"(",
"log",
".",
"title",
".",
"match",
"(",
"/appstream tests/i",
")",
"!=",
"null",
")",
")",
";",
"t",
".",
"true",
"(",
"worker",
".",
"fails",
")",
";",
"t",
".",
"regex",
"(",
"combinedLog",
".",
"body",
",",
"/description/",
")",
";",
"t",
".",
"regex",
"(",
"combinedLog",
".",
"body",
",",
"/summary/",
")",
";",
"t",
".",
"regex",
"(",
"combinedLog",
".",
"body",
",",
"/screenshots/",
")",
";",
"t",
".",
"regex",
"(",
"combinedLog",
".",
"body",
",",
"/id/",
")",
";",
"t",
".",
"regex",
"(",
"combinedLog",
".",
"body",
",",
"/name/",
")",
";",
"t",
".",
"regex",
"(",
"combinedLog",
".",
"body",
",",
"/project_license/",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5992,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5992,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5992,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
130 | [
"/**\n * houston/test/spec/worker/task/appstream/release.ts\n * Tests we can insert markdown changelogs to the appstream file\n */",
"import",
"test",
"from",
"'ava'",
";",
"import",
"*",
"as",
"cheerio",
"from",
"'cheerio'",
";",
"import",
"*",
"as",
"fs",
"from",
"'fs-extra'",
";",
"import",
"{",
"AppstreamRelease",
"}",
"from",
"'../../../../../src/worker/task/appstream/release'",
";",
"import",
"{",
"mock",
"}",
"from",
"'../../../../utility/worker'",
";",
"param",
"{",
"Context",
"}",
"t",
"param",
"{",
"string",
"}",
"data",
"param",
"{",
"string",
"}",
"expected",
"throws",
"return",
"{",
"void",
"}",
"function",
"expectChangelog",
"(",
"t",
",",
"data",
",",
"expected",
")",
"{",
"const",
"parseOptions",
"=",
"{",
"decodeEntities",
":",
"true",
",",
"normalizeWhitespace",
":",
"true",
",",
"xmlMode",
":",
"true",
"}",
";",
"const",
"$d",
"=",
"cheerio",
".",
"load",
"(",
"data",
",",
"parseOptions",
")",
";",
"const",
"$e",
"=",
"cheerio",
".",
"load",
"(",
"expected",
",",
"parseOptions",
")",
";",
"const",
"$release",
"=",
"$d",
"(",
"'component > releases > release:first-of-type'",
")",
";",
"t",
".",
"log",
"(",
"$release",
".",
"toString",
"(",
")",
")",
";",
"t",
".",
"is",
"(",
"$release",
".",
"attr",
"(",
"'version'",
")",
",",
"$e",
"(",
"'release'",
")",
".",
"attr",
"(",
"'version'",
")",
")",
";",
"t",
".",
"is",
"(",
"$release",
".",
"attr",
"(",
"'urgency'",
")",
",",
"$e",
"(",
"'release'",
")",
".",
"attr",
"(",
"'urgency'",
")",
")",
";",
"const",
"dRelease",
"=",
"$release",
".",
"html",
"(",
")",
".",
"replace",
"(",
"/\\s/img",
",",
"''",
")",
";",
"const",
"eRelease",
"=",
"$e",
"(",
"'release'",
")",
".",
"html",
"(",
")",
".",
"replace",
"(",
"/\\s/img",
",",
"''",
")",
";",
"t",
".",
"is",
"(",
"dRelease",
",",
"eRelease",
")",
";",
"}",
"test",
"(",
"'can insert a basic list of changes'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"changelog",
":",
"[",
"{",
"author",
":",
"'Blake Kostner'",
",",
"changes",
":",
"`This is a change I made\nThis is another change I made`",
",",
"date",
":",
"new",
"Date",
"(",
")",
",",
"version",
":",
"'1.0.0'",
"}",
"]",
",",
"nameDomain",
":",
"'com.github.elementary.houston'",
"}",
")",
";",
"const",
"p",
"=",
"'package/usr/share/metainfo/com.github.elementary.houston.appdata.xml'",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/appstream/blank.xml'",
",",
"p",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"AppstreamRelease",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"worker",
".",
"context",
".",
"logs",
".",
"forEach",
"(",
"(",
"l",
")",
"=>",
"t",
".",
"log",
"(",
"l",
")",
")",
";",
"const",
"file",
"=",
"await",
"fs",
".",
"readFile",
"(",
"worker",
".",
"get",
"(",
"p",
")",
",",
"'utf8'",
")",
";",
"t",
".",
"true",
"(",
"worker",
".",
"passes",
")",
";",
"expectChangelog",
"(",
"t",
",",
"file",
",",
"`\n <release version=\"1.0.0\" urgency=\"medium\">\n <description>\n <ul>\n <li>This is a change I made</li>\n <li>This is another change I made</li>\n </ul>\n </description>\n </release>\n `",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"}",
")",
";",
"test",
"(",
"'it strips out bad html tags from changes'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"changelog",
":",
"[",
"{",
"author",
":",
"'Blake Kostner'",
",",
"changes",
":",
"`# All about my changes\n\nThis is a bunch of cool things that are updated.\n\n* More fun stuff\n* Even cooler stuff\n\n<script>evil shenanigans</script>\n\n A sample code block`",
",",
"date",
":",
"new",
"Date",
"(",
")",
",",
"version",
":",
"'1.0.0'",
"}",
"]",
",",
"nameDomain",
":",
"'com.github.elementary.houston'",
"}",
")",
";",
"const",
"p",
"=",
"'package/usr/share/metainfo/com.github.elementary.houston.appdata.xml'",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/appstream/blank.xml'",
",",
"p",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"AppstreamRelease",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"worker",
".",
"context",
".",
"logs",
".",
"forEach",
"(",
"(",
"l",
")",
"=>",
"t",
".",
"log",
"(",
"l",
")",
")",
";",
"const",
"file",
"=",
"await",
"fs",
".",
"readFile",
"(",
"worker",
".",
"get",
"(",
"p",
")",
",",
"'utf8'",
")",
";",
"t",
".",
"true",
"(",
"worker",
".",
"passes",
")",
";",
"expectChangelog",
"(",
"t",
",",
"file",
",",
"`\n <release version=\"1.0.0\" urgency=\"medium\">\n <description>\n All about my changes\n <p>This is a bunch of cool things that are updated.</p>\n <ul>\n <li>More fun stuff</li>\n <li>Even cooler stuff</li>\n </ul>\n <p><script>evil shenanigans</script></p>\n A sample code block\n </description>\n </release>\n `",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2904,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2904,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
587,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5992,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5992,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
131 | [
"/**\n * houston/test/spec/worker/task/appstream/screenshot.ts\n * Tests the appstream screenshot test\n */",
"import",
"test",
"from",
"'ava'",
";",
"import",
"{",
"AppstreamScreenshot",
"}",
"from",
"'../../../../../src/worker/task/appstream/screenshot'",
";",
"import",
"{",
"mock",
"}",
"from",
"'../../../../utility/worker'",
";",
"test",
"(",
"'passes with screenshots specified'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"nameDomain",
":",
"'com.github.philip-scott.spice-up'",
"}",
")",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/appstream/spice-up.xml'",
",",
"'package/usr/share/metainfo/com.github.philip-scott.spice-up.appdata.xml'",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"AppstreamScreenshot",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"worker",
".",
"context",
".",
"logs",
".",
"forEach",
"(",
"(",
"l",
")",
"=>",
"t",
".",
"log",
"(",
"l",
")",
")",
";",
"t",
".",
"true",
"(",
"worker",
".",
"passes",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5992,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
132 | [
"/**\n * houston/test/spec/worker/task/appstream/stripe.ts\n * Tests inserting stripe keys into appstream file\n */",
"import",
"test",
"from",
"'ava'",
";",
"import",
"*",
"as",
"cheerio",
"from",
"'cheerio'",
";",
"import",
"*",
"as",
"fs",
"from",
"'fs-extra'",
";",
"import",
"{",
"AppstreamStripe",
"}",
"from",
"'../../../../../src/worker/task/appstream/stripe'",
";",
"import",
"{",
"mock",
"}",
"from",
"'../../../../utility/worker'",
";",
"test",
"(",
"'can insert a basic list of changes'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"nameDomain",
":",
"'com.github.elementary.houston'",
",",
"stripe",
":",
"'testingvaluehere'",
"}",
")",
";",
"const",
"p",
"=",
"'package/usr/share/metainfo/com.github.elementary.houston.appdata.xml'",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/appstream/blank.xml'",
",",
"p",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"AppstreamStripe",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"const",
"file",
"=",
"await",
"fs",
".",
"readFile",
"(",
"worker",
".",
"get",
"(",
"p",
")",
",",
"'utf8'",
")",
";",
"const",
"$",
"=",
"cheerio",
".",
"load",
"(",
"file",
",",
"{",
"xmlMode",
":",
"true",
"}",
")",
";",
"worker",
".",
"context",
".",
"logs",
".",
"forEach",
"(",
"(",
"l",
")",
"=>",
"t",
".",
"log",
"(",
"l",
")",
")",
";",
"t",
".",
"true",
"(",
"worker",
".",
"passes",
")",
";",
"t",
".",
"is",
"(",
"$",
"(",
"'component > custom > value'",
")",
".",
"text",
"(",
")",
",",
"'testingvaluehere'",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2904,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5992,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
133 | [
"/**\n * houston/src/worker/task/appstream/validate.spec.ts\n * Tests the validatecli docker test\n */",
"import",
"test",
"from",
"'ava'",
";",
"import",
"*",
"as",
"fs",
"from",
"'fs-extra'",
";",
"import",
"{",
"AppstreamValidate",
"}",
"from",
"'../../../../../src/worker/task/appstream/validate'",
";",
"import",
"{",
"mock",
"}",
"from",
"'../../../../utility/worker'",
";",
"test",
"(",
"'passes with a valid appstream file'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"nameDomain",
":",
"'com.github.philip-scott.spice-up'",
"}",
")",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/appstream/spice-up.xml'",
",",
"'package/usr/share/metainfo/com.github.philip-scott.spice-up.appdata.xml'",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"AppstreamValidate",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"worker",
".",
"context",
".",
"logs",
".",
"forEach",
"(",
"(",
"l",
")",
"=>",
"t",
".",
"log",
"(",
"l",
")",
")",
";",
"t",
".",
"true",
"(",
"worker",
".",
"passes",
")",
";",
"}",
")",
";",
"test",
"(",
"'fails with a blank appstream file'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"nameDomain",
":",
"'com.github.philip-scott.spice-up'",
"}",
")",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/appstream/blank.xml'",
",",
"'package/usr/share/metainfo/com.github.philip-scott.spice-up.appdata.xml'",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"AppstreamValidate",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"worker",
".",
"context",
".",
"logs",
".",
"forEach",
"(",
"(",
"l",
")",
"=>",
"t",
".",
"log",
"(",
"l",
")",
")",
";",
"t",
".",
"true",
"(",
"worker",
".",
"fails",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5992,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5992,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
134 | [
"/**\n * houston/test/spec/worker/task/debian/changelog.ts\n * Tests writing debian changelog files\n */",
"import",
"test",
"from",
"'ava'",
";",
"import",
"*",
"as",
"fs",
"from",
"'fs-extra'",
";",
"import",
"*",
"as",
"os",
"from",
"'os'",
";",
"import",
"*",
"as",
"path",
"from",
"'path'",
";",
"import",
"*",
"as",
"uuid",
"from",
"'uuid/v4'",
";",
"import",
"{",
"DebianChangelog",
"}",
"from",
"'../../../../../src/worker/task/debian/changelog'",
";",
"import",
"{",
"IContext",
"}",
"from",
"'../../../../../src/worker/type'",
";",
"import",
"{",
"context",
"as",
"createContext",
"}",
"from",
"'../../../../utility/worker'",
";",
"param",
"{",
"Date",
"}",
"return",
"{",
"string",
"}",
"function",
"debianDate",
"(",
"date",
")",
"{",
"return",
"date",
".",
"toUTCString",
"(",
")",
".",
"replace",
"(",
"'GMT'",
",",
"'+0000'",
")",
";",
"}",
"test",
"(",
"'can pull a list out of a markdown changelog'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"context",
"=",
"createContext",
"(",
"{",
"changelog",
":",
"[",
"{",
"author",
":",
"'Blake Kostner'",
",",
"changes",
":",
"`\n# This is a title\n### Example markdown changelog\n\nFixes:\n * Fix #1234 stuff doesnt work\n * Another Fix\n\nFeatures:\n * Added some cool thing\n `",
",",
"date",
":",
"new",
"Date",
"(",
")",
",",
"version",
":",
"'0.0.1'",
"}",
"]",
"}",
")",
";",
"const",
"changelogDate",
"=",
"debianDate",
"(",
"context",
".",
"changelog",
"[",
"0",
"]",
".",
"date",
")",
";",
"t",
".",
"is",
"(",
"await",
"DebianChangelog",
".",
"template",
"(",
"context",
")",
",",
"`\nio.elementary.houston (0.0.1) loki; urgency=low\n\n * Fix #1234 stuff doesnt work\n * Another Fix\n * Added some cool thing\n\n -- Blake Kostner <[email protected]> ${",
"changelogDate",
"}\n `",
".",
"trim",
"(",
")",
")",
";",
"}",
")",
";",
"test",
"(",
"'templates multiple changelogs correctly'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"context",
"=",
"createContext",
"(",
"{",
"changelog",
":",
"[",
"{",
"author",
":",
"'Blake Kostner'",
",",
"changes",
":",
"'0.0.3 release whoooo'",
",",
"date",
":",
"new",
"Date",
"(",
")",
",",
"version",
":",
"'0.0.3'",
"}",
",",
"{",
"author",
":",
"'Blake Kostner'",
",",
"changes",
":",
"'Fix some weird issues with building'",
",",
"date",
":",
"new",
"Date",
"(",
")",
",",
"version",
":",
"'0.0.2'",
"}",
",",
"{",
"author",
":",
"'Blake Kostner'",
",",
"changes",
":",
"'init 1'",
",",
"date",
":",
"new",
"Date",
"(",
")",
",",
"version",
":",
"'0.0.1'",
"}",
"]",
"}",
")",
";",
"const",
"changelogDate1",
"=",
"debianDate",
"(",
"context",
".",
"changelog",
"[",
"0",
"]",
".",
"date",
")",
";",
"const",
"changelogDate2",
"=",
"debianDate",
"(",
"context",
".",
"changelog",
"[",
"1",
"]",
".",
"date",
")",
";",
"const",
"changelogDate3",
"=",
"debianDate",
"(",
"context",
".",
"changelog",
"[",
"2",
"]",
".",
"date",
")",
";",
"t",
".",
"is",
"(",
"await",
"DebianChangelog",
".",
"template",
"(",
"context",
")",
",",
"`\nio.elementary.houston (0.0.3) loki; urgency=low\n\n * 0.0.3 release whoooo\n\n -- Blake Kostner <[email protected]> ${",
"changelogDate1",
"}\n\nio.elementary.houston (0.0.2) loki; urgency=low\n\n * Fix some weird issues with building\n\n -- Blake Kostner <[email protected]> ${",
"changelogDate2",
"}\n\nio.elementary.houston (0.0.1) loki; urgency=low\n\n * init 1\n\n -- Blake Kostner <[email protected]> ${",
"changelogDate3",
"}\n `",
".",
"trim",
"(",
")",
")",
";",
"}",
")",
";",
"test",
"(",
"'sorts changes based on date'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"context",
"=",
"createContext",
"(",
"{",
"changelog",
":",
"[",
"{",
"author",
":",
"'Blake Kostner'",
",",
"changes",
":",
"'init'",
",",
"date",
":",
"new",
"Date",
"(",
"2010",
",",
"0",
",",
"1",
")",
",",
"version",
":",
"'0.0.1'",
"}",
",",
"{",
"author",
":",
"'Blake Kostner'",
",",
"changes",
":",
"'release'",
",",
"date",
":",
"new",
"Date",
"(",
"2020",
",",
"0",
",",
"1",
")",
",",
"version",
":",
"'1.0.0'",
"}",
"]",
"}",
")",
";",
"const",
"changelogDate1",
"=",
"debianDate",
"(",
"context",
".",
"changelog",
"[",
"1",
"]",
".",
"date",
")",
";",
"const",
"changelogDate2",
"=",
"debianDate",
"(",
"context",
".",
"changelog",
"[",
"0",
"]",
".",
"date",
")",
";",
"t",
".",
"is",
"(",
"await",
"DebianChangelog",
".",
"template",
"(",
"context",
")",
",",
"`\nio.elementary.houston (1.0.0) loki; urgency=low\n\n * release\n\n -- Blake Kostner <[email protected]> ${",
"changelogDate1",
"}\n\nio.elementary.houston (0.0.1) loki; urgency=low\n\n * init\n\n -- Blake Kostner <[email protected]> ${",
"changelogDate2",
"}\n `",
".",
"trim",
"(",
")",
")",
";",
"}",
")",
";",
"test",
"(",
"'uses dash package name in the changelog'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"context",
"=",
"createContext",
"(",
"{",
"changelog",
":",
"[",
"{",
"author",
":",
"'Blake Kostner'",
",",
"changes",
":",
"'init'",
",",
"date",
":",
"new",
"Date",
"(",
"2010",
",",
"0",
",",
"1",
")",
",",
"version",
":",
"'1.0.0'",
"}",
"]",
",",
"nameDomain",
":",
"'com.github.btkostner.this_is_invalid_debian_package_name'",
"}",
")",
";",
"const",
"changelogDate",
"=",
"debianDate",
"(",
"context",
".",
"changelog",
"[",
"0",
"]",
".",
"date",
")",
";",
"const",
"template",
"=",
"await",
"DebianChangelog",
".",
"template",
"(",
"context",
")",
";",
"t",
".",
"log",
"(",
"template",
")",
";",
"t",
".",
"is",
"(",
"template",
".",
"indexOf",
"(",
"'com.github.btkostner.this_is_invalid_debian_package_name'",
")",
",",
"-",
"1",
")",
";",
"t",
".",
"not",
"(",
"template",
".",
"indexOf",
"(",
"'com.github.btkostner.this-is-invalid-debian-package-name'",
")",
",",
"-",
"1",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
26,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
135 | [
"/**\n * houston/test/spec/worker/task/desktop/index.ts\n * Tests that known good appstream files pass appstream testing\n */",
"import",
"test",
"from",
"'ava'",
";",
"import",
"{",
"DesktopIcon",
"}",
"from",
"'../../../../../src/worker/task/desktop/icon'",
";",
"import",
"{",
"Desktop",
"}",
"from",
"'../../../../../src/worker/task/desktop/index'",
";",
"import",
"{",
"mock",
"}",
"from",
"'../../../../utility/worker'",
";",
"test",
"(",
"'failures stop the build'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"Desktop",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"t",
".",
"true",
"(",
"worker",
".",
"fails",
")",
";",
"}",
")",
";",
"test",
"(",
"'com.github.philip-scott.spice-up passes desktop tests'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"nameDomain",
":",
"'com.github.philip-scott.spice-up'",
"}",
")",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/desktop/spice-up.desktop'",
",",
"'package/usr/share/applications/com.github.philip-scott.spice-up.desktop'",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"Desktop",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"t",
".",
"true",
"(",
"worker",
".",
"passes",
")",
";",
"}",
")",
";",
"test",
"(",
"'system apps do not have icon validation #590'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"nameDomain",
":",
"'io.elementary.appcenter'",
",",
"type",
":",
"'system-app'",
"}",
")",
";",
"const",
"desktop",
"=",
"new",
"Desktop",
"(",
"worker",
")",
";",
"t",
".",
"is",
"(",
"desktop",
".",
"tasks",
".",
"indexOf",
"(",
"DesktopIcon",
")",
",",
"-",
"1",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
15965,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
136 | [
"/**\n * houston/src/worker/task/desktop/validate.spec.ts\n * Tests the desktop-file-validate docker test\n */",
"import",
"test",
"from",
"'ava'",
";",
"import",
"{",
"DesktopValidate",
"}",
"from",
"'../../../../../src/worker/task/desktop/validate'",
";",
"import",
"{",
"mock",
"}",
"from",
"'../../../../utility/worker'",
";",
"test",
"(",
"'validates files besides default desktop file'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"nameDomain",
":",
"'com.github.philip-scott.spice-up'",
"}",
")",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/desktop/blank.desktop'",
",",
"'package/usr/share/applications/blank.desktop'",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"DesktopValidate",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"t",
".",
"is",
"(",
"worker",
".",
"context",
".",
"logs",
".",
"length",
",",
"1",
")",
";",
"t",
".",
"regex",
"(",
"worker",
".",
"context",
".",
"logs",
"[",
"0",
"]",
".",
"toString",
"(",
")",
",",
"/errors/",
")",
";",
"t",
".",
"regex",
"(",
"worker",
".",
"context",
".",
"logs",
"[",
"0",
"]",
".",
"toString",
"(",
")",
",",
"/blank\\.desktop/",
")",
";",
"}",
")",
";",
"test",
"(",
"'validate concats logs to single issue'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"nameDomain",
":",
"'com.github.philip-scott.spice-up'",
"}",
")",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/desktop/blank.desktop'",
",",
"'package/usr/share/applications/blank.desktop'",
")",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/desktop/blank.desktop'",
",",
"'package/usr/share/applications/another-blank.desktop'",
")",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/desktop/spice-up.desktop'",
",",
"'package/usr/share/applications/com.github.philip-scott.spice-up.desktop'",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"DesktopValidate",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"t",
".",
"is",
"(",
"worker",
".",
"context",
".",
"logs",
".",
"length",
",",
"1",
")",
";",
"t",
".",
"regex",
"(",
"worker",
".",
"context",
".",
"logs",
"[",
"0",
"]",
".",
"toString",
"(",
")",
",",
"/blank\\.desktop/",
")",
";",
"t",
".",
"regex",
"(",
"worker",
".",
"context",
".",
"logs",
"[",
"0",
"]",
".",
"toString",
"(",
")",
",",
"/another-blank\\.desktop/",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
137 | [
"/**\n * houston/test/spec/worker/task/file/deb/binary.ts\n * Tests the deb file binary test\n */",
"import",
"test",
"from",
"'ava'",
";",
"import",
"{",
"FileDebBinary",
"}",
"from",
"'../../../../../../src/worker/task/file/deb/binary'",
";",
"import",
"{",
"mock",
"}",
"from",
"'../../../../../utility/worker'",
";",
"test",
"(",
"'matches a correctly named bin file'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"nameDomain",
":",
"'com.github.elementary.houston'",
"}",
")",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/empty'",
",",
"'package/usr/bin/com.github.elementary.houston'",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"FileDebBinary",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"t",
".",
"true",
"(",
"worker",
".",
"passes",
")",
";",
"}",
")",
";",
"test",
"(",
"'includes project files in error log'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"nameDomain",
":",
"'com.github.elementary.houston'",
"}",
")",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/empty'",
",",
"'package/usr/share/docs/com.github.elementary.desktop'",
")",
";",
"await",
"worker",
".",
"mock",
"(",
"'task/empty'",
",",
"'package/usr/n00p/test'",
")",
";",
"worker",
".",
"tasks",
".",
"push",
"(",
"FileDebBinary",
")",
";",
"await",
"worker",
".",
"setup",
"(",
")",
";",
"await",
"worker",
".",
"run",
"(",
")",
";",
"await",
"worker",
".",
"teardown",
"(",
")",
";",
"t",
".",
"true",
"(",
"worker",
".",
"fails",
")",
";",
"t",
".",
"regex",
"(",
"worker",
".",
"context",
".",
"logs",
"[",
"0",
"]",
".",
"body",
",",
"/usr\\/share\\/docs\\/com\\.github\\.elementary\\.desktop/",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
138 | [
"/**\n * houston/test/spec/worker/task/workspace/setup.ts\n * Tests building out workspaces\n */",
"import",
"test",
"from",
"'ava'",
";",
"import",
"{",
"WorkspaceSetup",
"}",
"from",
"'../../../../../src/worker/task/workspace/setup'",
";",
"import",
"{",
"mock",
"}",
"from",
"'../../../../utility/worker'",
";",
"test",
"(",
"'builds workspace from all matching branches'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"distribution",
":",
"'loki'",
",",
"nameDomain",
":",
"'com.github.elementary.houston'",
",",
"references",
":",
"[",
"'refs/heads/loki'",
"]",
"}",
")",
";",
"worker",
".",
"repository",
".",
"references",
"=",
"async",
"(",
")",
"=>",
"(",
"[",
"'refs/heads/deb-packaging-loki'",
",",
"'refs/heads/deb-packaging-juno'",
",",
"'refs/heads/deb-packaging'",
",",
"'refs/heads/juno'",
",",
"'refs/heads/loki'",
",",
"'refs/heads/master'",
"]",
")",
";",
"const",
"setup",
"=",
"new",
"WorkspaceSetup",
"(",
"worker",
")",
";",
"const",
"setups",
"=",
"await",
"setup",
".",
"possibleBuilds",
"(",
")",
";",
"t",
".",
"deepEqual",
"(",
"setups",
",",
"[",
"{",
"architecture",
":",
"'amd64'",
",",
"distribution",
":",
"'loki'",
",",
"packageType",
":",
"'deb'",
"}",
",",
"{",
"architecture",
":",
"'amd64'",
",",
"distribution",
":",
"'juno'",
",",
"packageType",
":",
"'deb'",
"}",
"]",
")",
";",
"}",
")",
";",
"test",
"(",
"'deb-packaging adds the latest version even if builds exist'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"distribution",
":",
"'loki'",
",",
"nameDomain",
":",
"'com.github.elementary.houston'",
",",
"references",
":",
"[",
"'refs/heads/loki'",
"]",
"}",
")",
";",
"worker",
".",
"repository",
".",
"references",
"=",
"async",
"(",
")",
"=>",
"(",
"[",
"'refs/heads/deb-packaging-loki'",
",",
"'refs/heads/deb-packaging'",
",",
"'refs/heads/master'",
"]",
")",
";",
"const",
"setup",
"=",
"new",
"WorkspaceSetup",
"(",
"worker",
")",
";",
"const",
"setups",
"=",
"await",
"setup",
".",
"possibleBuilds",
"(",
")",
";",
"t",
".",
"deepEqual",
"(",
"setups",
",",
"[",
"{",
"architecture",
":",
"'amd64'",
",",
"distribution",
":",
"'loki'",
",",
"packageType",
":",
"'deb'",
"}",
",",
"{",
"architecture",
":",
"'amd64'",
",",
"distribution",
":",
"'juno'",
",",
"packageType",
":",
"'deb'",
"}",
"]",
")",
";",
"}",
")",
";",
"test",
"(",
"'builds workspace defaults to latest version'",
",",
"async",
"(",
"t",
")",
"=>",
"{",
"const",
"worker",
"=",
"await",
"mock",
"(",
"{",
"distribution",
":",
"'loki'",
",",
"nameDomain",
":",
"'com.github.elementary.houston'",
",",
"references",
":",
"[",
"'refs/heads/loki'",
"]",
"}",
")",
";",
"worker",
".",
"repository",
".",
"references",
"=",
"async",
"(",
")",
"=>",
"(",
"[",
"'refs/heads/deb-packaging'",
",",
"'refs/heads/master'",
"]",
")",
";",
"const",
"setup",
"=",
"new",
"WorkspaceSetup",
"(",
"worker",
")",
";",
"const",
"setups",
"=",
"await",
"setup",
".",
"possibleBuilds",
"(",
")",
";",
"t",
".",
"deepEqual",
"(",
"setups",
",",
"[",
"{",
"architecture",
":",
"'amd64'",
",",
"distribution",
":",
"'juno'",
",",
"packageType",
":",
"'deb'",
"}",
"]",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
48,
null,
null,
null,
null,
15349,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
139 | [
"exports",
"exports",
"exports",
"import",
"{",
"create",
"}",
"from",
"'./app'",
";",
"import",
"{",
"Config",
"}",
"from",
"'../../src/lib/config'",
";",
"import",
"{",
"Database",
"}",
"from",
"'../../src/lib/database/database'",
";",
"async",
"param",
"{",
"Database",
"}",
"database",
"return",
"{",
"void",
"}",
"export",
"async",
"function",
"migrate",
"(",
"database",
")",
"{",
"await",
"database",
".",
"knex",
".",
"migrate",
".",
"latest",
"(",
")",
";",
"}",
"async",
"param",
"{",
"Database",
"}",
"database",
"return",
"{",
"void",
"}",
"export",
"async",
"function",
"seed",
"(",
"database",
")",
"{",
"await",
"database",
".",
"knex",
".",
"seed",
".",
"run",
"(",
")",
";",
"}",
"async",
"param",
"{",
"Config",
"}",
"config",
"return",
"{",
"Database",
"}",
"export",
"async",
"function",
"setup",
"(",
"config",
")",
"{",
"const",
"app",
"=",
"await",
"create",
"(",
")",
";",
"const",
"database",
"=",
"app",
".",
"get",
"<",
"Database",
">",
"(",
"Database",
")",
";",
"await",
"migrate",
"(",
"database",
")",
";",
"await",
"seed",
"(",
"database",
")",
";",
"return",
"database",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
551,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
551,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
87,
null,
null,
null,
189,
null,
null,
null,
null,
null,
null,
null,
551,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
140 | [
"import",
"{",
"Profile",
",",
"ExporterOptions",
",",
"BaseExporter",
"}",
"from",
"'@openprofiling/core'",
";",
"import",
"*",
"as",
"fs",
"from",
"'fs'",
";",
"import",
"{",
"tmpdir",
"}",
"from",
"'os'",
";",
"import",
"{",
"resolve",
"}",
"from",
"'path'",
";",
"export",
"interface",
"FileExporterConfig",
"extends",
"ExporterOptions",
"{",
"path",
":",
"string",
";",
"}",
"const",
"defaultFileExporterConfig",
"=",
"{",
"path",
":",
"tmpdir",
"(",
")",
"}",
";",
"export",
"const",
"fileExtensions",
"=",
"{",
"'HEAP_PROFILE'",
":",
"'heapprofile'",
",",
"'CPU_PROFILE'",
":",
"'cpuprofile'",
",",
"'PERFECTO'",
":",
"'json'",
"}",
";",
"export",
"class",
"FileExporter",
"extends",
"BaseExporter",
"{",
"private",
"config",
":",
"FileExporterConfig",
"=",
"defaultFileExporterConfig",
";",
"constructor",
"(",
"options",
"?",
")",
"{",
"super",
"(",
"'file'",
",",
"options",
")",
";",
"if",
"(",
"typeof",
"options",
"===",
"'object'",
")",
"{",
"this",
".",
"config",
"=",
"options",
";",
"}",
"}",
"async",
"onProfileStart",
"(",
"profile",
")",
"{",
"return",
";",
"}",
"async",
"onProfileEnd",
"(",
"profile",
")",
"{",
"const",
"extension",
"=",
"fileExtensions",
"[",
"profile",
".",
"kind",
"]",
";",
"const",
"filename",
"=",
"`${",
"profile",
".",
"kind",
".",
"toLowerCase",
"(",
")",
"}-${",
"profile",
".",
"startTime",
".",
"toISOString",
"(",
")",
"}.${",
"extension",
"}`",
";",
"const",
"targetPath",
"=",
"resolve",
"(",
"this",
".",
"config",
".",
"path",
",",
"filename",
")",
";",
"fs",
".",
"writeFile",
"(",
"targetPath",
",",
"profile",
".",
"data",
",",
"(",
"err",
")",
"=>",
"{",
"if",
"(",
"err",
")",
"{",
"this",
".",
"logger",
".",
"error",
"(",
"`Error while writing profile to disk`",
",",
"err",
".",
"message",
")",
";",
"}",
"else",
"{",
"this",
".",
"logger",
".",
"info",
"(",
"`File written to ${",
"filename",
"}`",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
672,
null,
null,
null,
null,
null,
null,
7,
null,
672,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
243,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
141 | [
"import",
"{",
"SyntaxNode",
",",
"Argument",
",",
"Parameter",
"}",
"from",
"'./python-parser'",
";",
"const",
"comma",
"=",
"', '",
";",
"function",
"printTabbed",
"(",
"node",
",",
"tabLevel",
")",
"{",
"const",
"tabs",
"=",
"' '",
".",
"repeat",
"(",
"4",
"*",
"tabLevel",
")",
";",
"switch",
"(",
"node",
".",
"type",
")",
"{",
"case",
"'assert'",
":",
"return",
"tabs",
"+",
"'assert '",
"+",
"printNode",
"(",
"node",
".",
"cond",
")",
";",
"case",
"'assign'",
":",
"return",
"(",
"tabs",
"+",
"commaSep",
"(",
"node",
".",
"targets",
")",
"+",
"' '",
"+",
"(",
"node",
".",
"op",
"||",
"'='",
")",
"+",
"' '",
"+",
"commaSep",
"(",
"node",
".",
"sources",
")",
")",
";",
"case",
"'binop'",
":",
"return",
"'('",
"+",
"printNode",
"(",
"node",
".",
"left",
")",
"+",
"node",
".",
"op",
"+",
"printNode",
"(",
"node",
".",
"right",
")",
"+",
"')'",
";",
"case",
"'break'",
":",
"return",
"tabs",
"+",
"'break'",
";",
"case",
"'call'",
":",
"return",
"printNode",
"(",
"node",
".",
"func",
")",
"+",
"'('",
"+",
"node",
".",
"args",
".",
"map",
"(",
"printArg",
")",
"+",
"')'",
";",
"case",
"'class'",
":",
"return",
"(",
"tabs",
"+",
"'class '",
"+",
"node",
".",
"name",
"+",
"(",
"node",
".",
"extends",
"?",
"'('",
"+",
"commaSep",
"(",
"node",
".",
"extends",
")",
"+",
"')'",
":",
"''",
")",
"+",
"':'",
"+",
"lines",
"(",
"node",
".",
"code",
",",
"tabLevel",
"+",
"1",
")",
")",
";",
"case",
"'comp_for'",
":",
"case",
"'comp_if'",
":",
"throw",
"'not implemented'",
";",
"case",
"'continue'",
":",
"return",
"tabs",
"+",
"'continue'",
";",
"case",
"'decorator'",
":",
"return",
"(",
"'@'",
"+",
"node",
".",
"decorator",
"+",
"(",
"node",
".",
"args",
"?",
"'('",
"+",
"commaSep",
"(",
"node",
".",
"args",
")",
"+",
"')'",
":",
"''",
")",
")",
";",
"case",
"'decorate'",
":",
"return",
"(",
"tabs",
"+",
"lines",
"(",
"node",
".",
"decorators",
",",
"tabLevel",
")",
"+",
"printTabbed",
"(",
"node",
".",
"def",
",",
"tabLevel",
")",
")",
";",
"case",
"'def'",
":",
"return",
"(",
"tabs",
"+",
"'def '",
"+",
"node",
".",
"name",
"+",
"'('",
"+",
"node",
".",
"params",
".",
"map",
"(",
"printParam",
")",
".",
"join",
"(",
"comma",
")",
"+",
"'):'",
"+",
"lines",
"(",
"node",
".",
"code",
",",
"tabLevel",
"+",
"1",
")",
")",
";",
"case",
"'dict'",
":",
"return",
"'{'",
"+",
"node",
".",
"entries",
".",
"map",
"(",
"e",
"=>",
"e",
".",
"k",
"+",
"':'",
"+",
"e",
".",
"v",
")",
"+",
"'}'",
";",
"case",
"'dot'",
":",
"return",
"printNode",
"(",
"node",
".",
"value",
")",
"+",
"'.'",
"+",
"node",
".",
"name",
";",
"case",
"'else'",
":",
"return",
"tabs",
"+",
"'else:'",
"+",
"lines",
"(",
"node",
".",
"code",
",",
"tabLevel",
"+",
"1",
")",
";",
"case",
"'for'",
":",
"return",
"(",
"tabs",
"+",
"'for '",
"+",
"commaSep",
"(",
"node",
".",
"target",
")",
"+",
"' in '",
"+",
"commaSep",
"(",
"node",
".",
"iter",
")",
"+",
"':'",
"+",
"lines",
"(",
"node",
".",
"code",
",",
"tabLevel",
"+",
"1",
")",
"+",
"(",
"node",
".",
"else",
"?",
"lines",
"(",
"node",
".",
"else",
",",
"tabLevel",
"+",
"1",
")",
":",
"''",
")",
")",
";",
"case",
"'from'",
":",
"return",
"(",
"tabs",
"+",
"'from '",
"+",
"node",
".",
"base",
"+",
"' import '",
"+",
"node",
".",
"imports",
".",
"map",
"(",
"im",
"=>",
"im",
".",
"path",
"+",
"(",
"im",
".",
"name",
"?",
"' as '",
"+",
"im",
".",
"name",
":",
"''",
")",
")",
".",
"join",
"(",
"comma",
")",
")",
";",
"case",
"'global'",
":",
"return",
"tabs",
"+",
"'global '",
"+",
"node",
".",
"names",
".",
"join",
"(",
"comma",
")",
";",
"case",
"'if'",
":",
"return",
"(",
"tabs",
"+",
"'if '",
"+",
"printNode",
"(",
"node",
".",
"cond",
")",
"+",
"':'",
"+",
"lines",
"(",
"node",
".",
"code",
",",
"tabLevel",
"+",
"1",
")",
"+",
"(",
"node",
".",
"elif",
"?",
"node",
".",
"elif",
".",
"map",
"(",
"elif",
"=>",
"tabs",
"+",
"'elif '",
"+",
"elif",
".",
"cond",
"+",
"':'",
"+",
"lines",
"(",
"elif",
".",
"code",
",",
"tabLevel",
"+",
"1",
")",
")",
":",
"''",
")",
"+",
"(",
"node",
".",
"else",
"?",
"tabs",
"+",
"'else:'",
"+",
"lines",
"(",
"node",
".",
"else",
".",
"code",
",",
"tabLevel",
"+",
"1",
")",
":",
"''",
")",
")",
";",
"case",
"'ifexpr'",
":",
"return",
"(",
"printNode",
"(",
"node",
".",
"then",
")",
"+",
"' if '",
"+",
"printNode",
"(",
"node",
".",
"test",
")",
"+",
"' else '",
"+",
"printNode",
"(",
"node",
".",
"else",
")",
")",
";",
"case",
"'import'",
":",
"return",
"(",
"tabs",
"+",
"'import '",
"+",
"node",
".",
"names",
".",
"map",
"(",
"n",
"=>",
"n",
".",
"path",
"+",
"(",
"n",
".",
"name",
"?",
"' as '",
"+",
"n",
".",
"name",
":",
"''",
")",
")",
".",
"join",
"(",
"comma",
")",
")",
";",
"case",
"'index'",
":",
"return",
"printNode",
"(",
"node",
".",
"value",
")",
"+",
"'['",
"+",
"commaSep",
"(",
"node",
".",
"args",
")",
"+",
"']'",
";",
"case",
"'lambda'",
":",
"return",
"(",
"'lambda '",
"+",
"node",
".",
"args",
".",
"map",
"(",
"printParam",
")",
".",
"join",
"(",
"comma",
")",
"+",
"': '",
"+",
"printNode",
"(",
"node",
".",
"code",
")",
")",
";",
"case",
"'list'",
":",
"return",
"'['",
"+",
"node",
".",
"items",
".",
"map",
"(",
"item",
"=>",
"printNode",
"(",
"item",
")",
")",
".",
"join",
"(",
"comma",
")",
"+",
"']'",
";",
"case",
"'literal'",
":",
"return",
"typeof",
"node",
".",
"value",
"===",
"'string'",
"&&",
"node",
".",
"value",
".",
"indexOf",
"(",
"'\\n'",
")",
">=",
"0",
"?",
"'\"\"'",
"+",
"node",
".",
"value",
"+",
"'\"\"'",
":",
"node",
".",
"value",
".",
"toString",
"(",
")",
";",
"case",
"'module'",
":",
"return",
"lines",
"(",
"node",
".",
"code",
",",
"tabLevel",
")",
";",
"case",
"'name'",
":",
"return",
"node",
".",
"id",
";",
"case",
"'nonlocal'",
":",
"return",
"tabs",
"+",
"'nonlocal '",
"+",
"node",
".",
"names",
".",
"join",
"(",
"comma",
")",
";",
"case",
"'raise'",
":",
"return",
"tabs",
"+",
"'raise '",
"+",
"printNode",
"(",
"node",
".",
"err",
")",
";",
"case",
"'return'",
":",
"return",
"tabs",
"+",
"'return '",
"+",
"(",
"node",
".",
"values",
"?",
"commaSep",
"(",
"node",
".",
"values",
")",
":",
"''",
")",
";",
"case",
"'set'",
":",
"return",
"'{'",
"+",
"commaSep",
"(",
"node",
".",
"entries",
")",
"+",
"'}'",
";",
"case",
"'slice'",
":",
"return",
"(",
"(",
"node",
".",
"start",
"?",
"printNode",
"(",
"node",
".",
"start",
")",
":",
"''",
")",
"+",
"':'",
"+",
"(",
"node",
".",
"stop",
"?",
"printNode",
"(",
"node",
".",
"stop",
")",
":",
"''",
")",
"+",
"(",
"node",
".",
"step",
"?",
"':'",
"+",
"printNode",
"(",
"node",
".",
"step",
")",
":",
"''",
")",
")",
";",
"case",
"'starred'",
":",
"return",
"'*'",
"+",
"printNode",
"(",
"node",
".",
"value",
")",
";",
"case",
"'try'",
":",
"return",
"(",
"tabs",
"+",
"'try:'",
"+",
"lines",
"(",
"node",
".",
"code",
",",
"tabLevel",
"+",
"1",
")",
"+",
"(",
"node",
".",
"excepts",
"?",
"node",
".",
"excepts",
".",
"map",
"(",
"ex",
"=>",
"tabs",
"+",
"'except '",
"+",
"(",
"ex",
".",
"cond",
"?",
"printNode",
"(",
"ex",
".",
"cond",
")",
"+",
"(",
"ex",
".",
"name",
"?",
"' as '",
"+",
"ex",
".",
"name",
":",
"''",
")",
":",
"''",
")",
"+",
"':'",
"+",
"lines",
"(",
"ex",
".",
"code",
",",
"tabLevel",
"+",
"1",
")",
")",
":",
"''",
")",
"+",
"(",
"node",
".",
"else",
"?",
"tabs",
"+",
"'else:'",
"+",
"lines",
"(",
"node",
".",
"else",
",",
"tabLevel",
"+",
"1",
")",
":",
"''",
")",
"+",
"(",
"node",
".",
"finally",
"?",
"tabs",
"+",
"'finally:'",
"+",
"lines",
"(",
"node",
".",
"finally",
",",
"tabLevel",
"+",
"1",
")",
":",
"''",
")",
")",
";",
"case",
"'tuple'",
":",
"return",
"'('",
"+",
"commaSep",
"(",
"node",
".",
"items",
")",
"+",
"')'",
";",
"case",
"'unop'",
":",
"return",
"node",
".",
"op",
"+",
"'('",
"+",
"printNode",
"(",
"node",
".",
"operand",
")",
"+",
"')'",
";",
"case",
"'while'",
":",
"return",
"(",
"tabs",
"+",
"'while '",
"+",
"printNode",
"(",
"node",
".",
"cond",
")",
"+",
"':'",
"+",
"lines",
"(",
"node",
".",
"code",
",",
"tabLevel",
"+",
"1",
")",
")",
";",
"case",
"'with'",
":",
"return",
"(",
"tabs",
"+",
"'with '",
"+",
"node",
".",
"items",
".",
"map",
"(",
"w",
"=>",
"w",
".",
"with",
"+",
"(",
"w",
".",
"as",
"?",
"' as '",
"+",
"w",
".",
"as",
":",
"''",
")",
")",
".",
"join",
"(",
"comma",
")",
"+",
"':'",
"+",
"lines",
"(",
"node",
".",
"code",
",",
"tabLevel",
"+",
"1",
")",
")",
";",
"case",
"'yield'",
":",
"return",
"(",
"tabs",
"+",
"'yield '",
"+",
"(",
"node",
".",
"from",
"?",
"printNode",
"(",
"node",
".",
"from",
")",
":",
"''",
")",
"+",
"(",
"node",
".",
"value",
"?",
"commaSep",
"(",
"node",
".",
"value",
")",
":",
"''",
")",
")",
";",
"}",
"}",
"function",
"printParam",
"(",
"param",
")",
"{",
"return",
"(",
"(",
"param",
".",
"star",
"?",
"'*'",
":",
"''",
")",
"+",
"(",
"param",
".",
"starstar",
"?",
"'**'",
":",
"''",
")",
"+",
"param",
".",
"name",
"+",
"(",
"param",
".",
"default_value",
"?",
"'='",
"+",
"printNode",
"(",
"param",
".",
"default_value",
")",
":",
"''",
")",
"+",
"(",
"param",
".",
"anno",
"?",
"printNode",
"(",
"param",
".",
"anno",
")",
":",
"''",
")",
")",
";",
"}",
"function",
"printArg",
"(",
"arg",
")",
"{",
"return",
"(",
"(",
"arg",
".",
"kwargs",
"?",
"'**'",
":",
"''",
")",
"+",
"(",
"arg",
".",
"varargs",
"?",
"'*'",
":",
"''",
")",
"+",
"(",
"arg",
".",
"keyword",
"?",
"printNode",
"(",
"arg",
".",
"keyword",
")",
"+",
"'='",
":",
"''",
")",
"+",
"printNode",
"(",
"arg",
".",
"actual",
")",
"+",
"(",
"arg",
".",
"loop",
"?",
"' for '",
"+",
"arg",
".",
"loop",
".",
"for",
"+",
"' in '",
"+",
"arg",
".",
"loop",
".",
"in",
":",
"''",
")",
")",
";",
"}",
"function",
"commaSep",
"(",
"items",
")",
"{",
"return",
"items",
".",
"map",
"(",
"printNode",
")",
".",
"join",
"(",
"comma",
")",
";",
"}",
"function",
"lines",
"(",
"items",
",",
"tabLevel",
")",
"{",
"return",
"items",
".",
"map",
"(",
"i",
"=>",
"printTabbed",
"(",
"i",
",",
"tabLevel",
")",
")",
".",
"join",
"(",
"tabLevel",
"===",
"0",
"?",
"'\\n\\n'",
":",
"'\\n'",
")",
";",
"}",
"export",
"function",
"printNode",
"(",
"node",
")",
"{",
"return",
"printTabbed",
"(",
"node",
",",
"0",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
2143,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
689,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
3311,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
5,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2143,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
142 | [
"import",
"{",
"parse",
"as",
"python3Parse",
",",
"parser",
"}",
"from",
"'./python3'",
";",
"import",
"{",
"printNode",
"}",
"from",
"'./printNode'",
";",
"/**\n * Reset the lexer state after an error. Otherwise, parses after a failed parse can fail too.\n */",
"let",
"yy",
"=",
"parser",
".",
"yy",
"as",
"any",
";",
"let",
"oldParseError",
"=",
"yy",
".",
"parseError",
";",
"oldParseError",
"=",
"function",
"(",
"text",
",",
"hash",
")",
"{",
"this",
".",
"indents",
"=",
"[",
"0",
"]",
";",
"this",
".",
"indent",
"=",
"0",
";",
"this",
".",
"dedents",
"=",
"0",
";",
"this",
".",
"brackets_count",
"=",
"0",
";",
"oldParseError",
".",
"call",
"(",
"this",
",",
"text",
",",
"hash",
")",
";",
"}",
";",
"/**\n * This is the main interface for parsing code.\n * Call this instead of the `parse` method in python3.js.\n * If the `parse` method gets an error, all later calls will throw an error.\n * This method resets the state of the `parse` method so that doesn't happen.\n */",
"export",
"function",
"parse",
"(",
"program",
")",
"{",
"if",
"(",
"program",
".",
"charCodeAt",
"(",
"0",
")",
"===",
"65279",
")",
"{",
"program",
"=",
"program",
".",
"slice",
"(",
"1",
")",
";",
"}",
"return",
"python3Parse",
"(",
"program",
".",
"replace",
"(",
"/\\r/g",
",",
"''",
")",
"+",
"'\\n'",
")",
";",
"}",
"export",
"type",
"SyntaxNode",
"=",
"Module",
"|",
"Import",
"|",
"From",
"|",
"Decorator",
"|",
"Decorate",
"|",
"Def",
"|",
"Parameter",
"|",
"Assignment",
"|",
"Assert",
"|",
"Pass",
"|",
"Return",
"|",
"Yield",
"|",
"Raise",
"|",
"Continue",
"|",
"Break",
"|",
"Global",
"|",
"Nonlocal",
"|",
"If",
"|",
"Else",
"|",
"While",
"|",
"For",
"|",
"Try",
"|",
"With",
"|",
"Call",
"|",
"Index",
"|",
"Slice",
"|",
"Dot",
"|",
"IfExpr",
"|",
"CompFor",
"|",
"CompIf",
"|",
"Lambda",
"|",
"UnaryOperator",
"|",
"BinaryOperator",
"|",
"Starred",
"|",
"Tuple",
"|",
"ListExpr",
"|",
"SetExpr",
"|",
"DictExpr",
"|",
"Name",
"|",
"Literal",
"|",
"Class",
";",
"interface",
"JisonLocation",
"{",
"first_line",
":",
"number",
";",
"first_column",
":",
"number",
";",
"last_line",
":",
"number",
";",
"last_column",
":",
"number",
";",
"}",
"export",
"interface",
"Location",
"extends",
"JisonLocation",
"{",
"path",
"?",
":",
"string",
";",
"}",
"export",
"function",
"locationString",
"(",
"loc",
")",
"{",
"return",
"`${",
"loc",
".",
"path",
"}${",
"loc",
".",
"last_line",
"}:${",
"loc",
".",
"first_column",
"}-${",
"loc",
".",
"last_line",
"}:${",
"loc",
".",
"last_column",
"}`",
";",
"}",
"export",
"function",
"locationContains",
"(",
"loc1",
",",
"loc2",
")",
"{",
"function",
"contains",
"(",
"loc",
",",
"line",
",",
"col",
")",
"{",
"return",
"(",
"(",
"loc",
".",
"first_line",
"<",
"line",
"||",
"(",
"loc",
".",
"first_line",
"===",
"line",
"&&",
"loc",
".",
"first_column",
"<=",
"col",
")",
")",
"&&",
"(",
"line",
"<",
"loc",
".",
"last_line",
"||",
"(",
"line",
"===",
"loc",
".",
"last_line",
"&&",
"col",
"<=",
"loc",
".",
"last_column",
")",
")",
")",
";",
"}",
"return",
"(",
"contains",
"(",
"loc1",
",",
"loc2",
".",
"first_line",
",",
"loc2",
".",
"first_column",
")",
"&&",
"contains",
"(",
"loc1",
",",
"loc2",
".",
"last_line",
",",
"loc2",
".",
"last_column",
")",
")",
";",
"}",
"export",
"interface",
"Locatable",
"{",
"location",
"?",
":",
"Location",
";",
"cellId",
"?",
":",
"string",
";",
"executionCount",
"?",
":",
"number",
";",
"}",
"const",
"LocatableFields",
"=",
"[",
"'location'",
",",
"'cellId'",
",",
"'executionCount'",
"]",
";",
"export",
"const",
"MODULE",
"=",
"'module'",
";",
"export",
"interface",
"Module",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"MODULE",
";",
"code",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"export",
"const",
"IMPORT",
"=",
"'import'",
";",
"export",
"interface",
"Import",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"IMPORT",
";",
"names",
":",
"{",
"path",
":",
"string",
";",
"name",
"?",
":",
"string",
";",
"location",
":",
"Location",
";",
"}",
"[",
"]",
";",
"}",
"export",
"const",
"FROM",
"=",
"'from'",
";",
"export",
"interface",
"From",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"FROM",
";",
"base",
":",
"string",
";",
"imports",
":",
"{",
"path",
":",
"string",
";",
"name",
":",
"string",
";",
"location",
":",
"Location",
";",
"}",
"[",
"]",
";",
"}",
"export",
"const",
"DECORATOR",
"=",
"'decorator'",
";",
"export",
"interface",
"Decorator",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"DECORATOR",
";",
"decorator",
":",
"string",
";",
"args",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"export",
"const",
"DECORATE",
"=",
"'decorate'",
";",
"export",
"interface",
"Decorate",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"DECORATE",
";",
"decorators",
":",
"Decorator",
"[",
"]",
";",
"def",
":",
"SyntaxNode",
";",
"}",
"export",
"const",
"DEF",
"=",
"'def'",
";",
"export",
"interface",
"Def",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"DEF",
";",
"name",
":",
"string",
";",
"params",
":",
"Parameter",
"[",
"]",
";",
"code",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"export",
"const",
"PARAMETER",
"=",
"'parameter'",
";",
"export",
"interface",
"Parameter",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"PARAMETER",
";",
"name",
":",
"string",
";",
"anno",
":",
"SyntaxNode",
";",
"default_value",
":",
"SyntaxNode",
";",
"star",
":",
"boolean",
";",
"starstar",
":",
"boolean",
";",
"}",
"export",
"const",
"ASSIGN",
"=",
"'assign'",
";",
"export",
"interface",
"Assignment",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"ASSIGN",
";",
"op",
":",
"string",
"|",
"undefined",
";",
"targets",
":",
"SyntaxNode",
"[",
"]",
";",
"sources",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"export",
"const",
"ASSERT",
"=",
"'assert'",
";",
"export",
"interface",
"Assert",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"ASSERT",
";",
"cond",
":",
"SyntaxNode",
";",
"err",
":",
"SyntaxNode",
";",
"}",
"export",
"const",
"PASS",
"=",
"'pass'",
";",
"export",
"interface",
"Pass",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"PASS",
";",
"}",
"export",
"const",
"RETURN",
"=",
"'return'",
";",
"export",
"interface",
"Return",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"RETURN",
";",
"values",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"export",
"const",
"YIELD",
"=",
"'yield'",
";",
"export",
"interface",
"Yield",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"YIELD",
";",
"value",
":",
"SyntaxNode",
"[",
"]",
";",
"from",
"?",
":",
"SyntaxNode",
";",
"}",
"export",
"const",
"RAISE",
"=",
"'raise'",
";",
"export",
"interface",
"Raise",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"RAISE",
";",
"err",
":",
"SyntaxNode",
";",
"}",
"export",
"const",
"BREAK",
"=",
"'break'",
";",
"export",
"interface",
"Break",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"BREAK",
";",
"}",
"export",
"const",
"CONTINUE",
"=",
"'continue'",
";",
"export",
"interface",
"Continue",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"CONTINUE",
";",
"}",
"export",
"const",
"GLOBAL",
"=",
"'global'",
";",
"export",
"interface",
"Global",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"GLOBAL",
";",
"names",
":",
"string",
"[",
"]",
";",
"}",
"export",
"const",
"NONLOCAL",
"=",
"'nonlocal'",
";",
"export",
"interface",
"Nonlocal",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"NONLOCAL",
";",
"names",
":",
"string",
"[",
"]",
";",
"}",
"export",
"const",
"IF",
"=",
"'if'",
";",
"export",
"interface",
"If",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"IF",
";",
"cond",
":",
"SyntaxNode",
";",
"code",
":",
"SyntaxNode",
"[",
"]",
";",
"elif",
":",
"{",
"cond",
":",
"SyntaxNode",
";",
"code",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"[",
"]",
";",
"else",
":",
"Else",
";",
"}",
"export",
"const",
"WHILE",
"=",
"'while'",
";",
"export",
"interface",
"While",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"WHILE",
";",
"cond",
":",
"SyntaxNode",
";",
"code",
":",
"SyntaxNode",
"[",
"]",
";",
"else",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"export",
"const",
"ELSE",
"=",
"'else'",
";",
"export",
"interface",
"Else",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"ELSE",
";",
"code",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"export",
"const",
"FOR",
"=",
"'for'",
";",
"export",
"interface",
"For",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"FOR",
";",
"target",
":",
"SyntaxNode",
"[",
"]",
";",
"iter",
":",
"SyntaxNode",
"[",
"]",
";",
"code",
":",
"SyntaxNode",
"[",
"]",
";",
"else",
"?",
":",
"SyntaxNode",
"[",
"]",
";",
"decl_location",
":",
"Location",
";",
"}",
"export",
"const",
"COMPFOR",
"=",
"'comp_for'",
";",
"export",
"interface",
"CompFor",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"COMPFOR",
";",
"for",
":",
"SyntaxNode",
"[",
"]",
";",
"in",
":",
"SyntaxNode",
";",
"}",
"export",
"const",
"COMPIF",
"=",
"'comp_if'",
";",
"export",
"interface",
"CompIf",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"COMPIF",
";",
"test",
":",
"SyntaxNode",
";",
"}",
"export",
"const",
"TRY",
"=",
"'try'",
";",
"export",
"interface",
"Try",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"TRY",
";",
"code",
":",
"SyntaxNode",
"[",
"]",
";",
"excepts",
":",
"{",
"cond",
":",
"SyntaxNode",
";",
"name",
":",
"string",
";",
"code",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"[",
"]",
";",
"else",
":",
"SyntaxNode",
"[",
"]",
";",
"finally",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"export",
"const",
"WITH",
"=",
"'with'",
";",
"export",
"interface",
"With",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"WITH",
";",
"items",
":",
"{",
"with",
":",
"SyntaxNode",
";",
"as",
":",
"SyntaxNode",
";",
"}",
"[",
"]",
";",
"code",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"export",
"const",
"CALL",
"=",
"'call'",
";",
"export",
"interface",
"Call",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"CALL",
";",
"func",
":",
"SyntaxNode",
";",
"args",
":",
"Argument",
"[",
"]",
";",
"}",
"export",
"const",
"ARG",
"=",
"'arg'",
";",
"export",
"interface",
"Argument",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"ARG",
";",
"actual",
":",
"SyntaxNode",
";",
"keyword",
"?",
":",
"SyntaxNode",
";",
"loop",
"?",
":",
"CompFor",
";",
"varargs",
"?",
":",
"boolean",
";",
"kwargs",
"?",
":",
"boolean",
";",
"}",
"export",
"const",
"INDEX",
"=",
"'index'",
";",
"export",
"interface",
"Index",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"INDEX",
";",
"value",
":",
"SyntaxNode",
";",
"args",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"export",
"const",
"SLICE",
"=",
"'slice'",
";",
"export",
"interface",
"Slice",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"SLICE",
";",
"start",
"?",
":",
"SyntaxNode",
";",
"stop",
"?",
":",
"SyntaxNode",
";",
"step",
"?",
":",
"SyntaxNode",
";",
"}",
"export",
"const",
"DOT",
"=",
"'dot'",
";",
"export",
"interface",
"Dot",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"DOT",
";",
"value",
":",
"SyntaxNode",
";",
"name",
":",
"string",
";",
"}",
"export",
"const",
"IFEXPR",
"=",
"'ifexpr'",
";",
"export",
"interface",
"IfExpr",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"IFEXPR",
";",
"test",
":",
"SyntaxNode",
";",
"then",
":",
"SyntaxNode",
";",
"else",
":",
"SyntaxNode",
";",
"}",
"export",
"const",
"LAMBDA",
"=",
"'lambda'",
";",
"export",
"interface",
"Lambda",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"LAMBDA",
";",
"args",
":",
"Parameter",
"[",
"]",
";",
"code",
":",
"SyntaxNode",
";",
"}",
"export",
"const",
"UNOP",
"=",
"'unop'",
";",
"export",
"interface",
"UnaryOperator",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"UNOP",
";",
"op",
":",
"string",
";",
"operand",
":",
"SyntaxNode",
";",
"}",
"export",
"const",
"BINOP",
"=",
"'binop'",
";",
"export",
"interface",
"BinaryOperator",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"BINOP",
";",
"op",
":",
"string",
";",
"left",
":",
"SyntaxNode",
";",
"right",
":",
"SyntaxNode",
";",
"}",
"export",
"const",
"STARRED",
"=",
"'starred'",
";",
"export",
"interface",
"Starred",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"STARRED",
";",
"value",
":",
"SyntaxNode",
";",
"}",
"export",
"const",
"TUPLE",
"=",
"'tuple'",
";",
"export",
"interface",
"Tuple",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"TUPLE",
";",
"items",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"export",
"const",
"LIST",
"=",
"'list'",
";",
"export",
"interface",
"ListExpr",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"LIST",
";",
"items",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"export",
"const",
"SET",
"=",
"'set'",
";",
"export",
"interface",
"SetExpr",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"SET",
";",
"entries",
":",
"SyntaxNode",
"[",
"]",
";",
"comp_for",
"?",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"export",
"const",
"DICT",
"=",
"'dict'",
";",
"export",
"interface",
"DictExpr",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"DICT",
";",
"entries",
":",
"{",
"k",
":",
"SyntaxNode",
";",
"v",
":",
"SyntaxNode",
";",
"}",
"[",
"]",
";",
"comp_for",
"?",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"export",
"const",
"NAME",
"=",
"'name'",
";",
"export",
"interface",
"Name",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"NAME",
";",
"id",
":",
"string",
";",
"}",
"export",
"const",
"LITERAL",
"=",
"'literal'",
";",
"export",
"interface",
"Literal",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"LITERAL",
";",
"value",
":",
"any",
";",
"}",
"export",
"const",
"CLASS",
"=",
"'class'",
";",
"export",
"interface",
"Class",
"extends",
"Locatable",
"{",
"type",
":",
"typeof",
"CLASS",
";",
"name",
":",
"string",
";",
"extends",
":",
"SyntaxNode",
"[",
"]",
";",
"code",
":",
"SyntaxNode",
"[",
"]",
";",
"}",
"/**\n * returns whether two syntax nodes are semantically equivalent\n */",
"export",
"function",
"isEquivalent",
"(",
"node1",
",",
"node2",
")",
"{",
"if",
"(",
"!",
"node1",
"||",
"!",
"node2",
")",
"{",
"return",
"node1",
"===",
"node2",
";",
"}",
"return",
"printNode",
"(",
"node1",
")",
"===",
"printNode",
"(",
"node2",
")",
";",
"}",
"export",
"function",
"flatten",
"<",
"T",
">",
"(",
"arrayArrays",
")",
"{",
"return",
"[",
"]",
".",
"concat",
"(",
"...",
"arrayArrays",
")",
";",
"}",
"/**\n * Listener for pre-order traversal of the parse tree.\n */",
"export",
"interface",
"WalkListener",
"{",
"/**\n * Called whenever a node is entered.\n */",
"onEnterNode",
"?",
"(",
"node",
",",
"ancestors",
")",
":",
"void",
";",
"/**\n * Called whenever a node is exited.\n */",
"onExitNode",
"?",
"(",
"node",
",",
"ancestors",
")",
":",
"void",
";",
"}",
"/**\n * Preorder tree traversal with optional listener.\n */",
"export",
"function",
"walk",
"(",
"node",
",",
"walkListener",
"?",
")",
"{",
"return",
"walkRecursive",
"(",
"node",
",",
"[",
"]",
",",
"walkListener",
")",
";",
"}",
"/**\n * Recursive implementation of pre-order tree walk.\n */",
"function",
"walkRecursive",
"(",
"node",
",",
"ancestors",
"?",
",",
"walkListener",
"?",
")",
"{",
"if",
"(",
"!",
"node",
")",
"{",
"console",
".",
"error",
"(",
"'Node undefined. Ancestors:'",
",",
"ancestors",
")",
";",
"return",
"[",
"]",
";",
"}",
"ancestors",
".",
"push",
"(",
"node",
")",
";",
"if",
"(",
"walkListener",
"&&",
"walkListener",
".",
"onEnterNode",
")",
"{",
"walkListener",
".",
"onEnterNode",
"(",
"node",
",",
"ancestors",
")",
";",
"}",
"let",
"children",
"=",
"[",
"]",
";",
"switch",
"(",
"node",
".",
"type",
")",
"{",
"case",
"MODULE",
":",
"case",
"DEF",
":",
"case",
"CLASS",
":",
"children",
"=",
"node",
".",
"code",
";",
"break",
";",
"case",
"IF",
":",
"children",
"=",
"[",
"node",
".",
"cond",
"]",
".",
"concat",
"(",
"node",
".",
"code",
")",
".",
"concat",
"(",
"node",
".",
"elif",
"?",
"flatten",
"(",
"node",
".",
"elif",
".",
"map",
"(",
"e",
"=>",
"[",
"e",
".",
"cond",
"]",
".",
"concat",
"(",
"e",
".",
"code",
")",
")",
")",
":",
"[",
"]",
")",
".",
"concat",
"(",
"node",
".",
"else",
"?",
"[",
"node",
".",
"else",
"]",
":",
"[",
"]",
")",
";",
"break",
";",
"case",
"ELSE",
":",
"children",
"=",
"node",
".",
"code",
";",
"break",
";",
"case",
"WHILE",
":",
"children",
"=",
"[",
"node",
".",
"cond",
"]",
".",
"concat",
"(",
"node",
".",
"code",
")",
";",
"break",
";",
"case",
"WITH",
":",
"children",
"=",
"flatten",
"(",
"node",
".",
"items",
".",
"map",
"(",
"r",
"=>",
"[",
"r",
".",
"with",
",",
"r",
".",
"as",
"]",
")",
")",
".",
"concat",
"(",
"node",
".",
"code",
")",
";",
"break",
";",
"case",
"FOR",
":",
"children",
"=",
"node",
".",
"iter",
".",
"concat",
"(",
"node",
".",
"target",
")",
".",
"concat",
"(",
"node",
".",
"code",
")",
";",
"break",
";",
"case",
"TRY",
":",
"children",
"=",
"node",
".",
"code",
".",
"concat",
"(",
"flatten",
"(",
"(",
"node",
".",
"excepts",
"||",
"[",
"]",
")",
".",
"map",
"(",
"e",
"=>",
"(",
"e",
".",
"cond",
"?",
"[",
"e",
".",
"cond",
"]",
":",
"[",
"]",
")",
".",
"concat",
"(",
"e",
".",
"code",
")",
")",
")",
")",
".",
"concat",
"(",
"node",
".",
"else",
"||",
"[",
"]",
")",
".",
"concat",
"(",
"node",
".",
"finally",
"||",
"[",
"]",
")",
";",
"break",
";",
"case",
"DECORATE",
":",
"children",
"=",
"[",
"node",
".",
"def",
"]",
";",
"break",
";",
"case",
"LAMBDA",
":",
"children",
"=",
"[",
"node",
".",
"code",
"]",
";",
"break",
";",
"case",
"CALL",
":",
"children",
"=",
"[",
"node",
".",
"func",
"]",
".",
"concat",
"(",
"node",
".",
"args",
".",
"map",
"(",
"a",
"=>",
"a",
".",
"actual",
")",
")",
";",
"break",
";",
"case",
"IFEXPR",
":",
"children",
"=",
"[",
"node",
".",
"test",
",",
"node",
".",
"then",
",",
"node",
".",
"else",
"]",
";",
"break",
";",
"case",
"COMPFOR",
":",
"children",
"=",
"node",
".",
"for",
".",
"concat",
"(",
"[",
"node",
".",
"in",
"]",
")",
";",
"break",
";",
"case",
"UNOP",
":",
"children",
"=",
"[",
"node",
".",
"operand",
"]",
";",
"break",
";",
"case",
"BINOP",
":",
"children",
"=",
"[",
"node",
".",
"left",
",",
"node",
".",
"right",
"]",
";",
"break",
";",
"case",
"STARRED",
":",
"children",
"=",
"[",
"node",
".",
"value",
"]",
";",
"break",
";",
"case",
"SET",
":",
"children",
"=",
"node",
".",
"entries",
".",
"concat",
"(",
"node",
".",
"comp_for",
"?",
"node",
".",
"comp_for",
":",
"[",
"]",
")",
";",
"break",
";",
"case",
"LIST",
":",
"children",
"=",
"node",
".",
"items",
";",
"break",
";",
"case",
"TUPLE",
":",
"children",
"=",
"node",
".",
"items",
";",
"break",
";",
"case",
"DICT",
":",
"children",
"=",
"flatten",
"(",
"node",
".",
"entries",
".",
"map",
"(",
"p",
"=>",
"[",
"p",
".",
"k",
",",
"p",
".",
"v",
"]",
")",
")",
".",
"concat",
"(",
"node",
".",
"comp_for",
"?",
"node",
".",
"comp_for",
":",
"[",
"]",
")",
";",
"break",
";",
"case",
"ASSIGN",
":",
"if",
"(",
"!",
"node",
".",
"sources",
")",
"console",
".",
"log",
"(",
"node",
")",
";",
"children",
"=",
"node",
".",
"sources",
".",
"concat",
"(",
"node",
".",
"targets",
")",
";",
"break",
";",
"case",
"ASSERT",
":",
"children",
"=",
"[",
"node",
".",
"cond",
"]",
".",
"concat",
"(",
"node",
".",
"err",
"?",
"[",
"node",
".",
"err",
"]",
":",
"[",
"]",
")",
";",
"break",
";",
"case",
"DOT",
":",
"children",
"=",
"[",
"node",
".",
"value",
"]",
";",
"break",
";",
"case",
"INDEX",
":",
"children",
"=",
"[",
"node",
".",
"value",
"]",
".",
"concat",
"(",
"node",
".",
"args",
")",
";",
"break",
";",
"case",
"SLICE",
":",
"children",
"=",
"(",
"node",
".",
"start",
"?",
"[",
"node",
".",
"start",
"]",
":",
"[",
"]",
")",
".",
"concat",
"(",
"node",
".",
"stop",
"?",
"[",
"node",
".",
"stop",
"]",
":",
"[",
"]",
")",
".",
"concat",
"(",
"node",
".",
"step",
"?",
"[",
"node",
".",
"step",
"]",
":",
"[",
"]",
")",
";",
"break",
";",
"case",
"COMPFOR",
":",
"children",
"=",
"node",
".",
"for",
".",
"concat",
"(",
"[",
"node",
".",
"in",
"]",
")",
";",
"break",
";",
"case",
"COMPIF",
":",
"children",
"=",
"[",
"node",
".",
"test",
"]",
";",
"break",
";",
"case",
"YIELD",
":",
"children",
"=",
"node",
".",
"value",
"?",
"node",
".",
"value",
":",
"[",
"]",
";",
"break",
";",
"case",
"RETURN",
":",
"children",
"=",
"node",
".",
"values",
"?",
"node",
".",
"values",
":",
"[",
"]",
";",
"break",
";",
"case",
"RAISE",
":",
"children",
"=",
"node",
".",
"err",
"?",
"[",
"node",
".",
"err",
"]",
":",
"[",
"]",
";",
"break",
";",
"case",
"IFEXPR",
":",
"children",
"=",
"[",
"node",
".",
"test",
",",
"node",
".",
"then",
",",
"node",
".",
"else",
"]",
";",
"break",
";",
"}",
"let",
"nodes",
"=",
"[",
"node",
"]",
";",
"if",
"(",
"children",
".",
"some",
"(",
"c",
"=>",
"!",
"c",
")",
")",
"{",
"console",
".",
"log",
"(",
"'BAD CHILDREN'",
",",
"node",
")",
";",
"}",
"let",
"subtreeNodes",
"=",
"flatten",
"(",
"children",
".",
"map",
"(",
"node",
"=>",
"walkRecursive",
"(",
"node",
",",
"ancestors",
",",
"walkListener",
")",
")",
")",
";",
"nodes",
"=",
"nodes",
".",
"concat",
"(",
"subtreeNodes",
")",
";",
"if",
"(",
"walkListener",
"&&",
"walkListener",
".",
"onExitNode",
")",
"{",
"walkListener",
".",
"onExitNode",
"(",
"node",
",",
"ancestors",
")",
";",
"}",
"ancestors",
".",
"pop",
"(",
")",
";",
"return",
"nodes",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
492,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
318,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
163,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
163,
null,
163,
null,
null,
null,
8,
null,
163,
null,
3,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
2143,
null,
2143,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2143,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
2143,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
2143,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
2143,
null,
5,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
143 | [
"export",
"class",
"Set",
"<",
"T",
">",
"{",
"private",
"_items",
":",
"{",
"[",
"index",
"]",
":",
"T",
";",
"}",
"=",
"{",
"}",
";",
"constructor",
"(",
"private",
"getIdentifier",
",",
"...",
"items",
")",
"{",
"this",
".",
"getIdentifier",
"=",
"getIdentifier",
";",
"this",
".",
"_items",
"=",
"{",
"}",
";",
"this",
".",
"add",
"(",
"...",
"items",
")",
";",
"}",
"public",
"get",
"size",
"(",
")",
"{",
"return",
"this",
".",
"items",
".",
"length",
";",
"}",
"public",
"add",
"(",
"...",
"items",
")",
"{",
"items",
".",
"forEach",
"(",
"item",
"=>",
"(",
"this",
".",
"_items",
"[",
"this",
".",
"getIdentifier",
"(",
"item",
")",
"]",
"=",
"item",
")",
")",
";",
"}",
"public",
"remove",
"(",
"item",
")",
"{",
"if",
"(",
"this",
".",
"has",
"(",
"item",
")",
")",
"{",
"delete",
"this",
".",
"_items",
"[",
"this",
".",
"getIdentifier",
"(",
"item",
")",
"]",
";",
"}",
"}",
"public",
"pop",
"(",
")",
"{",
"if",
"(",
"this",
".",
"empty",
")",
"{",
"throw",
"'empty'",
";",
"}",
"const",
"someKey",
"=",
"Object",
".",
"keys",
"(",
"this",
".",
"_items",
")",
"[",
"0",
"]",
";",
"const",
"result",
"=",
"this",
".",
"_items",
"[",
"someKey",
"]",
";",
"this",
".",
"remove",
"(",
"result",
")",
";",
"return",
"result",
";",
"}",
"public",
"has",
"(",
"item",
")",
"{",
"return",
"this",
".",
"_items",
"[",
"this",
".",
"getIdentifier",
"(",
"item",
")",
"]",
"!=",
"undefined",
";",
"}",
"public",
"get",
"items",
"(",
")",
":",
"T",
"[",
"]",
"{",
"return",
"Object",
".",
"keys",
"(",
"this",
".",
"_items",
")",
".",
"map",
"(",
"k",
"=>",
"this",
".",
"_items",
"[",
"k",
"]",
")",
";",
"}",
"public",
"equals",
"(",
"that",
")",
"{",
"return",
"(",
"this",
".",
"size",
"==",
"that",
".",
"size",
"&&",
"this",
".",
"items",
".",
"every",
"(",
"item",
"=>",
"that",
".",
"has",
"(",
"item",
")",
")",
")",
";",
"}",
"public",
"get",
"empty",
"(",
")",
":",
"boolean",
"{",
"return",
"Object",
".",
"keys",
"(",
"this",
".",
"_items",
")",
".",
"length",
"==",
"0",
";",
"}",
"public",
"union",
"(",
"...",
"those",
")",
"{",
"return",
"new",
"Set",
"(",
"this",
".",
"getIdentifier",
",",
"...",
"this",
".",
"items",
".",
"concat",
"(",
"...",
"those",
".",
"map",
"(",
"that",
"=>",
"that",
".",
"items",
")",
")",
")",
";",
"}",
"public",
"intersect",
"(",
"that",
")",
"{",
"return",
"new",
"Set",
"(",
"this",
".",
"getIdentifier",
",",
"...",
"this",
".",
"items",
".",
"filter",
"(",
"item",
"=>",
"that",
".",
"has",
"(",
"item",
")",
")",
")",
";",
"}",
"public",
"filter",
"(",
"predicate",
")",
"{",
"return",
"new",
"Set",
"(",
"this",
".",
"getIdentifier",
",",
"...",
"this",
".",
"items",
".",
"filter",
"(",
"predicate",
")",
")",
";",
"}",
"public",
"map",
"<",
"U",
">",
"(",
"getIdentifier",
",",
"transform",
")",
"{",
"return",
"new",
"Set",
"(",
"getIdentifier",
",",
"...",
"this",
".",
"items",
".",
"map",
"(",
"transform",
")",
")",
";",
"}",
"public",
"mapSame",
"(",
"transform",
")",
"{",
"return",
"new",
"Set",
"(",
"this",
".",
"getIdentifier",
",",
"...",
"this",
".",
"items",
".",
"map",
"(",
"transform",
")",
")",
";",
"}",
"public",
"some",
"(",
"predicate",
")",
"{",
"return",
"this",
".",
"items",
".",
"some",
"(",
"predicate",
")",
";",
"}",
"public",
"minus",
"(",
"that",
")",
"{",
"return",
"new",
"Set",
"(",
"this",
".",
"getIdentifier",
",",
"...",
"this",
".",
"items",
".",
"filter",
"(",
"x",
"=>",
"!",
"that",
".",
"has",
"(",
"x",
")",
")",
")",
";",
"}",
"public",
"take",
"(",
")",
"{",
"if",
"(",
"this",
".",
"empty",
")",
"{",
"throw",
"'cannot take from an empty set'",
";",
"}",
"const",
"first",
"=",
"parseInt",
"(",
"Object",
".",
"keys",
"(",
"this",
".",
"_items",
")",
"[",
"0",
"]",
")",
";",
"const",
"result",
"=",
"this",
".",
"_items",
"[",
"first",
"]",
";",
"this",
".",
"remove",
"(",
"result",
")",
";",
"return",
"result",
";",
"}",
"public",
"product",
"(",
"that",
")",
"{",
"return",
"new",
"Set",
"(",
"(",
"[",
"x",
",",
"y",
"]",
")",
"=>",
"this",
".",
"getIdentifier",
"(",
"x",
")",
"+",
"that",
".",
"getIdentifier",
"(",
"y",
")",
",",
"...",
"flatten",
"(",
"...",
"this",
".",
"items",
".",
"map",
"(",
"x",
"=>",
"flatten",
"(",
"that",
".",
"items",
".",
"map",
"<",
"[",
"T",
",",
"T",
"]",
">",
"(",
"y",
"=>",
"[",
"x",
",",
"y",
"]",
")",
")",
")",
")",
")",
";",
"}",
"}",
"export",
"class",
"StringSet",
"extends",
"Set",
"<",
"string",
">",
"{",
"constructor",
"(",
"...",
"items",
")",
"{",
"super",
"(",
"s",
"=>",
"s",
",",
"...",
"items",
")",
";",
"}",
"}",
"export",
"class",
"NumberSet",
"extends",
"Set",
"<",
"number",
">",
"{",
"constructor",
"(",
"...",
"items",
")",
"{",
"super",
"(",
"n",
"=>",
"n",
".",
"toString",
"(",
")",
",",
"...",
"items",
")",
";",
"}",
"}",
"export",
"function",
"range",
"(",
"min",
",",
"max",
")",
"{",
"const",
"numbers",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"min",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"numbers",
".",
"push",
"(",
"i",
")",
";",
"}",
"return",
"new",
"NumberSet",
"(",
"...",
"numbers",
")",
";",
"}",
"function",
"flatten",
"<",
"T",
">",
"(",
"...",
"items",
")",
"{",
"return",
"[",
"]",
".",
"concat",
"(",
"...",
"items",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
30,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
30,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
null,
null,
null,
2,
null,
89,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
30,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
30,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
3,
null,
3,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
144 | [
"import",
"*",
"as",
"builtins",
"from",
"\"./__builtins__.json\"",
";",
"import",
"*",
"as",
"random",
"from",
"\"./random.json\"",
";",
"import",
"*",
"as",
"matplotlib",
"from",
"\"./matplotlib.json\"",
";",
"import",
"*",
"as",
"pandas",
"from",
"\"./pandas.json\"",
";",
"import",
"*",
"as",
"sklearn",
"from",
"\"./sklearn.json\"",
";",
"import",
"*",
"as",
"numpy",
"from",
"\"./numpy.json\"",
";",
"export",
"interface",
"FunctionSpec",
"{",
"name",
":",
"string",
";",
"updates",
"?",
":",
"(",
"string",
"|",
"number",
")",
"[",
"]",
";",
"reads",
"?",
":",
"string",
"[",
"]",
";",
"returns",
"?",
":",
"string",
";",
"returnsType",
"?",
":",
"TypeSpec",
"<",
"FunctionSpec",
">",
";",
"higherorder",
"?",
":",
"number",
";",
"}",
"export",
"type",
"FunctionDescription",
"=",
"string",
"|",
"FunctionSpec",
";",
"export",
"interface",
"TypeSpec",
"<",
"FD",
">",
"{",
"methods",
"?",
":",
"FD",
"[",
"]",
";",
"}",
"export",
"interface",
"ModuleSpec",
"<",
"FD",
">",
"extends",
"TypeSpec",
"<",
"FD",
">",
"{",
"functions",
"?",
":",
"FD",
"[",
"]",
";",
"modules",
"?",
":",
"ModuleMap",
"<",
"FD",
">",
";",
"types",
"?",
":",
"{",
"[",
"typeName",
"]",
":",
"TypeSpec",
"<",
"FD",
">",
";",
"}",
";",
"}",
"export",
"interface",
"ModuleMap",
"<",
"FD",
">",
"{",
"[",
"moduleName",
"]",
":",
"ModuleSpec",
"<",
"FD",
">",
";",
"}",
"export",
"type",
"JsonSpecs",
"=",
"ModuleMap",
"<",
"FunctionDescription",
">",
";",
"export",
"const",
"DefaultSpecs",
"=",
"{",
"...",
"builtins",
",",
"...",
"random",
",",
"...",
"matplotlib",
",",
"...",
"pandas",
",",
"...",
"sklearn",
",",
"...",
"numpy",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
145 | [
"/**\n * Result of rewriting a magic line.\n */",
"export",
"type",
"Rewrite",
"=",
"{",
"text",
"?",
":",
"string",
";",
"annotations",
"?",
":",
"MagicAnnotation",
"[",
"]",
";",
"}",
";",
"/**\n * An annotation to hold metadata about what a magic is doing.\n */",
"export",
"type",
"MagicAnnotation",
"=",
"{",
"key",
":",
"string",
";",
"value",
":",
"string",
";",
"}",
";",
"/**\n * Position of a text match for magics.\n */",
"export",
"type",
"MatchPosition",
"=",
"[",
"{",
"line",
":",
"number",
";",
"col",
":",
"number",
";",
"}",
",",
"{",
"line",
":",
"number",
";",
"col",
":",
"number",
";",
"}",
"]",
";",
"/**\n * Interface for command-specific magic rewrites.\n */",
"export",
"interface",
"LineMagicRewriter",
"{",
"/**\n * Name of the magic command this will apply to.\n */",
"commandName",
":",
"string",
";",
"param",
"matchedText",
"param",
"magicStmt",
"param",
"postion",
"return",
"rewrite",
"(",
"matchedText",
",",
"magicStmt",
",",
"position",
")",
":",
"Rewrite",
";",
"}",
"/**\n * Utility to rewrite IPython code to remove magics.\n * Should be applied at to cells, not the entire program, to properly handle cell magics.\n * One of the most important aspects of the rewriter is that it shouldn't change the line number\n * of any of the statements in the program. If it does, this will make it impossible to\n * map back from the results of code analysis to the relevant code in the editor.\n */",
"export",
"class",
"MagicsRewriter",
"{",
"/**\n * Construct a magics rewriter.\n */",
"constructor",
"(",
"lineMagicRewriters",
"?",
")",
"{",
"this",
".",
"_lineMagicRewriters",
"=",
"lineMagicRewriters",
"||",
"this",
".",
"_defaultLineMagicRewriters",
";",
"}",
"/**\n * Rewrite code so that it doesn't contain magics.\n */",
"rewrite",
"(",
"text",
",",
"lineMagicRewriters",
"?",
")",
"{",
"text",
"=",
"this",
".",
"rewriteCellMagic",
"(",
"text",
")",
";",
"text",
"=",
"this",
".",
"rewriteLineMagic",
"(",
"text",
",",
"this",
".",
"_lineMagicRewriters",
")",
";",
"return",
"text",
";",
"}",
"/**\n * Default rewrite rule for cell magics.\n */",
"rewriteCellMagic",
"(",
"text",
")",
"{",
"if",
"(",
"text",
".",
"match",
"(",
"/^[^#\\s]*\\s*%%/gm",
")",
")",
"{",
"return",
"text",
".",
"split",
"(",
"'\\n'",
")",
".",
"map",
"(",
"l",
"=>",
"'##'",
"+",
"l",
")",
".",
"join",
"(",
"'\\n'",
")",
";",
"}",
"return",
"text",
";",
"}",
"/**\n * Default rewrite rule for line magics.\n */",
"rewriteLineMagic",
"(",
"text",
",",
"lineMagicRewriters",
"?",
")",
"{",
"let",
"lines",
"=",
"text",
".",
"split",
"(",
"'\\n'",
")",
";",
"let",
"lastLineStart",
"=",
"0",
";",
"let",
"lineStarts",
"=",
"lines",
".",
"map",
"(",
"(",
"line",
",",
"i",
")",
"=>",
"{",
"if",
"(",
"i",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"let",
"lineStart",
"=",
"lastLineStart",
"+",
"lines",
"[",
"i",
"-",
"1",
"]",
".",
"length",
"+",
"1",
";",
"lastLineStart",
"=",
"lineStart",
";",
"return",
"lineStart",
";",
"}",
")",
";",
"return",
"text",
".",
"replace",
"(",
"/^\\s*(%(?:\\\\\\s*\\n|[^\\n])+)/gm",
",",
"(",
"match",
",",
"magicStmt",
")",
"=>",
"{",
"let",
"startLine",
"=",
"-",
"1",
",",
"startCol",
"=",
"-",
"1",
";",
"let",
"endLine",
"=",
"-",
"1",
",",
"endCol",
"=",
"-",
"1",
";",
"let",
"offset",
"=",
"match",
".",
"length",
"-",
"magicStmt",
".",
"length",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"lineStarts",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"offset",
">=",
"lineStarts",
"[",
"i",
"]",
")",
"{",
"startLine",
"=",
"i",
";",
"startCol",
"=",
"offset",
"-",
"lineStarts",
"[",
"i",
"]",
";",
"}",
"if",
"(",
"offset",
"+",
"magicStmt",
".",
"length",
">=",
"lineStarts",
"[",
"i",
"]",
")",
"{",
"endLine",
"=",
"i",
";",
"endCol",
"=",
"offset",
"+",
"magicStmt",
".",
"length",
"-",
"lineStarts",
"[",
"i",
"]",
";",
"}",
"}",
"let",
"position",
"=",
"[",
"{",
"line",
":",
"startLine",
",",
"col",
":",
"startCol",
"}",
",",
"{",
"line",
":",
"endLine",
",",
"col",
":",
"endCol",
"}",
",",
"]",
";",
"let",
"magicStmtCleaned",
"=",
"magicStmt",
".",
"replace",
"(",
"/\\\\\\s*\\n/g",
",",
"''",
")",
";",
"let",
"commandMatch",
"=",
"magicStmtCleaned",
".",
"match",
"(",
"/^%(\\w+).*/",
")",
";",
"let",
"rewriteText",
";",
"let",
"annotations",
"=",
"[",
"]",
";",
"if",
"(",
"commandMatch",
"&&",
"commandMatch",
".",
"length",
">=",
"2",
")",
"{",
"let",
"command",
"=",
"commandMatch",
"[",
"1",
"]",
";",
"if",
"(",
"lineMagicRewriters",
")",
"{",
"for",
"(",
"let",
"lineMagicRewriter",
"of",
"lineMagicRewriters",
")",
"{",
"if",
"(",
"lineMagicRewriter",
".",
"commandName",
"==",
"command",
")",
"{",
"let",
"rewrite",
"=",
"lineMagicRewriter",
".",
"rewrite",
"(",
"match",
",",
"magicStmtCleaned",
",",
"position",
")",
";",
"if",
"(",
"rewrite",
".",
"text",
")",
"{",
"rewriteText",
"=",
"rewrite",
".",
"text",
";",
"}",
"if",
"(",
"rewrite",
".",
"annotations",
")",
"{",
"annotations",
"=",
"annotations",
".",
"concat",
"(",
"rewrite",
".",
"annotations",
")",
";",
"}",
"break",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"!",
"rewriteText",
")",
"{",
"rewriteText",
"=",
"match",
".",
"split",
"(",
"'\\n'",
")",
".",
"map",
"(",
"s",
"=>",
"'#'",
"+",
"s",
")",
".",
"join",
"(",
"'\\n'",
")",
";",
"}",
"for",
"(",
"let",
"annotation",
"of",
"annotations",
")",
"{",
"rewriteText",
"=",
"\"'''\"",
"+",
"annotation",
".",
"key",
"+",
"': '",
"+",
"annotation",
".",
"value",
"+",
"\"'''\"",
"+",
"' '",
"+",
"rewriteText",
";",
"}",
"return",
"rewriteText",
";",
"}",
")",
";",
"}",
"private",
"_lineMagicRewriters",
":",
"LineMagicRewriter",
"[",
"]",
";",
"private",
"_defaultLineMagicRewriters",
"=",
"[",
"new",
"TimeLineMagicRewriter",
"(",
")",
",",
"new",
"PylabLineMagicRewriter",
"(",
")",
",",
"]",
";",
"}",
"/**\n * Line magic rewriter for the \"time\" magic.\n */",
"export",
"class",
"TimeLineMagicRewriter",
"implements",
"LineMagicRewriter",
"{",
"commandName",
":",
"string",
"=",
"'time'",
";",
"rewrite",
"(",
"matchedText",
",",
"magicStmt",
",",
"position",
")",
"{",
"return",
"{",
"text",
":",
"matchedText",
".",
"replace",
"(",
"/^\\s*%time/",
",",
"match",
"=>",
"{",
"return",
"'\"'",
"+",
"' '",
".",
"repeat",
"(",
"match",
".",
"length",
"-",
"2",
")",
"+",
"'\"'",
";",
"}",
")",
",",
"}",
";",
"}",
"}",
"/**\n * Line magic rewriter for the \"pylab\" magic.\n */",
"export",
"class",
"PylabLineMagicRewriter",
"implements",
"LineMagicRewriter",
"{",
"commandName",
":",
"string",
"=",
"'pylab'",
";",
"rewrite",
"(",
"matchedText",
",",
"magicStmt",
",",
"position",
")",
"{",
"let",
"defData",
"=",
"[",
"'numpy'",
",",
"'matplotlib'",
",",
"'pylab'",
",",
"'mlab'",
",",
"'pyplot'",
",",
"'np'",
",",
"'plt'",
",",
"'display'",
",",
"'figsize'",
",",
"'getfigs'",
",",
"]",
".",
"map",
"(",
"symbolName",
"=>",
"{",
"return",
"{",
"name",
":",
"symbolName",
",",
"pos",
":",
"[",
"[",
"position",
"[",
"0",
"]",
".",
"line",
",",
"position",
"[",
"0",
"]",
".",
"col",
"]",
",",
"[",
"position",
"[",
"1",
"]",
".",
"line",
",",
"position",
"[",
"1",
"]",
".",
"col",
"]",
",",
"]",
",",
"}",
";",
"}",
")",
";",
"return",
"{",
"annotations",
":",
"[",
"{",
"key",
":",
"'defs'",
",",
"value",
":",
"JSON",
".",
"stringify",
"(",
"defData",
")",
"}",
"]",
",",
"}",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
2,
null,
2,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
2,
null,
2,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
146 | [
"import",
"{",
"Set",
"}",
"from",
"\".\"",
";",
"export",
"class",
"Graph",
"<",
"T",
">",
"{",
"private",
"outgoing",
"=",
"new",
"Map",
"<",
"T",
",",
"Set",
"<",
"T",
">",
">",
"(",
")",
";",
"private",
"incoming",
"=",
"new",
"Map",
"<",
"T",
",",
"Set",
"<",
"T",
">",
">",
"(",
")",
";",
"private",
"_nodes",
":",
"Set",
"<",
"T",
">",
";",
"constructor",
"(",
"private",
"getIdentifier",
")",
"{",
"this",
".",
"_nodes",
"=",
"new",
"Set",
"(",
"getIdentifier",
")",
";",
"}",
"public",
"addEdge",
"(",
"fromNode",
",",
"toNode",
")",
"{",
"this",
".",
"_nodes",
".",
"add",
"(",
"fromNode",
")",
";",
"this",
".",
"_nodes",
".",
"add",
"(",
"toNode",
")",
";",
"if",
"(",
"!",
"this",
".",
"outgoing",
".",
"has",
"(",
"fromNode",
")",
")",
"{",
"this",
".",
"outgoing",
".",
"set",
"(",
"fromNode",
",",
"new",
"Set",
"<",
"T",
">",
"(",
"this",
".",
"getIdentifier",
")",
")",
";",
"}",
"if",
"(",
"!",
"this",
".",
"incoming",
".",
"has",
"(",
"toNode",
")",
")",
"{",
"this",
".",
"incoming",
".",
"set",
"(",
"toNode",
",",
"new",
"Set",
"<",
"T",
">",
"(",
"this",
".",
"getIdentifier",
")",
")",
";",
"}",
"this",
".",
"outgoing",
".",
"get",
"(",
"fromNode",
")",
".",
"add",
"(",
"toNode",
")",
";",
"this",
".",
"incoming",
".",
"get",
"(",
"toNode",
")",
".",
"add",
"(",
"fromNode",
")",
";",
"}",
"public",
"get",
"nodes",
"(",
")",
"{",
"return",
"this",
".",
"_nodes",
".",
"items",
";",
"}",
"public",
"topoSort",
"(",
")",
"{",
"const",
"sorted",
"=",
"[",
"]",
";",
"const",
"work",
"=",
"new",
"Set",
"(",
"this",
".",
"getIdentifier",
",",
"...",
"this",
".",
"nodes",
".",
"filter",
"(",
"n",
"=>",
"!",
"this",
".",
"incoming",
".",
"has",
"(",
"n",
")",
")",
")",
";",
"while",
"(",
"!",
"work",
".",
"empty",
")",
"{",
"const",
"n",
"=",
"work",
".",
"pop",
"(",
")",
";",
"sorted",
".",
"push",
"(",
"n",
")",
";",
"if",
"(",
"this",
".",
"outgoing",
".",
"has",
"(",
"n",
")",
")",
"{",
"this",
".",
"outgoing",
".",
"get",
"(",
"n",
")",
".",
"items",
".",
"forEach",
"(",
"m",
"=>",
"{",
"this",
".",
"outgoing",
".",
"get",
"(",
"n",
")",
".",
"remove",
"(",
"m",
")",
";",
"this",
".",
"incoming",
".",
"get",
"(",
"m",
")",
".",
"remove",
"(",
"n",
")",
";",
"if",
"(",
"this",
".",
"incoming",
".",
"get",
"(",
"m",
")",
".",
"empty",
")",
"{",
"work",
".",
"add",
"(",
"m",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"return",
"sorted",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
11,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
30,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
11,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
147 | [
"import",
"{",
"Cell",
"}",
"from",
"'./cell'",
";",
"import",
"*",
"as",
"ast",
"from",
"'./python-parser'",
";",
"import",
"{",
"DataflowAnalyzer",
",",
"Ref",
",",
"RefSet",
"}",
"from",
"'./data-flow'",
";",
"import",
"{",
"MagicsRewriter",
"}",
"from",
"'./rewrite-magics'",
";",
"import",
"{",
"Set",
",",
"NumberSet",
",",
"StringSet",
"}",
"from",
"'./set'",
";",
"import",
"{",
"Graph",
"}",
"from",
"'./graph'",
";",
"/**\n * Maps to find out what line numbers over a program correspond to what cells.\n */",
"export",
"type",
"CellToLineMap",
"=",
"{",
"[",
"cellExecutionEventId",
"]",
":",
"NumberSet",
";",
"}",
";",
"export",
"type",
"LineToCellMap",
"=",
"{",
"[",
"line",
"]",
":",
"Cell",
";",
"}",
";",
"const",
"magicsRewriter",
"=",
"new",
"MagicsRewriter",
"(",
")",
";",
"/**\n * A program built from cells.\n */",
"export",
"class",
"Program",
"{",
"/**\n * Construct a program.\n */",
"constructor",
"(",
"cellPrograms",
")",
"{",
"let",
"currentLine",
"=",
"1",
";",
"this",
".",
"tree",
"=",
"{",
"code",
":",
"[",
"]",
",",
"type",
":",
"ast",
".",
"MODULE",
"}",
";",
"cellPrograms",
".",
"forEach",
"(",
"cp",
"=>",
"{",
"let",
"cell",
"=",
"cp",
".",
"cell",
";",
"let",
"cellLength",
"=",
"cell",
".",
"text",
".",
"split",
"(",
"'\\n'",
")",
".",
"length",
";",
"let",
"cellLines",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"l",
"=",
"0",
";",
"l",
"<",
"cellLength",
";",
"l",
"++",
")",
"{",
"cellLines",
".",
"push",
"(",
"currentLine",
"+",
"l",
")",
";",
"}",
"cellLines",
".",
"forEach",
"(",
"l",
"=>",
"{",
"this",
".",
"lineToCellMap",
"[",
"l",
"]",
"=",
"cell",
";",
"if",
"(",
"!",
"this",
".",
"cellToLineMap",
"[",
"cell",
".",
"executionEventId",
"]",
")",
"{",
"this",
".",
"cellToLineMap",
"[",
"cell",
".",
"executionEventId",
"]",
"=",
"new",
"NumberSet",
"(",
")",
";",
"}",
"this",
".",
"cellToLineMap",
"[",
"cell",
".",
"executionEventId",
"]",
".",
"add",
"(",
"l",
")",
";",
"}",
")",
";",
"currentLine",
"+=",
"cellLength",
";",
"this",
".",
"tree",
".",
"code",
".",
"push",
"(",
"...",
"shiftStatementLines",
"(",
"cp",
".",
"statements",
",",
"Math",
".",
"min",
"(",
"...",
"cellLines",
")",
"-",
"1",
")",
")",
";",
"}",
")",
";",
"this",
".",
"text",
"=",
"cellPrograms",
".",
"map",
"(",
"cp",
"=>",
"magicsRewriter",
".",
"rewrite",
"(",
"cp",
".",
"cell",
".",
"text",
"+",
"'\\n'",
")",
")",
".",
"join",
"(",
"''",
")",
";",
"}",
"readonly",
"text",
":",
"string",
";",
"readonly",
"tree",
":",
"ast",
".",
"Module",
";",
"readonly",
"cellToLineMap",
":",
"CellToLineMap",
"=",
"{",
"}",
";",
"readonly",
"lineToCellMap",
":",
"LineToCellMap",
"=",
"{",
"}",
";",
"}",
"function",
"shiftStatementLines",
"(",
"stmts",
",",
"delta",
")",
"{",
"return",
"stmts",
".",
"map",
"(",
"statement",
"=>",
"{",
"let",
"statementCopy",
"=",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"statement",
")",
")",
";",
"for",
"(",
"let",
"node",
"of",
"ast",
".",
"walk",
"(",
"statementCopy",
")",
")",
"{",
"if",
"(",
"node",
".",
"location",
")",
"{",
"node",
".",
"location",
"=",
"shiftLines",
"(",
"node",
".",
"location",
",",
"delta",
")",
";",
"}",
"if",
"(",
"node",
".",
"type",
"==",
"ast",
".",
"FOR",
")",
"{",
"node",
".",
"decl_location",
"=",
"shiftLines",
"(",
"node",
".",
"decl_location",
",",
"delta",
")",
";",
"}",
"}",
"return",
"statementCopy",
";",
"}",
")",
";",
"}",
"function",
"shiftLines",
"(",
"loc",
",",
"delta",
")",
"{",
"return",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"loc",
",",
"{",
"first_line",
":",
"loc",
".",
"first_line",
"+",
"delta",
",",
"first_column",
":",
"loc",
".",
"first_column",
",",
"last_line",
":",
"loc",
".",
"last_line",
"+",
"delta",
",",
"last_column",
":",
"loc",
".",
"last_column",
"}",
")",
";",
"}",
"/**\n * Program fragment for a cell. Used to cache parsing results.\n */",
"export",
"class",
"CellProgram",
"{",
"/**\n * Construct a cell program\n */",
"constructor",
"(",
"cell",
",",
"statements",
",",
"defs",
",",
"uses",
",",
"hasError",
")",
"{",
"this",
".",
"cell",
"=",
"cell",
";",
"this",
".",
"statements",
"=",
"statements",
";",
"this",
".",
"defs",
"=",
"defs",
";",
"this",
".",
"uses",
"=",
"uses",
";",
"this",
".",
"hasError",
"=",
"hasError",
";",
"}",
"readonly",
"cell",
":",
"Cell",
";",
"readonly",
"statements",
":",
"ast",
".",
"SyntaxNode",
"[",
"]",
";",
"readonly",
"defs",
":",
"Ref",
"[",
"]",
";",
"readonly",
"uses",
":",
"Ref",
"[",
"]",
";",
"readonly",
"hasError",
":",
"boolean",
";",
"public",
"usesSomethingFrom",
"(",
"that",
")",
"{",
"return",
"this",
".",
"uses",
".",
"some",
"(",
"use",
"=>",
"that",
".",
"defs",
".",
"some",
"(",
"def",
"=>",
"use",
".",
"name",
"===",
"def",
".",
"name",
")",
")",
";",
"}",
"}",
"/**\n * Builds programs from a list of executed cells.\n */",
"export",
"class",
"ProgramBuilder",
"{",
"/**\n * Construct a program builder.\n */",
"constructor",
"(",
"dataflowAnalyzer",
"?",
")",
"{",
"this",
".",
"_dataflowAnalyzer",
"=",
"dataflowAnalyzer",
";",
"this",
".",
"_cellPrograms",
"=",
"[",
"]",
";",
"}",
"/**\n * Add cells to the program builder.\n */",
"public",
"add",
"(",
"...",
"cells",
")",
"{",
"for",
"(",
"let",
"cell",
"of",
"cells",
")",
"{",
"let",
"statements",
"=",
"[",
"]",
";",
"let",
"defs",
"=",
"undefined",
";",
"let",
"uses",
"=",
"undefined",
";",
"let",
"hasError",
"=",
"cell",
".",
"hasError",
";",
"try",
"{",
"let",
"tree",
"=",
"ast",
".",
"parse",
"(",
"magicsRewriter",
".",
"rewrite",
"(",
"cell",
".",
"text",
")",
"+",
"'\\n'",
")",
";",
"statements",
"=",
"tree",
".",
"code",
";",
"for",
"(",
"let",
"node",
"of",
"ast",
".",
"walk",
"(",
"tree",
")",
")",
"{",
"if",
"(",
"node",
".",
"hasOwnProperty",
"(",
"'type'",
")",
")",
"{",
"node",
".",
"location",
".",
"path",
"=",
"cell",
".",
"executionEventId",
";",
"}",
"}",
"if",
"(",
"this",
".",
"_dataflowAnalyzer",
")",
"{",
"defs",
"=",
"[",
"]",
";",
"uses",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"stmt",
"of",
"tree",
".",
"code",
")",
"{",
"let",
"defsUses",
"=",
"this",
".",
"_dataflowAnalyzer",
".",
"getDefUseForStatement",
"(",
"stmt",
",",
"new",
"RefSet",
"(",
")",
")",
";",
"defs",
".",
"push",
"(",
"...",
"defsUses",
".",
"DEFINITION",
".",
"union",
"(",
"defsUses",
".",
"UPDATE",
")",
".",
"items",
")",
";",
"uses",
".",
"push",
"(",
"...",
"defsUses",
".",
"USE",
".",
"items",
")",
";",
"}",
"}",
"else",
"{",
"defs",
"=",
"[",
"]",
";",
"uses",
"=",
"[",
"]",
";",
"}",
"}",
"catch",
"(",
"e",
")",
"{",
"console",
".",
"log",
"(",
"\"Couldn't analyze block\"",
",",
"cell",
".",
"text",
",",
"', error encountered, '",
",",
"e",
",",
"', not adding to programs.'",
")",
";",
"hasError",
"=",
"true",
";",
"}",
"this",
".",
"_cellPrograms",
".",
"push",
"(",
"new",
"CellProgram",
"(",
"cell",
",",
"statements",
",",
"defs",
",",
"uses",
",",
"hasError",
")",
")",
";",
"}",
"}",
"/**\n * Reset (removing all cells).\n */",
"public",
"reset",
"(",
")",
"{",
"this",
".",
"_cellPrograms",
"=",
"[",
"]",
";",
"}",
"/**\n * Build a program from the list of cells. Program will include the cells' contents in\n * the order they were added to the log. It will omit cells that raised errors (syntax or\n * runtime, except for the last cell).\n */",
"public",
"buildTo",
"(",
"cellExecutionEventId",
")",
"{",
"let",
"cellPrograms",
"=",
"[",
"]",
";",
"let",
"i",
";",
"for",
"(",
"i",
"=",
"this",
".",
"_cellPrograms",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
"&&",
"this",
".",
"_cellPrograms",
"[",
"i",
"]",
".",
"cell",
".",
"executionEventId",
"!==",
"cellExecutionEventId",
";",
"i",
"--",
")",
";",
"cellPrograms",
".",
"unshift",
"(",
"this",
".",
"_cellPrograms",
"[",
"i",
"]",
")",
";",
"let",
"lastExecutionCountSeen",
"=",
"this",
".",
"_cellPrograms",
"[",
"i",
"]",
".",
"cell",
".",
"executionCount",
";",
"for",
"(",
"i",
"--",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"let",
"cellProgram",
"=",
"this",
".",
"_cellPrograms",
"[",
"i",
"]",
";",
"let",
"cell",
"=",
"cellProgram",
".",
"cell",
";",
"if",
"(",
"cell",
".",
"executionCount",
">=",
"lastExecutionCountSeen",
")",
"{",
"break",
";",
"}",
"if",
"(",
"!",
"cellProgram",
".",
"hasError",
")",
"{",
"cellPrograms",
".",
"unshift",
"(",
"cellProgram",
")",
";",
"}",
"lastExecutionCountSeen",
"=",
"cell",
".",
"executionCount",
";",
"}",
"return",
"new",
"Program",
"(",
"cellPrograms",
")",
";",
"}",
"public",
"buildFrom",
"(",
"executionEventId",
")",
"{",
"const",
"cellProgram",
"=",
"this",
".",
"getCellProgram",
"(",
"executionEventId",
")",
";",
"if",
"(",
"!",
"cellProgram",
")",
"{",
"return",
"null",
";",
"}",
"const",
"i",
"=",
"this",
".",
"_cellPrograms",
".",
"findIndex",
"(",
"cp",
"=>",
"cp",
".",
"cell",
".",
"persistentId",
"===",
"cellProgram",
".",
"cell",
".",
"persistentId",
")",
";",
"return",
"new",
"Program",
"(",
"this",
".",
"_cellPrograms",
".",
"slice",
"(",
"i",
")",
")",
";",
"}",
"public",
"getCellProgram",
"(",
"executionEventId",
")",
"{",
"let",
"matchingPrograms",
"=",
"this",
".",
"_cellPrograms",
".",
"filter",
"(",
"cp",
"=>",
"cp",
".",
"cell",
".",
"executionEventId",
"==",
"executionEventId",
")",
";",
"if",
"(",
"matchingPrograms",
".",
"length",
">=",
"1",
")",
"{",
"return",
"matchingPrograms",
".",
"pop",
"(",
")",
";",
"}",
"return",
"null",
";",
"}",
"public",
"getCellProgramsWithSameId",
"(",
"executionEventId",
")",
"{",
"const",
"cellProgram",
"=",
"this",
".",
"getCellProgram",
"(",
"executionEventId",
")",
";",
"return",
"this",
".",
"_cellPrograms",
".",
"filter",
"(",
"cp",
"=>",
"cp",
".",
"cell",
".",
"persistentId",
"===",
"cellProgram",
".",
"cell",
".",
"persistentId",
")",
";",
"}",
"private",
"_cellPrograms",
":",
"CellProgram",
"[",
"]",
";",
"private",
"_dataflowAnalyzer",
":",
"DataflowAnalyzer",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
5,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4669,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
0,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
352,
null,
5,
null,
5,
null,
5,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27926,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
37594,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
361,
null,
2,
null,
null,
null,
5,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
361,
null,
2,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
2,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
148 | [
"import",
"{",
"Cell",
"}",
"from",
"'./cell'",
";",
"import",
"{",
"CellSlice",
"}",
"from",
"'./cellslice'",
";",
"import",
"{",
"DataflowAnalyzer",
"}",
"from",
"'./data-flow'",
";",
"import",
"{",
"CellProgram",
",",
"ProgramBuilder",
"}",
"from",
"'./program-builder'",
";",
"import",
"{",
"LocationSet",
",",
"slice",
",",
"SliceDirection",
"}",
"from",
"'./slice'",
";",
"import",
"{",
"Set",
",",
"NumberSet",
"}",
"from",
"'./set'",
";",
"/**\n * A record of when a cell was executed.\n */",
"export",
"class",
"CellExecution",
"<",
"TCell",
"extends",
"Cell",
">",
"{",
"readonly",
"cell",
":",
"TCell",
";",
"readonly",
"executionTime",
":",
"Date",
";",
"constructor",
"(",
"cell",
",",
"executionTime",
")",
"{",
"this",
".",
"cell",
"=",
"cell",
";",
"this",
".",
"executionTime",
"=",
"executionTime",
";",
"}",
"/**\n * Update this method if at some point we only want to save some about a CellExecution when\n * serializing it and saving history.\n */",
"toJSON",
"(",
")",
"{",
"return",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"this",
")",
")",
";",
"}",
"}",
"/**\n * A slice over a version of executed code.\n */",
"export",
"class",
"SlicedExecution",
"{",
"constructor",
"(",
"public",
"executionTime",
",",
"public",
"cellSlices",
")",
"{",
"}",
"merge",
"(",
"...",
"slicedExecutions",
")",
"{",
"let",
"cellSlices",
"=",
"{",
"}",
";",
"let",
"mergedCellSlices",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"slicedExecution",
"of",
"slicedExecutions",
".",
"concat",
"(",
"this",
")",
")",
"{",
"for",
"(",
"let",
"cellSlice",
"of",
"slicedExecution",
".",
"cellSlices",
")",
"{",
"let",
"cell",
"=",
"cellSlice",
".",
"cell",
";",
"if",
"(",
"!",
"cellSlices",
"[",
"cell",
".",
"executionEventId",
"]",
")",
"{",
"let",
"newCellSlice",
"=",
"new",
"CellSlice",
"(",
"cell",
".",
"deepCopy",
"(",
")",
",",
"new",
"LocationSet",
"(",
")",
",",
"cellSlice",
".",
"executionTime",
")",
";",
"cellSlices",
"[",
"cell",
".",
"executionEventId",
"]",
"=",
"newCellSlice",
";",
"mergedCellSlices",
".",
"push",
"(",
"newCellSlice",
")",
";",
"}",
"let",
"mergedCellSlice",
"=",
"cellSlices",
"[",
"cell",
".",
"executionEventId",
"]",
";",
"mergedCellSlice",
".",
"slice",
"=",
"mergedCellSlice",
".",
"slice",
".",
"union",
"(",
"cellSlice",
".",
"slice",
")",
";",
"}",
"}",
"return",
"new",
"SlicedExecution",
"(",
"new",
"Date",
"(",
")",
",",
"mergedCellSlices",
".",
"sort",
"(",
"(",
"a",
",",
"b",
")",
"=>",
"a",
".",
"cell",
".",
"executionCount",
"-",
"b",
".",
"cell",
".",
"executionCount",
")",
")",
";",
"}",
"}",
"export",
"type",
"CellExecutionCallback",
"<",
"TCell",
"extends",
"Cell",
">",
"=",
"(",
"exec",
":",
"CellExecution",
"<",
"TCell",
">",
")",
"=>",
"void",
";",
"/**\n * Makes slice on a log of executed cells.\n */",
"export",
"class",
"ExecutionLogSlicer",
"<",
"TCell",
"extends",
"Cell",
">",
"{",
"public",
"executionLog",
":",
"CellExecution",
"<",
"TCell",
">",
"[",
"]",
"=",
"[",
"]",
";",
"public",
"readonly",
"programBuilder",
":",
"ProgramBuilder",
";",
"/**\n * Signal emitted when a cell's execution has been completely processed.\n */",
"readonly",
"executionLogged",
":",
"CellExecutionCallback",
"<",
"TCell",
">",
"[",
"]",
"=",
"[",
"]",
";",
"/**\n * Construct a new execution log slicer.\n */",
"constructor",
"(",
"private",
"dataflowAnalyzer",
")",
"{",
"this",
".",
"programBuilder",
"=",
"new",
"ProgramBuilder",
"(",
"dataflowAnalyzer",
")",
";",
"}",
"/**\n * Log that a cell has just been executed. The execution time for this cell will be stored\n * as the moment at which this method is called.\n */",
"public",
"logExecution",
"(",
"cell",
")",
"{",
"let",
"cellExecution",
"=",
"new",
"CellExecution",
"<",
"TCell",
">",
"(",
"cell",
",",
"new",
"Date",
"(",
")",
")",
";",
"this",
".",
"addExecutionToLog",
"(",
"cellExecution",
")",
";",
"}",
"/**\n * Use logExecution instead if a cell has just been run to annotate it with the current time\n * as the execution time. This function is intended to be used only to initialize history\n * when a notebook is reloaded. However, any method that eventually calls this method will\n * notify all observers that this cell has been executed.\n */",
"public",
"addExecutionToLog",
"(",
"cellExecution",
")",
"{",
"this",
".",
"programBuilder",
".",
"add",
"(",
"cellExecution",
".",
"cell",
")",
";",
"this",
".",
"executionLog",
".",
"push",
"(",
"cellExecution",
")",
";",
"this",
".",
"executionLogged",
".",
"forEach",
"(",
"callback",
"=>",
"callback",
"(",
"cellExecution",
")",
")",
";",
"}",
"/**\n * Reset the log, removing log records.\n */",
"public",
"reset",
"(",
")",
"{",
"this",
".",
"executionLog",
"=",
"[",
"]",
";",
"this",
".",
"programBuilder",
".",
"reset",
"(",
")",
";",
"}",
"/**\n * Get slice for the latest execution of a cell.\n */",
"public",
"sliceLatestExecution",
"(",
"cellId",
",",
"seedLocations",
"?",
")",
"{",
"return",
"this",
".",
"sliceAllExecutions",
"(",
"cellId",
",",
"seedLocations",
")",
".",
"pop",
"(",
")",
";",
"}",
"/**\n * Get slices of the necessary code for all executions of a cell.\n * Relevant line numbers are relative to the cell's start line (starting at first line = 0).\n */",
"public",
"sliceAllExecutions",
"(",
"cellId",
",",
"seedLocations",
"?",
")",
"{",
"const",
"cellExecutionTimes",
"=",
"new",
"Map",
"(",
"this",
".",
"executionLog",
".",
"map",
"(",
"e",
"=>",
"[",
"e",
".",
"cell",
".",
"executionEventId",
",",
"e",
".",
"executionTime",
"]",
")",
")",
";",
"return",
"this",
".",
"executionLog",
".",
"filter",
"(",
"execution",
"=>",
"execution",
".",
"cell",
".",
"persistentId",
"==",
"cellId",
"&&",
"execution",
".",
"cell",
".",
"executionCount",
")",
".",
"map",
"(",
"execution",
"=>",
"{",
"let",
"program",
"=",
"this",
".",
"programBuilder",
".",
"buildTo",
"(",
"execution",
".",
"cell",
".",
"executionEventId",
")",
";",
"if",
"(",
"!",
"program",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"seedLocations",
")",
"{",
"seedLocations",
"=",
"new",
"LocationSet",
"(",
"{",
"first_line",
":",
"1",
",",
"first_column",
":",
"1",
",",
"last_line",
":",
"10000",
",",
"last_column",
":",
"10000",
",",
"}",
")",
";",
"}",
"let",
"lastCellLines",
"=",
"program",
".",
"cellToLineMap",
"[",
"execution",
".",
"cell",
".",
"executionEventId",
"]",
";",
"let",
"lastCellStart",
"=",
"Math",
".",
"min",
"(",
"...",
"lastCellLines",
".",
"items",
")",
";",
"seedLocations",
"=",
"seedLocations",
".",
"mapSame",
"(",
"loc",
"=>",
"(",
"{",
"first_line",
":",
"lastCellStart",
"+",
"loc",
".",
"first_line",
"-",
"1",
",",
"first_column",
":",
"loc",
".",
"first_column",
",",
"last_line",
":",
"lastCellStart",
"+",
"loc",
".",
"last_line",
"-",
"1",
",",
"last_column",
":",
"loc",
".",
"last_column",
",",
"}",
")",
")",
";",
"let",
"sliceLocations",
"=",
"slice",
"(",
"program",
".",
"tree",
",",
"seedLocations",
",",
"this",
".",
"dataflowAnalyzer",
")",
".",
"items",
".",
"sort",
"(",
"(",
"loc1",
",",
"loc2",
")",
"=>",
"loc1",
".",
"first_line",
"-",
"loc2",
".",
"first_line",
")",
";",
"let",
"cellSliceLocations",
"=",
"{",
"}",
";",
"let",
"cellOrder",
"=",
"[",
"]",
";",
"sliceLocations",
".",
"forEach",
"(",
"location",
"=>",
"{",
"let",
"sliceCell",
"=",
"program",
".",
"lineToCellMap",
"[",
"location",
".",
"first_line",
"]",
";",
"let",
"sliceCellLines",
"=",
"program",
".",
"cellToLineMap",
"[",
"sliceCell",
".",
"executionEventId",
"]",
";",
"let",
"sliceCellStart",
"=",
"Math",
".",
"min",
"(",
"...",
"sliceCellLines",
".",
"items",
")",
";",
"if",
"(",
"cellOrder",
".",
"indexOf",
"(",
"sliceCell",
")",
"==",
"-",
"1",
")",
"{",
"cellOrder",
".",
"push",
"(",
"sliceCell",
")",
";",
"}",
"let",
"adjustedLocation",
"=",
"{",
"first_line",
":",
"location",
".",
"first_line",
"-",
"sliceCellStart",
"+",
"1",
",",
"first_column",
":",
"location",
".",
"first_column",
",",
"last_line",
":",
"location",
".",
"last_line",
"-",
"sliceCellStart",
"+",
"1",
",",
"last_column",
":",
"location",
".",
"last_column",
",",
"}",
";",
"if",
"(",
"!",
"cellSliceLocations",
"[",
"sliceCell",
".",
"executionEventId",
"]",
")",
"{",
"cellSliceLocations",
"[",
"sliceCell",
".",
"executionEventId",
"]",
"=",
"new",
"LocationSet",
"(",
")",
";",
"}",
"cellSliceLocations",
"[",
"sliceCell",
".",
"executionEventId",
"]",
".",
"add",
"(",
"adjustedLocation",
")",
";",
"}",
")",
";",
"let",
"cellSlices",
"=",
"cellOrder",
".",
"map",
"(",
"sliceCell",
"=>",
"new",
"CellSlice",
"(",
"sliceCell",
",",
"cellSliceLocations",
"[",
"sliceCell",
".",
"executionEventId",
"]",
",",
"cellExecutionTimes",
"[",
"sliceCell",
".",
"executionEventId",
"]",
")",
")",
";",
"return",
"new",
"SlicedExecution",
"(",
"execution",
".",
"executionTime",
",",
"cellSlices",
")",
";",
"}",
")",
".",
"filter",
"(",
"s",
"=>",
"s",
"!=",
"null",
"&&",
"s",
"!=",
"undefined",
")",
";",
"}",
"public",
"get",
"cellExecutions",
"(",
")",
":",
"ReadonlyArray",
"<",
"CellExecution",
"<",
"TCell",
">",
">",
"{",
"return",
"this",
".",
"executionLog",
";",
"}",
"/**\n * Get the cell program (tree, defs, uses) for a cell.\n */",
"public",
"getCellProgram",
"(",
"executionEventId",
")",
"{",
"return",
"this",
".",
"programBuilder",
".",
"getCellProgram",
"(",
"executionEventId",
")",
";",
"}",
"param",
"executionEventId",
"public",
"getDependentCells",
"(",
"executionEventId",
")",
"{",
"const",
"program",
"=",
"this",
".",
"programBuilder",
".",
"buildFrom",
"(",
"executionEventId",
")",
";",
"const",
"sameCell",
"=",
"this",
".",
"programBuilder",
".",
"getCellProgramsWithSameId",
"(",
"executionEventId",
")",
";",
"let",
"lines",
"=",
"new",
"NumberSet",
"(",
")",
";",
"sameCell",
".",
"forEach",
"(",
"cp",
"=>",
"lines",
"=",
"lines",
".",
"union",
"(",
"program",
".",
"cellToLineMap",
"[",
"cp",
".",
"cell",
".",
"executionEventId",
"]",
")",
")",
";",
"const",
"seedLocations",
"=",
"new",
"LocationSet",
"(",
"...",
"lines",
".",
"items",
".",
"map",
"(",
"line",
"=>",
"(",
"{",
"first_line",
":",
"line",
",",
"first_column",
":",
"0",
",",
"last_line",
":",
"line",
",",
"last_column",
":",
"1",
"}",
")",
")",
")",
";",
"let",
"sliceLocations",
"=",
"slice",
"(",
"program",
".",
"tree",
",",
"seedLocations",
",",
"undefined",
",",
"SliceDirection",
".",
"Forward",
")",
".",
"items",
";",
"return",
"new",
"Set",
"<",
"Cell",
">",
"(",
"c",
"=>",
"c",
".",
"persistentId",
",",
"...",
"sliceLocations",
".",
"map",
"(",
"loc",
"=>",
"program",
".",
"lineToCellMap",
"[",
"loc",
".",
"first_line",
"]",
")",
")",
".",
"items",
".",
"filter",
"(",
"c",
"=>",
"c",
".",
"executionEventId",
"!==",
"executionEventId",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
26,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
26,
null,
null,
5,
null,
null,
null,
17960,
null,
null,
5,
null,
null,
null,
6,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27926,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
0,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
2,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
2,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
361,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
163,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
2,
null,
null,
null,
361,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
46475,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
352,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
149 | [
"import",
"{",
"FunctionDescription",
",",
"FunctionSpec",
",",
"TypeSpec",
",",
"ModuleSpec",
",",
"ModuleMap",
",",
"JsonSpecs",
"}",
"from",
"\".\"",
";",
"import",
"*",
"as",
"ast",
"from",
"'./python-parser'",
";",
"function",
"mapDict",
"<",
"U",
",",
"V",
">",
"(",
"obj",
",",
"f",
")",
"{",
"const",
"result",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"obj",
")",
".",
"forEach",
"(",
"k",
"=>",
"result",
"[",
"k",
"]",
"=",
"f",
"(",
"obj",
"[",
"k",
"]",
")",
")",
";",
"return",
"result",
";",
"}",
"function",
"cleanFunc",
"(",
"fdesc",
")",
"{",
"if",
"(",
"typeof",
"fdesc",
"===",
"'string'",
")",
"{",
"return",
"{",
"name",
":",
"fdesc",
",",
"reads",
":",
"[",
"]",
",",
"updates",
":",
"[",
"]",
"}",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"fdesc",
".",
"reads",
")",
"{",
"fdesc",
".",
"reads",
"=",
"[",
"]",
";",
"}",
"if",
"(",
"!",
"fdesc",
".",
"updates",
")",
"{",
"fdesc",
".",
"updates",
"=",
"[",
"]",
";",
"}",
"return",
"fdesc",
";",
"}",
"}",
"function",
"cleanType",
"(",
"tdesc",
")",
"{",
"return",
"{",
"methods",
":",
"tdesc",
".",
"methods",
"?",
"tdesc",
".",
"methods",
".",
"map",
"(",
"m",
"=>",
"cleanFunc",
"(",
"m",
")",
")",
":",
"[",
"]",
"}",
";",
"}",
"function",
"cleanModule",
"(",
"mdesc",
")",
"{",
"const",
"mod",
"=",
"{",
"functions",
":",
"mdesc",
".",
"functions",
"?",
"mdesc",
".",
"functions",
".",
"map",
"(",
"f",
"=>",
"cleanFunc",
"(",
"f",
")",
")",
":",
"[",
"]",
",",
"types",
":",
"mdesc",
".",
"types",
"?",
"mapDict",
"(",
"mdesc",
".",
"types",
",",
"cleanType",
")",
":",
"{",
"}",
",",
"modules",
":",
"mdesc",
".",
"modules",
"?",
"mapDict",
"(",
"mdesc",
".",
"modules",
",",
"cleanModule",
")",
":",
"{",
"}",
"}",
";",
"mod",
".",
"functions",
".",
"forEach",
"(",
"f",
"=>",
"{",
"if",
"(",
"f",
".",
"returns",
")",
"{",
"f",
".",
"returnsType",
"=",
"mod",
".",
"types",
"[",
"f",
".",
"returns",
"]",
";",
"}",
"}",
")",
";",
"Object",
".",
"keys",
"(",
"mod",
".",
"types",
")",
".",
"forEach",
"(",
"typename",
"=>",
"{",
"const",
"ty",
"=",
"mod",
".",
"types",
"[",
"typename",
"]",
";",
"ty",
".",
"methods",
".",
"forEach",
"(",
"f",
"=>",
"{",
"if",
"(",
"f",
".",
"returns",
")",
"{",
"f",
".",
"returnsType",
"=",
"mod",
".",
"types",
"[",
"f",
".",
"returns",
"]",
";",
"}",
"}",
")",
";",
"}",
")",
";",
"return",
"mod",
";",
"}",
"export",
"class",
"SymbolTable",
"{",
"public",
"modules",
":",
"ModuleMap",
"<",
"FunctionSpec",
">",
"=",
"{",
"}",
";",
"public",
"types",
":",
"{",
"[",
"name",
"]",
":",
"TypeSpec",
"<",
"FunctionSpec",
">",
";",
"}",
"=",
"{",
"}",
";",
"public",
"functions",
":",
"{",
"[",
"name",
"]",
":",
"FunctionSpec",
";",
"}",
"=",
"{",
"}",
";",
"constructor",
"(",
"private",
"jsonSpecs",
")",
"{",
"this",
".",
"importModuleDefinitions",
"(",
"'__builtins__'",
",",
"[",
"{",
"path",
":",
"'*'",
",",
"name",
":",
"''",
"}",
"]",
")",
";",
"}",
"public",
"lookupFunction",
"(",
"name",
")",
"{",
"const",
"spec",
"=",
"this",
".",
"functions",
"[",
"name",
"]",
";",
"if",
"(",
"spec",
")",
"{",
"return",
"spec",
";",
"}",
"const",
"clss",
"=",
"this",
".",
"types",
"[",
"name",
"]",
";",
"if",
"(",
"clss",
")",
"{",
"return",
"clss",
".",
"methods",
".",
"find",
"(",
"fn",
"=>",
"fn",
".",
"name",
"===",
"'__init__'",
")",
"||",
"{",
"name",
":",
"'__init__'",
",",
"updates",
":",
"[",
"'0'",
"]",
",",
"returns",
":",
"name",
",",
"returnsType",
":",
"clss",
"}",
";",
"}",
"return",
"undefined",
";",
"}",
"public",
"lookupNode",
"(",
"func",
")",
"{",
"return",
"func",
".",
"type",
"===",
"ast",
".",
"NAME",
"?",
"this",
".",
"lookupFunction",
"(",
"func",
".",
"id",
")",
":",
"func",
".",
"type",
"===",
"ast",
".",
"DOT",
"&&",
"func",
".",
"value",
".",
"type",
"===",
"ast",
".",
"NAME",
"?",
"this",
".",
"lookupModuleFunction",
"(",
"func",
".",
"value",
".",
"id",
",",
"func",
".",
"name",
")",
":",
"undefined",
";",
"}",
"public",
"lookupModuleFunction",
"(",
"modName",
",",
"funcName",
")",
"{",
"const",
"mod",
"=",
"this",
".",
"modules",
"[",
"modName",
"]",
";",
"return",
"mod",
"?",
"mod",
".",
"functions",
".",
"find",
"(",
"f",
"=>",
"f",
".",
"name",
"===",
"funcName",
")",
":",
"undefined",
";",
"}",
"public",
"importModule",
"(",
"modulePath",
",",
"alias",
")",
"{",
"const",
"spec",
"=",
"this",
".",
"lookupSpec",
"(",
"this",
".",
"jsonSpecs",
",",
"modulePath",
".",
"split",
"(",
"'.'",
")",
")",
";",
"if",
"(",
"!",
"spec",
")",
"{",
"console",
".",
"log",
"(",
"`*** WARNING no spec for module ${",
"modulePath",
"}`",
")",
";",
"return",
";",
"}",
"if",
"(",
"modulePath",
")",
"{",
"this",
".",
"modules",
"[",
"modulePath",
"]",
"=",
"spec",
";",
"if",
"(",
"alias",
"&&",
"alias",
".",
"length",
")",
"{",
"this",
".",
"modules",
"[",
"alias",
"]",
"=",
"spec",
";",
"}",
"}",
"}",
"public",
"importModuleDefinitions",
"(",
"namePath",
",",
"imports",
")",
"{",
"const",
"spec",
"=",
"this",
".",
"lookupSpec",
"(",
"this",
".",
"jsonSpecs",
",",
"namePath",
".",
"split",
"(",
"'.'",
")",
")",
";",
"if",
"(",
"!",
"spec",
")",
"{",
"console",
".",
"log",
"(",
"`*** WARNING no spec for module ${",
"namePath",
"}`",
")",
";",
"return",
";",
"}",
"if",
"(",
"spec",
")",
"{",
"imports",
".",
"forEach",
"(",
"imp",
"=>",
"{",
"const",
"funs",
"=",
"spec",
".",
"functions",
"?",
"spec",
".",
"functions",
".",
"map",
"(",
"f",
"=>",
"cleanFunc",
"(",
"f",
")",
")",
":",
"[",
"]",
";",
"if",
"(",
"imp",
".",
"path",
"===",
"'*'",
")",
"{",
"funs",
".",
"forEach",
"(",
"f",
"=>",
"this",
".",
"functions",
"[",
"f",
".",
"name",
"]",
"=",
"f",
")",
";",
"if",
"(",
"spec",
".",
"types",
")",
"{",
"Object",
".",
"keys",
"(",
"spec",
".",
"types",
")",
".",
"forEach",
"(",
"fname",
"=>",
"this",
".",
"types",
"[",
"fname",
"]",
"=",
"spec",
".",
"types",
"[",
"fname",
"]",
")",
";",
"}",
"}",
"else",
"if",
"(",
"spec",
".",
"types",
"&&",
"spec",
".",
"types",
"[",
"imp",
".",
"name",
"]",
")",
"{",
"this",
".",
"types",
"[",
"imp",
".",
"name",
"]",
"=",
"spec",
".",
"types",
"[",
"imp",
".",
"name",
"]",
";",
"}",
"else",
"{",
"const",
"fspec",
"=",
"funs",
".",
"find",
"(",
"f",
"=>",
"f",
".",
"name",
"===",
"imp",
".",
"name",
")",
";",
"if",
"(",
"fspec",
")",
"{",
"this",
".",
"functions",
"[",
"fspec",
".",
"name",
"]",
"=",
"fspec",
";",
"}",
"}",
"}",
")",
";",
"}",
"else",
"{",
"console",
".",
"log",
"(",
"`*** WARNING no spec for module ${",
"namePath",
"}`",
")",
";",
"}",
"}",
"private",
"lookupSpec",
"(",
"map",
",",
"parts",
")",
"{",
"if",
"(",
"!",
"map",
"||",
"parts",
".",
"length",
"==",
"0",
")",
"{",
"return",
"undefined",
";",
"}",
"const",
"spec",
"=",
"map",
"[",
"parts",
"[",
"0",
"]",
"]",
";",
"if",
"(",
"!",
"spec",
")",
"{",
"return",
"undefined",
";",
"}",
"if",
"(",
"parts",
".",
"length",
">",
"1",
")",
"{",
"return",
"this",
".",
"lookupSpec",
"(",
"spec",
".",
"modules",
",",
"parts",
".",
"slice",
"(",
"1",
")",
")",
";",
"}",
"else",
"{",
"return",
"cleanModule",
"(",
"spec",
")",
";",
"}",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
6,
null,
215,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13907,
null,
13907,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
42365,
null,
42365,
null,
null,
null,
42365,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13907,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4669,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
42365,
null,
2,
null,
2,
null,
null,
null,
42365,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
42365,
null,
2,
null,
5,
null,
null,
null,
42365,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
42365,
null,
0,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
150 | [
"import",
"*",
"as",
"ast",
"from",
"'./python-parser'",
";",
"import",
"{",
"Block",
",",
"ControlFlowGraph",
"}",
"from",
"'./control-flow'",
";",
"import",
"{",
"Set",
",",
"StringSet",
"}",
"from",
"'./set'",
";",
"import",
"{",
"DefaultSpecs",
",",
"JsonSpecs",
",",
"FunctionSpec",
",",
"TypeSpec",
"}",
"from",
"'./specs'",
";",
"import",
"{",
"SymbolTable",
"}",
"from",
"'./symbol-table'",
";",
"class",
"DefUse",
"{",
"constructor",
"(",
"public",
"DEFINITION",
"=",
"new",
"RefSet",
"(",
")",
",",
"public",
"UPDATE",
"=",
"new",
"RefSet",
"(",
")",
",",
"public",
"USE",
"=",
"new",
"RefSet",
"(",
")",
")",
"{",
"}",
"public",
"get",
"defs",
"(",
")",
"{",
"return",
"this",
".",
"DEFINITION",
".",
"union",
"(",
"this",
".",
"UPDATE",
")",
";",
"}",
"public",
"get",
"uses",
"(",
")",
"{",
"return",
"this",
".",
"UPDATE",
".",
"union",
"(",
"this",
".",
"USE",
")",
";",
"}",
"public",
"union",
"(",
"that",
")",
"{",
"return",
"new",
"DefUse",
"(",
"this",
".",
"DEFINITION",
".",
"union",
"(",
"that",
".",
"DEFINITION",
")",
",",
"this",
".",
"UPDATE",
".",
"union",
"(",
"that",
".",
"UPDATE",
")",
",",
"this",
".",
"USE",
".",
"union",
"(",
"that",
".",
"USE",
")",
")",
";",
"}",
"public",
"update",
"(",
"newRefs",
")",
"{",
"const",
"GEN_RULES",
"=",
"{",
"USE",
":",
"[",
"ReferenceType",
".",
"UPDATE",
",",
"ReferenceType",
".",
"DEFINITION",
"]",
",",
"UPDATE",
":",
"[",
"ReferenceType",
".",
"DEFINITION",
"]",
",",
"DEFINITION",
":",
"[",
"]",
"}",
";",
"const",
"KILL_RULES",
"=",
"{",
"DEFINITION",
":",
"[",
"ReferenceType",
".",
"DEFINITION",
",",
"ReferenceType",
".",
"UPDATE",
"]",
",",
"UPDATE",
":",
"[",
"ReferenceType",
".",
"DEFINITION",
",",
"ReferenceType",
".",
"UPDATE",
"]",
",",
"USE",
":",
"[",
"]",
"}",
";",
"for",
"(",
"let",
"level",
"of",
"Object",
".",
"keys",
"(",
"ReferenceType",
")",
")",
"{",
"let",
"genSet",
"=",
"new",
"RefSet",
"(",
")",
";",
"for",
"(",
"let",
"genLevel",
"of",
"GEN_RULES",
"[",
"level",
"]",
")",
"{",
"genSet",
"=",
"genSet",
".",
"union",
"(",
"newRefs",
"[",
"genLevel",
"]",
")",
";",
"}",
"const",
"killSet",
"=",
"this",
"[",
"level",
"]",
".",
"filter",
"(",
"def",
"=>",
"genSet",
".",
"items",
".",
"some",
"(",
"gen",
"=>",
"gen",
".",
"name",
"==",
"def",
".",
"name",
"&&",
"KILL_RULES",
"[",
"gen",
".",
"level",
"]",
".",
"indexOf",
"(",
"def",
".",
"level",
")",
"!=",
"-",
"1",
")",
")",
";",
"this",
"[",
"level",
"]",
"=",
"this",
"[",
"level",
"]",
".",
"minus",
"(",
"killSet",
")",
".",
"union",
"(",
"genSet",
")",
";",
"}",
"}",
"public",
"equals",
"(",
"that",
")",
"{",
"return",
"this",
".",
"DEFINITION",
".",
"equals",
"(",
"that",
".",
"DEFINITION",
")",
"&&",
"this",
".",
"UPDATE",
".",
"equals",
"(",
"that",
".",
"UPDATE",
")",
"&&",
"this",
".",
"USE",
".",
"equals",
"(",
"that",
".",
"USE",
")",
";",
"}",
"public",
"createFlowsFrom",
"(",
"fromSet",
")",
"{",
"const",
"toSet",
"=",
"this",
";",
"let",
"refsDefined",
"=",
"new",
"RefSet",
"(",
")",
";",
"let",
"newFlows",
"=",
"new",
"Set",
"<",
"Dataflow",
">",
"(",
"getDataflowId",
")",
";",
"for",
"(",
"let",
"level",
"of",
"Object",
".",
"keys",
"(",
"ReferenceType",
")",
")",
"{",
"for",
"(",
"let",
"to",
"of",
"toSet",
"[",
"level",
"]",
".",
"items",
")",
"{",
"for",
"(",
"let",
"from",
"of",
"fromSet",
"[",
"level",
"]",
".",
"items",
")",
"{",
"if",
"(",
"from",
".",
"name",
"==",
"to",
".",
"name",
")",
"{",
"refsDefined",
".",
"add",
"(",
"to",
")",
";",
"newFlows",
".",
"add",
"(",
"{",
"fromNode",
":",
"from",
".",
"node",
",",
"toNode",
":",
"to",
".",
"node",
",",
"fromRef",
":",
"from",
",",
"toRef",
":",
"to",
"}",
")",
";",
"}",
"}",
"}",
"}",
"return",
"[",
"newFlows",
",",
"refsDefined",
"]",
";",
"}",
"}",
"/**\n * Use a shared dataflow analyzer object for all dataflow analysis / querying for defs and uses.\n * It caches defs and uses for each statement, which can save time.\n * For caching to work, statements must be annotated with a cell's ID and execution count.\n */",
"export",
"class",
"DataflowAnalyzer",
"{",
"constructor",
"(",
"moduleMap",
"?",
")",
"{",
"this",
".",
"_symbolTable",
"=",
"new",
"SymbolTable",
"(",
"moduleMap",
"||",
"DefaultSpecs",
")",
";",
"}",
"getDefUseForStatement",
"(",
"statement",
",",
"defsForMethodResolution",
")",
"{",
"let",
"cacheKey",
"=",
"ast",
".",
"locationString",
"(",
"statement",
".",
"location",
")",
";",
"const",
"cached",
"=",
"this",
".",
"_defUsesCache",
"[",
"cacheKey",
"]",
";",
"if",
"(",
"cached",
")",
"{",
"return",
"cached",
";",
"}",
"let",
"defSet",
"=",
"this",
".",
"getDefs",
"(",
"statement",
",",
"defsForMethodResolution",
")",
";",
"let",
"useSet",
"=",
"this",
".",
"getUses",
"(",
"statement",
")",
";",
"let",
"result",
"=",
"new",
"DefUse",
"(",
"defSet",
".",
"filter",
"(",
"r",
"=>",
"r",
".",
"level",
"===",
"ReferenceType",
".",
"DEFINITION",
")",
",",
"defSet",
".",
"filter",
"(",
"r",
"=>",
"r",
".",
"level",
"===",
"ReferenceType",
".",
"UPDATE",
")",
",",
"useSet",
")",
";",
"this",
".",
"_defUsesCache",
"[",
"cacheKey",
"]",
"=",
"result",
";",
"return",
"result",
";",
"}",
"analyze",
"(",
"cfg",
",",
"refSet",
"?",
")",
"{",
"const",
"workQueue",
"=",
"cfg",
".",
"blocks",
".",
"reverse",
"(",
")",
";",
"let",
"undefinedRefs",
"=",
"new",
"RefSet",
"(",
")",
";",
"let",
"dataflows",
"=",
"new",
"Set",
"<",
"Dataflow",
">",
"(",
"getDataflowId",
")",
";",
"let",
"defUsePerBlock",
"=",
"new",
"Map",
"(",
"workQueue",
".",
"map",
"(",
"block",
"=>",
"[",
"block",
".",
"id",
",",
"new",
"DefUse",
"(",
")",
"]",
")",
")",
";",
"if",
"(",
"refSet",
")",
"{",
"defUsePerBlock",
".",
"get",
"(",
"cfg",
".",
"blocks",
"[",
"0",
"]",
".",
"id",
")",
".",
"update",
"(",
"new",
"DefUse",
"(",
"refSet",
")",
")",
";",
"}",
"while",
"(",
"workQueue",
".",
"length",
")",
"{",
"const",
"block",
"=",
"workQueue",
".",
"pop",
"(",
")",
";",
"let",
"initialBlockDefUse",
"=",
"defUsePerBlock",
".",
"get",
"(",
"block",
".",
"id",
")",
";",
"let",
"blockDefUse",
"=",
"cfg",
".",
"getPredecessors",
"(",
"block",
")",
".",
"reduce",
"(",
"(",
"defuse",
",",
"predBlock",
")",
"=>",
"defuse",
".",
"union",
"(",
"defUsePerBlock",
".",
"get",
"(",
"predBlock",
".",
"id",
")",
")",
",",
"initialBlockDefUse",
")",
";",
"for",
"(",
"let",
"statement",
"of",
"block",
".",
"statements",
")",
"{",
"let",
"statementDefUse",
"=",
"this",
".",
"getDefUseForStatement",
"(",
"statement",
",",
"blockDefUse",
".",
"defs",
")",
";",
"let",
"[",
"newFlows",
",",
"definedRefs",
"]",
"=",
"statementDefUse",
".",
"createFlowsFrom",
"(",
"blockDefUse",
")",
";",
"dataflows",
"=",
"dataflows",
".",
"union",
"(",
"newFlows",
")",
";",
"undefinedRefs",
"=",
"undefinedRefs",
".",
"union",
"(",
"statementDefUse",
".",
"uses",
")",
".",
"minus",
"(",
"definedRefs",
")",
";",
"blockDefUse",
".",
"update",
"(",
"statementDefUse",
")",
";",
"}",
"if",
"(",
"!",
"initialBlockDefUse",
".",
"equals",
"(",
"blockDefUse",
")",
")",
"{",
"defUsePerBlock",
".",
"set",
"(",
"block",
".",
"id",
",",
"blockDefUse",
")",
";",
"for",
"(",
"let",
"succ",
"of",
"cfg",
".",
"getSuccessors",
"(",
"block",
")",
")",
"{",
"if",
"(",
"workQueue",
".",
"indexOf",
"(",
"succ",
")",
"<",
"0",
")",
"{",
"workQueue",
".",
"push",
"(",
"succ",
")",
";",
"}",
"}",
"}",
"}",
"cfg",
".",
"visitControlDependencies",
"(",
"(",
"controlStmt",
",",
"stmt",
")",
"=>",
"dataflows",
".",
"add",
"(",
"{",
"fromNode",
":",
"controlStmt",
",",
"toNode",
":",
"stmt",
"}",
")",
")",
";",
"return",
"{",
"dataflows",
",",
"undefinedRefs",
"}",
";",
"}",
"getDefs",
"(",
"statement",
",",
"defsForMethodResolution",
")",
"{",
"if",
"(",
"!",
"statement",
")",
"return",
"new",
"RefSet",
"(",
")",
";",
"let",
"defs",
"=",
"runAnalysis",
"(",
"ApiCallAnalysis",
",",
"defsForMethodResolution",
",",
"statement",
",",
"this",
".",
"_symbolTable",
")",
".",
"union",
"(",
"runAnalysis",
"(",
"DefAnnotationAnalysis",
",",
"defsForMethodResolution",
",",
"statement",
",",
"this",
".",
"_symbolTable",
")",
")",
";",
"switch",
"(",
"statement",
".",
"type",
")",
"{",
"case",
"ast",
".",
"IMPORT",
":",
"defs",
"=",
"defs",
".",
"union",
"(",
"this",
".",
"getImportDefs",
"(",
"statement",
")",
")",
";",
"break",
";",
"case",
"ast",
".",
"FROM",
":",
"defs",
"=",
"defs",
".",
"union",
"(",
"this",
".",
"getImportFromDefs",
"(",
"statement",
")",
")",
";",
"break",
";",
"case",
"ast",
".",
"DEF",
":",
"defs",
"=",
"defs",
".",
"union",
"(",
"this",
".",
"getFuncDefs",
"(",
"statement",
",",
"defsForMethodResolution",
")",
")",
";",
"break",
";",
"case",
"ast",
".",
"CLASS",
":",
"defs",
"=",
"defs",
".",
"union",
"(",
"this",
".",
"getClassDefs",
"(",
"statement",
")",
")",
";",
"break",
";",
"case",
"ast",
".",
"ASSIGN",
":",
"defs",
"=",
"defs",
".",
"union",
"(",
"this",
".",
"getAssignDefs",
"(",
"statement",
")",
")",
";",
"break",
";",
"}",
"return",
"defs",
";",
"}",
"private",
"getClassDefs",
"(",
"classDecl",
")",
"{",
"return",
"new",
"RefSet",
"(",
"{",
"type",
":",
"SymbolType",
".",
"CLASS",
",",
"level",
":",
"ReferenceType",
".",
"DEFINITION",
",",
"name",
":",
"classDecl",
".",
"name",
",",
"location",
":",
"classDecl",
".",
"location",
",",
"node",
":",
"classDecl",
",",
"}",
")",
";",
"}",
"private",
"getFuncDefs",
"(",
"funcDecl",
",",
"defsForMethodResolution",
")",
"{",
"runAnalysis",
"(",
"ParameterSideEffectAnalysis",
",",
"defsForMethodResolution",
",",
"funcDecl",
",",
"this",
".",
"_symbolTable",
")",
";",
"return",
"new",
"RefSet",
"(",
"{",
"type",
":",
"SymbolType",
".",
"FUNCTION",
",",
"level",
":",
"ReferenceType",
".",
"DEFINITION",
",",
"name",
":",
"funcDecl",
".",
"name",
",",
"location",
":",
"funcDecl",
".",
"location",
",",
"node",
":",
"funcDecl",
",",
"}",
")",
";",
"}",
"private",
"getAssignDefs",
"(",
"assign",
")",
"{",
"let",
"targetsDefListener",
"=",
"new",
"TargetsDefListener",
"(",
"assign",
",",
"this",
".",
"_symbolTable",
")",
";",
"return",
"targetsDefListener",
".",
"defs",
";",
"}",
"private",
"getImportFromDefs",
"(",
"from",
")",
"{",
"this",
".",
"_symbolTable",
".",
"importModuleDefinitions",
"(",
"from",
".",
"base",
",",
"from",
".",
"imports",
")",
";",
"return",
"new",
"RefSet",
"(",
"...",
"from",
".",
"imports",
".",
"map",
"(",
"i",
"=>",
"{",
"return",
"{",
"type",
":",
"SymbolType",
".",
"IMPORT",
",",
"level",
":",
"ReferenceType",
".",
"DEFINITION",
",",
"name",
":",
"i",
".",
"name",
"||",
"i",
".",
"path",
",",
"location",
":",
"i",
".",
"location",
",",
"node",
":",
"from",
",",
"}",
";",
"}",
")",
")",
";",
"}",
"private",
"getImportDefs",
"(",
"imprt",
")",
"{",
"imprt",
".",
"names",
".",
"forEach",
"(",
"imp",
"=>",
"{",
"const",
"spec",
"=",
"this",
".",
"_symbolTable",
".",
"importModule",
"(",
"imp",
".",
"path",
",",
"imp",
".",
"name",
")",
";",
"}",
")",
";",
"return",
"new",
"RefSet",
"(",
"...",
"imprt",
".",
"names",
".",
"map",
"(",
"nameNode",
"=>",
"{",
"return",
"{",
"type",
":",
"SymbolType",
".",
"IMPORT",
",",
"level",
":",
"ReferenceType",
".",
"DEFINITION",
",",
"name",
":",
"nameNode",
".",
"name",
"||",
"nameNode",
".",
"path",
",",
"location",
":",
"nameNode",
".",
"location",
",",
"node",
":",
"imprt",
",",
"}",
";",
"}",
")",
")",
";",
"}",
"getUses",
"(",
"statement",
")",
"{",
"switch",
"(",
"statement",
".",
"type",
")",
"{",
"case",
"ast",
".",
"ASSIGN",
":",
"return",
"this",
".",
"getAssignUses",
"(",
"statement",
")",
";",
"case",
"ast",
".",
"DEF",
":",
"return",
"this",
".",
"getFuncDeclUses",
"(",
"statement",
")",
";",
"case",
"ast",
".",
"CLASS",
":",
"return",
"this",
".",
"getClassDeclUses",
"(",
"statement",
")",
";",
"default",
":",
"{",
"return",
"this",
".",
"getNameUses",
"(",
"statement",
")",
";",
"}",
"}",
"}",
"private",
"getNameUses",
"(",
"statement",
")",
"{",
"const",
"usedNames",
"=",
"gatherNames",
"(",
"statement",
")",
";",
"return",
"new",
"RefSet",
"(",
"...",
"usedNames",
".",
"items",
".",
"map",
"(",
"(",
"[",
"name",
",",
"node",
"]",
")",
"=>",
"{",
"return",
"{",
"type",
":",
"SymbolType",
".",
"VARIABLE",
",",
"level",
":",
"ReferenceType",
".",
"USE",
",",
"name",
":",
"name",
",",
"location",
":",
"node",
".",
"location",
",",
"node",
":",
"statement",
",",
"}",
";",
"}",
")",
")",
";",
"}",
"private",
"getClassDeclUses",
"(",
"classDecl",
")",
"{",
"return",
"classDecl",
".",
"code",
".",
"reduce",
"(",
"(",
"uses",
",",
"classStatement",
")",
"=>",
"uses",
".",
"union",
"(",
"this",
".",
"getUses",
"(",
"classStatement",
")",
")",
",",
"new",
"RefSet",
"(",
")",
")",
";",
"}",
"private",
"getFuncDeclUses",
"(",
"def",
")",
"{",
"let",
"defCfg",
"=",
"new",
"ControlFlowGraph",
"(",
"def",
")",
";",
"let",
"undefinedRefs",
"=",
"this",
".",
"analyze",
"(",
"defCfg",
",",
"getParameterRefs",
"(",
"def",
")",
")",
".",
"undefinedRefs",
";",
"return",
"undefinedRefs",
".",
"filter",
"(",
"r",
"=>",
"r",
".",
"level",
"==",
"ReferenceType",
".",
"USE",
")",
";",
"}",
"private",
"getAssignUses",
"(",
"assign",
")",
"{",
"const",
"targetNames",
"=",
"gatherNames",
"(",
"assign",
".",
"targets",
")",
";",
"const",
"targets",
"=",
"new",
"RefSet",
"(",
"...",
"targetNames",
".",
"items",
".",
"map",
"(",
"(",
"[",
"name",
",",
"node",
"]",
")",
"=>",
"{",
"return",
"{",
"type",
":",
"SymbolType",
".",
"VARIABLE",
",",
"level",
":",
"ReferenceType",
".",
"USE",
",",
"name",
":",
"name",
",",
"location",
":",
"node",
".",
"location",
",",
"node",
":",
"assign",
",",
"}",
";",
"}",
")",
")",
";",
"const",
"sourceNames",
"=",
"gatherNames",
"(",
"assign",
".",
"sources",
")",
";",
"const",
"sources",
"=",
"new",
"RefSet",
"(",
"...",
"sourceNames",
".",
"items",
".",
"map",
"(",
"(",
"[",
"name",
",",
"node",
"]",
")",
"=>",
"{",
"return",
"{",
"type",
":",
"SymbolType",
".",
"VARIABLE",
",",
"level",
":",
"ReferenceType",
".",
"USE",
",",
"name",
":",
"name",
",",
"location",
":",
"node",
".",
"location",
",",
"node",
":",
"assign",
",",
"}",
";",
"}",
")",
")",
";",
"return",
"sources",
".",
"union",
"(",
"assign",
".",
"op",
"?",
"targets",
":",
"new",
"RefSet",
"(",
")",
")",
";",
"}",
"private",
"_symbolTable",
":",
"SymbolTable",
";",
"private",
"_defUsesCache",
":",
"{",
"[",
"statementLocation",
"]",
":",
"DefUse",
";",
"}",
"=",
"{",
"}",
";",
"}",
"export",
"interface",
"Dataflow",
"{",
"fromNode",
":",
"ast",
".",
"SyntaxNode",
";",
"toNode",
":",
"ast",
".",
"SyntaxNode",
";",
"fromRef",
"?",
":",
"Ref",
";",
"toRef",
"?",
":",
"Ref",
";",
"}",
"export",
"enum",
"ReferenceType",
"{",
"DEFINITION",
"=",
"'DEFINITION'",
",",
"UPDATE",
"=",
"'UPDATE'",
",",
"USE",
"=",
"'USE'",
"}",
"export",
"enum",
"SymbolType",
"{",
"VARIABLE",
",",
"CLASS",
",",
"FUNCTION",
",",
"IMPORT",
",",
"MUTATION",
",",
"MAGIC",
"}",
"export",
"interface",
"Ref",
"{",
"type",
":",
"SymbolType",
";",
"level",
":",
"ReferenceType",
";",
"name",
":",
"string",
";",
"inferredType",
"?",
":",
"TypeSpec",
"<",
"FunctionSpec",
">",
";",
"location",
":",
"ast",
".",
"Location",
";",
"node",
":",
"ast",
".",
"SyntaxNode",
";",
"}",
"export",
"class",
"RefSet",
"extends",
"Set",
"<",
"Ref",
">",
"{",
"constructor",
"(",
"...",
"items",
")",
"{",
"super",
"(",
"r",
"=>",
"r",
".",
"name",
"+",
"r",
".",
"level",
"+",
"ast",
".",
"locationString",
"(",
"r",
".",
"location",
")",
",",
"...",
"items",
")",
";",
"}",
"}",
"export",
"function",
"sameLocation",
"(",
"loc1",
",",
"loc2",
")",
"{",
"return",
"(",
"loc1",
".",
"first_column",
"===",
"loc2",
".",
"first_column",
"&&",
"loc1",
".",
"first_line",
"===",
"loc2",
".",
"first_line",
"&&",
"loc1",
".",
"last_column",
"===",
"loc2",
".",
"last_column",
"&&",
"loc1",
".",
"last_line",
"===",
"loc2",
".",
"last_line",
")",
";",
"}",
"function",
"getNameSetId",
"(",
"[",
"name",
",",
"node",
"]",
")",
"{",
"if",
"(",
"!",
"node",
".",
"location",
")",
"console",
".",
"log",
"(",
"'***'",
",",
"node",
")",
";",
"return",
"`${",
"name",
"}@${",
"ast",
".",
"locationString",
"(",
"node",
".",
"location",
")",
"}`",
";",
"}",
"class",
"NameSet",
"extends",
"Set",
"<",
"[",
"string",
",",
"ast",
".",
"SyntaxNode",
"]",
">",
"{",
"constructor",
"(",
"...",
"items",
")",
"{",
"super",
"(",
"getNameSetId",
",",
"...",
"items",
")",
";",
"}",
"}",
"function",
"gatherNames",
"(",
"node",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"node",
")",
")",
"{",
"return",
"new",
"NameSet",
"(",
")",
".",
"union",
"(",
"...",
"node",
".",
"map",
"(",
"gatherNames",
")",
")",
";",
"}",
"else",
"{",
"return",
"new",
"NameSet",
"(",
"...",
"ast",
".",
"walk",
"(",
"node",
")",
".",
"filter",
"(",
"e",
"=>",
"e",
".",
"type",
"==",
"ast",
".",
"NAME",
")",
".",
"map",
"(",
"(",
"e",
")",
":",
"[",
"string",
",",
"ast",
".",
"SyntaxNode",
"]",
"=>",
"[",
"e",
".",
"id",
",",
"e",
"]",
")",
")",
";",
"}",
"}",
"abstract",
"class",
"AnalysisWalker",
"implements",
"ast",
".",
"WalkListener",
"{",
"readonly",
"defs",
":",
"RefSet",
"=",
"new",
"RefSet",
"(",
")",
";",
"constructor",
"(",
"protected",
"_statement",
",",
"protected",
"symbolTable",
")",
"{",
"}",
"abstract",
"onEnterNode",
"?",
"(",
"node",
",",
"ancestors",
")",
";",
"}",
"function",
"runAnalysis",
"(",
"Analysis",
",",
"defsForMethodResolution",
",",
"statement",
",",
"symbolTable",
")",
"{",
"const",
"walker",
"=",
"new",
"Analysis",
"(",
"statement",
",",
"symbolTable",
",",
"defsForMethodResolution",
")",
";",
"ast",
".",
"walk",
"(",
"statement",
",",
"walker",
")",
";",
"return",
"walker",
".",
"defs",
";",
"}",
"/**\n * Tree walk listener for collecting manual def annotations.\n */",
"class",
"DefAnnotationAnalysis",
"extends",
"AnalysisWalker",
"{",
"constructor",
"(",
"statement",
",",
"symbolTable",
")",
"{",
"super",
"(",
"statement",
",",
"symbolTable",
")",
";",
"}",
"onEnterNode",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"type",
"==",
"ast",
".",
"LITERAL",
")",
"{",
"let",
"literal",
"=",
"node",
"as",
"ast",
".",
"Literal",
";",
"if",
"(",
"typeof",
"literal",
".",
"value",
"==",
"'string'",
"||",
"literal",
".",
"value",
"instanceof",
"String",
")",
"{",
"let",
"string",
"=",
"literal",
".",
"value",
";",
"let",
"jsonMatch",
"=",
"string",
".",
"match",
"(",
"/\"defs: (.*)\"/",
")",
";",
"if",
"(",
"jsonMatch",
"&&",
"jsonMatch",
".",
"length",
">=",
"2",
")",
"{",
"let",
"jsonString",
"=",
"jsonMatch",
"[",
"1",
"]",
";",
"let",
"jsonStringUnescaped",
"=",
"jsonString",
".",
"replace",
"(",
"/\\\\\"/g",
",",
"'\"'",
")",
";",
"try",
"{",
"let",
"defSpecs",
"=",
"JSON",
".",
"parse",
"(",
"jsonStringUnescaped",
")",
";",
"for",
"(",
"let",
"defSpec",
"of",
"defSpecs",
")",
"{",
"this",
".",
"defs",
".",
"add",
"(",
"{",
"type",
":",
"SymbolType",
".",
"MAGIC",
",",
"level",
":",
"ReferenceType",
".",
"DEFINITION",
",",
"name",
":",
"defSpec",
".",
"name",
",",
"location",
":",
"{",
"first_line",
":",
"defSpec",
".",
"pos",
"[",
"0",
"]",
"[",
"0",
"]",
"+",
"node",
".",
"location",
".",
"first_line",
",",
"first_column",
":",
"defSpec",
".",
"pos",
"[",
"0",
"]",
"[",
"1",
"]",
",",
"last_line",
":",
"defSpec",
".",
"pos",
"[",
"1",
"]",
"[",
"0",
"]",
"+",
"node",
".",
"location",
".",
"first_line",
",",
"last_column",
":",
"defSpec",
".",
"pos",
"[",
"1",
"]",
"[",
"1",
"]",
",",
"}",
",",
"node",
":",
"this",
".",
"_statement",
",",
"}",
")",
";",
"}",
"}",
"catch",
"(",
"e",
")",
"{",
"}",
"}",
"}",
"}",
"}",
"}",
"/**\n * Tree walk listener for collecting names used in function call.\n */",
"class",
"ApiCallAnalysis",
"extends",
"AnalysisWalker",
"{",
"constructor",
"(",
"statement",
",",
"symbolTable",
",",
"private",
"variableDefs",
")",
"{",
"super",
"(",
"statement",
",",
"symbolTable",
")",
";",
"}",
"onEnterNode",
"(",
"node",
",",
"ancestors",
")",
"{",
"if",
"(",
"node",
".",
"type",
"!==",
"ast",
".",
"CALL",
")",
"{",
"return",
";",
"}",
"let",
"funcSpec",
";",
"const",
"func",
"=",
"node",
".",
"func",
";",
"if",
"(",
"func",
".",
"type",
"===",
"ast",
".",
"DOT",
"&&",
"func",
".",
"value",
".",
"type",
"===",
"ast",
".",
"NAME",
")",
"{",
"const",
"receiver",
"=",
"func",
".",
"value",
";",
"const",
"moduleSpec",
"=",
"this",
".",
"symbolTable",
".",
"modules",
"[",
"receiver",
".",
"id",
"]",
";",
"if",
"(",
"moduleSpec",
")",
"{",
"funcSpec",
"=",
"moduleSpec",
".",
"functions",
".",
"find",
"(",
"f",
"=>",
"f",
".",
"name",
"===",
"func",
".",
"name",
")",
";",
"}",
"else",
"{",
"const",
"ref",
"=",
"this",
".",
"variableDefs",
".",
"items",
".",
"find",
"(",
"r",
"=>",
"r",
".",
"name",
"===",
"receiver",
".",
"id",
")",
";",
"if",
"(",
"ref",
")",
"{",
"const",
"receiverType",
"=",
"ref",
".",
"inferredType",
";",
"if",
"(",
"receiverType",
")",
"{",
"const",
"funcName",
"=",
"func",
".",
"name",
";",
"funcSpec",
"=",
"receiverType",
".",
"methods",
".",
"find",
"(",
"m",
"=>",
"m",
".",
"name",
"===",
"funcName",
")",
";",
"}",
"}",
"}",
"}",
"else",
"if",
"(",
"func",
".",
"type",
"===",
"ast",
".",
"NAME",
")",
"{",
"funcSpec",
"=",
"this",
".",
"symbolTable",
".",
"lookupFunction",
"(",
"func",
".",
"id",
")",
";",
"}",
"if",
"(",
"funcSpec",
"&&",
"funcSpec",
".",
"updates",
")",
"{",
"funcSpec",
".",
"updates",
".",
"forEach",
"(",
"paramName",
"=>",
"{",
"const",
"position",
"=",
"typeof",
"paramName",
"===",
"'string'",
"?",
"parseInt",
"(",
"paramName",
")",
":",
"paramName",
";",
"if",
"(",
"isNaN",
"(",
"position",
")",
")",
"{",
"return",
";",
"}",
"let",
"actualArgName",
";",
"if",
"(",
"0",
"<",
"position",
"&&",
"position",
"-",
"1",
"<",
"node",
".",
"args",
".",
"length",
")",
"{",
"const",
"arg",
"=",
"node",
".",
"args",
"[",
"position",
"-",
"1",
"]",
".",
"actual",
";",
"if",
"(",
"arg",
".",
"type",
"===",
"ast",
".",
"NAME",
")",
"{",
"actualArgName",
"=",
"arg",
".",
"id",
";",
"}",
"}",
"else",
"if",
"(",
"position",
"===",
"0",
"&&",
"node",
".",
"func",
".",
"type",
"===",
"ast",
".",
"DOT",
"&&",
"node",
".",
"func",
".",
"value",
".",
"type",
"===",
"ast",
".",
"NAME",
")",
"{",
"actualArgName",
"=",
"node",
".",
"func",
".",
"value",
".",
"id",
";",
"}",
"if",
"(",
"actualArgName",
")",
"{",
"this",
".",
"defs",
".",
"add",
"(",
"{",
"type",
":",
"SymbolType",
".",
"MUTATION",
",",
"level",
":",
"ReferenceType",
".",
"UPDATE",
",",
"name",
":",
"actualArgName",
",",
"location",
":",
"node",
".",
"location",
",",
"node",
":",
"this",
".",
"_statement",
",",
"}",
")",
";",
"}",
"}",
")",
";",
"}",
"else",
"{",
"node",
".",
"args",
".",
"forEach",
"(",
"arg",
"=>",
"{",
"if",
"(",
"arg",
".",
"actual",
".",
"type",
"===",
"ast",
".",
"NAME",
")",
"{",
"const",
"name",
"=",
"arg",
".",
"actual",
".",
"id",
";",
"this",
".",
"defs",
".",
"add",
"(",
"{",
"type",
":",
"SymbolType",
".",
"MUTATION",
",",
"level",
":",
"ReferenceType",
".",
"UPDATE",
",",
"name",
":",
"name",
",",
"location",
":",
"node",
".",
"location",
",",
"node",
":",
"this",
".",
"_statement",
",",
"}",
")",
";",
"}",
"}",
")",
";",
"if",
"(",
"node",
".",
"func",
".",
"type",
"===",
"ast",
".",
"DOT",
"&&",
"node",
".",
"func",
".",
"value",
".",
"type",
"===",
"ast",
".",
"NAME",
")",
"{",
"const",
"name",
"=",
"node",
".",
"func",
".",
"value",
".",
"id",
";",
"this",
".",
"defs",
".",
"add",
"(",
"{",
"type",
":",
"SymbolType",
".",
"MUTATION",
",",
"level",
":",
"ReferenceType",
".",
"UPDATE",
",",
"name",
":",
"name",
",",
"location",
":",
"node",
".",
"location",
",",
"node",
":",
"this",
".",
"_statement",
",",
"}",
")",
";",
"}",
"}",
"}",
"}",
"/**\n * Tree walk listener for collecting definitions in the target of an assignment.\n */",
"class",
"TargetsDefListener",
"extends",
"AnalysisWalker",
"{",
"private",
"isAugAssign",
":",
"boolean",
";",
"constructor",
"(",
"assign",
",",
"symbolTable",
")",
"{",
"super",
"(",
"assign",
",",
"symbolTable",
")",
";",
"this",
".",
"isAugAssign",
"=",
"!",
"!",
"assign",
".",
"op",
";",
"if",
"(",
"assign",
".",
"targets",
")",
"{",
"for",
"(",
"let",
"target",
"of",
"assign",
".",
"targets",
")",
"{",
"ast",
".",
"walk",
"(",
"target",
",",
"this",
")",
";",
"}",
"}",
"assign",
".",
"sources",
".",
"forEach",
"(",
"(",
"source",
",",
"i",
")",
"=>",
"{",
"if",
"(",
"source",
".",
"type",
"===",
"ast",
".",
"CALL",
")",
"{",
"const",
"spec",
"=",
"symbolTable",
".",
"lookupNode",
"(",
"source",
".",
"func",
")",
";",
"const",
"target",
"=",
"assign",
".",
"targets",
"[",
"i",
"]",
";",
"if",
"(",
"spec",
"&&",
"target",
"&&",
"target",
".",
"type",
"===",
"ast",
".",
"NAME",
")",
"{",
"const",
"def",
"=",
"this",
".",
"defs",
".",
"items",
".",
"find",
"(",
"d",
"=>",
"d",
".",
"name",
"===",
"target",
".",
"id",
")",
";",
"if",
"(",
"def",
")",
"{",
"def",
".",
"inferredType",
"=",
"spec",
".",
"returnsType",
";",
"}",
"}",
"}",
"}",
")",
";",
"}",
"onEnterNode",
"(",
"target",
",",
"ancestors",
")",
"{",
"if",
"(",
"target",
".",
"type",
"==",
"ast",
".",
"NAME",
")",
"{",
"if",
"(",
"ancestors",
".",
"length",
">",
"1",
")",
"{",
"const",
"parent",
"=",
"ancestors",
"[",
"0",
"]",
";",
"if",
"(",
"parent",
".",
"type",
"===",
"ast",
".",
"INDEX",
"&&",
"parent",
".",
"args",
".",
"some",
"(",
"a",
"=>",
"a",
"===",
"target",
")",
")",
"{",
"return",
";",
"}",
"}",
"const",
"isUpdate",
"=",
"this",
".",
"isAugAssign",
"||",
"ancestors",
".",
"some",
"(",
"a",
"=>",
"a",
".",
"type",
"==",
"ast",
".",
"DOT",
"||",
"a",
".",
"type",
"==",
"ast",
".",
"INDEX",
")",
";",
"this",
".",
"defs",
".",
"add",
"(",
"{",
"type",
":",
"SymbolType",
".",
"VARIABLE",
",",
"level",
":",
"isUpdate",
"?",
"ReferenceType",
".",
"UPDATE",
":",
"ReferenceType",
".",
"DEFINITION",
",",
"location",
":",
"target",
".",
"location",
",",
"name",
":",
"target",
".",
"id",
",",
"node",
":",
"this",
".",
"_statement",
",",
"}",
")",
";",
"}",
"}",
"}",
"class",
"ParameterSideEffectAnalysis",
"extends",
"AnalysisWalker",
"{",
"private",
"flows",
":",
"Set",
"<",
"Dataflow",
">",
";",
"private",
"isMethod",
":",
"boolean",
";",
"private",
"spec",
":",
"FunctionSpec",
";",
"constructor",
"(",
"private",
"def",
",",
"symbolTable",
")",
"{",
"super",
"(",
"def",
",",
"symbolTable",
")",
";",
"const",
"cfg",
"=",
"new",
"ControlFlowGraph",
"(",
"def",
")",
";",
"this",
".",
"flows",
"=",
"new",
"DataflowAnalyzer",
"(",
")",
".",
"analyze",
"(",
"cfg",
",",
"getParameterRefs",
"(",
"def",
")",
")",
".",
"dataflows",
";",
"this",
".",
"flows",
"=",
"this",
".",
"getTransitiveClosure",
"(",
"this",
".",
"flows",
")",
";",
"this",
".",
"symbolTable",
".",
"functions",
"[",
"def",
".",
"name",
"]",
"=",
"this",
".",
"spec",
"=",
"{",
"name",
":",
"def",
".",
"name",
",",
"updates",
":",
"[",
"]",
"}",
";",
"}",
"private",
"getTransitiveClosure",
"(",
"flows",
")",
"{",
"const",
"nodes",
"=",
"flows",
".",
"map",
"(",
"getNodeId",
",",
"df",
"=>",
"df",
".",
"fromNode",
")",
".",
"union",
"(",
"flows",
".",
"map",
"(",
"getNodeId",
",",
"df",
"=>",
"df",
".",
"toNode",
")",
")",
";",
"const",
"result",
"=",
"new",
"Set",
"(",
"getDataflowId",
",",
"...",
"flows",
".",
"items",
")",
";",
"nodes",
".",
"items",
".",
"forEach",
"(",
"from",
"=>",
"nodes",
".",
"items",
".",
"forEach",
"(",
"to",
"=>",
"nodes",
".",
"items",
".",
"forEach",
"(",
"middle",
"=>",
"{",
"if",
"(",
"flows",
".",
"has",
"(",
"{",
"fromNode",
":",
"from",
",",
"toNode",
":",
"middle",
"}",
")",
"&&",
"flows",
".",
"has",
"(",
"{",
"fromNode",
":",
"middle",
",",
"toNode",
":",
"to",
"}",
")",
")",
"{",
"result",
".",
"add",
"(",
"{",
"fromNode",
":",
"from",
",",
"toNode",
":",
"to",
"}",
")",
";",
"}",
"}",
")",
")",
")",
";",
"return",
"result",
";",
"}",
"private",
"checkParameterFlow",
"(",
"sideEffect",
")",
"{",
"this",
".",
"def",
".",
"params",
".",
"forEach",
"(",
"(",
"parm",
",",
"i",
")",
"=>",
"{",
"const",
"parmNum",
"=",
"this",
".",
"isMethod",
"?",
"i",
":",
"i",
"+",
"1",
";",
"if",
"(",
"this",
".",
"flows",
".",
"has",
"(",
"{",
"fromNode",
":",
"parm",
",",
"toNode",
":",
"sideEffect",
"}",
")",
"&&",
"this",
".",
"spec",
".",
"updates",
".",
"indexOf",
"(",
"parmNum",
")",
"<",
"0",
")",
"{",
"this",
".",
"spec",
".",
"updates",
".",
"push",
"(",
"parmNum",
")",
";",
"}",
"}",
")",
";",
"}",
"onEnterNode",
"(",
"statement",
",",
"ancestors",
")",
"{",
"switch",
"(",
"statement",
".",
"type",
")",
"{",
"case",
"ast",
".",
"ASSIGN",
":",
"for",
"(",
"let",
"target",
"of",
"statement",
".",
"targets",
")",
"{",
"if",
"(",
"target",
".",
"type",
"===",
"ast",
".",
"DOT",
")",
"{",
"this",
".",
"checkParameterFlow",
"(",
"statement",
")",
";",
"}",
"else",
"if",
"(",
"target",
".",
"type",
"===",
"ast",
".",
"INDEX",
")",
"{",
"this",
".",
"checkParameterFlow",
"(",
"statement",
")",
";",
"}",
"}",
"break",
";",
"case",
"ast",
".",
"CALL",
":",
"const",
"funcSpec",
"=",
"this",
".",
"symbolTable",
".",
"lookupNode",
"(",
"statement",
".",
"func",
")",
";",
"const",
"actuals",
"=",
"statement",
".",
"args",
".",
"map",
"(",
"a",
"=>",
"a",
".",
"actual",
")",
";",
"this",
".",
"def",
".",
"params",
".",
"forEach",
"(",
"(",
"param",
",",
"i",
")",
"=>",
"{",
"const",
"paramNum",
"=",
"this",
".",
"isMethod",
"?",
"i",
":",
"i",
"+",
"1",
";",
"if",
"(",
"funcSpec",
")",
"{",
"const",
"paramFlows",
"=",
"this",
".",
"flows",
".",
"filter",
"(",
"f",
"=>",
"f",
".",
"fromNode",
"===",
"param",
"&&",
"f",
".",
"toNode",
"===",
"statement",
"&&",
"f",
".",
"toRef",
"!==",
"undefined",
")",
";",
"const",
"updates",
"=",
"funcSpec",
".",
"updates",
".",
"filter",
"(",
"u",
"=>",
"typeof",
"u",
"===",
"'number'",
")",
"as",
"number",
"[",
"]",
";",
"if",
"(",
"updates",
".",
"length",
">",
"0",
"&&",
"!",
"paramFlows",
".",
"empty",
"&&",
"this",
".",
"spec",
".",
"updates",
".",
"indexOf",
"(",
"paramNum",
")",
"<",
"0",
")",
"{",
"paramFlows",
".",
"items",
".",
"forEach",
"(",
"pf",
"=>",
"{",
"if",
"(",
"updates",
".",
"find",
"(",
"i",
"=>",
"i",
">",
"0",
"&&",
"ast",
".",
"walk",
"(",
"actuals",
"[",
"i",
"-",
"1",
"]",
")",
".",
"find",
"(",
"a",
"=>",
"a",
".",
"type",
"===",
"ast",
".",
"NAME",
"&&",
"a",
".",
"id",
"===",
"pf",
".",
"toRef",
".",
"name",
")",
")",
")",
"{",
"this",
".",
"spec",
".",
"updates",
".",
"push",
"(",
"paramNum",
")",
";",
"}",
"else",
"if",
"(",
"updates",
".",
"indexOf",
"(",
"0",
")",
">=",
"0",
"&&",
"statement",
".",
"func",
".",
"type",
"===",
"ast",
".",
"DOT",
"&&",
"statement",
".",
"func",
".",
"value",
".",
"type",
"===",
"ast",
".",
"NAME",
"&&",
"statement",
".",
"func",
".",
"value",
".",
"id",
"===",
"pf",
".",
"toRef",
".",
"name",
")",
"{",
"this",
".",
"spec",
".",
"updates",
".",
"push",
"(",
"0",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"else",
"{",
"this",
".",
"spec",
".",
"updates",
".",
"push",
"(",
"paramNum",
")",
";",
"}",
"}",
")",
";",
"break",
";",
"}",
"}",
"}",
"function",
"getParameterRefs",
"(",
"def",
")",
"{",
"return",
"new",
"RefSet",
"(",
"...",
"def",
".",
"params",
".",
"map",
"(",
"p",
"=>",
"(",
"{",
"name",
":",
"p",
".",
"name",
",",
"level",
":",
"ReferenceType",
".",
"DEFINITION",
",",
"type",
":",
"SymbolType",
".",
"VARIABLE",
",",
"location",
":",
"p",
".",
"location",
",",
"node",
":",
"p",
"}",
")",
")",
")",
";",
"}",
"function",
"getNodeId",
"(",
"node",
")",
"{",
"return",
"`${",
"ast",
".",
"locationString",
"(",
"node",
".",
"location",
")",
"}`",
";",
"}",
"function",
"getDataflowId",
"(",
"df",
")",
"{",
"if",
"(",
"!",
"df",
".",
"fromNode",
".",
"location",
")",
"{",
"console",
".",
"log",
"(",
"'*** FROM'",
",",
"df",
".",
"fromNode",
",",
"df",
".",
"fromNode",
".",
"location",
")",
";",
"}",
"if",
"(",
"!",
"df",
".",
"toNode",
".",
"location",
")",
"{",
"console",
".",
"log",
"(",
"'*** TO'",
",",
"df",
".",
"toNode",
",",
"df",
".",
"toNode",
".",
"location",
")",
";",
"}",
"return",
"`${",
"getNodeId",
"(",
"df",
".",
"fromNode",
")",
"}->${",
"getNodeId",
"(",
"df",
".",
"toNode",
")",
"}`",
";",
"}",
"export",
"type",
"DataflowAnalysisResult",
"=",
"{",
"dataflows",
":",
"Set",
"<",
"Dataflow",
">",
";",
"undefinedRefs",
":",
"RefSet",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
37594,
null,
37594,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
37594,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
37594,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
37594,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
null,
null,
null,
null,
null,
null,
30,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
37594,
null,
4669,
null,
13908,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
37594,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
null,
null,
null,
null,
null,
null,
null,
null,
37594,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
42366,
null,
13908,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
null,
null,
null,
null,
null,
null,
30,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
37594,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2143,
null,
2143,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
4669,
null,
13908,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
0,
null,
13908,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
0,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
4669,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
4669,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
0,
null,
null,
null,
42366,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
0,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
133,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
0,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
151 | [
"import",
"*",
"as",
"ast",
"from",
"'./python-parser'",
";",
"import",
"{",
"Dataflow",
"}",
"from",
"'./data-flow'",
";",
"import",
"{",
"Set",
"}",
"from",
"'./set'",
";",
"import",
"{",
"printNode",
"}",
"from",
"'./printNode'",
";",
"export",
"class",
"Block",
"{",
"constructor",
"(",
"public",
"id",
",",
"public",
"readonly",
"hint",
",",
"public",
"statements",
",",
"public",
"loopVariables",
"=",
"[",
"]",
")",
"{",
"}",
"public",
"toString",
"(",
")",
"{",
"return",
"(",
"`BLOCK ${",
"this",
".",
"id",
"} (${",
"this",
".",
"hint",
"})\\n`",
"+",
"this",
".",
"statements",
".",
"map",
"(",
"s",
"=>",
"`${",
"s",
".",
"location",
".",
"first_line",
"}: ${",
"printNode",
"(",
"s",
")",
"}`",
")",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"}",
"}",
"class",
"BlockSet",
"extends",
"Set",
"<",
"Block",
">",
"{",
"constructor",
"(",
"...",
"items",
")",
"{",
"super",
"(",
"b",
"=>",
"b",
".",
"id",
".",
"toString",
"(",
")",
",",
"...",
"items",
")",
";",
"}",
"}",
"class",
"Context",
"{",
"constructor",
"(",
"public",
"loopHead",
",",
"public",
"loopExit",
",",
"public",
"exceptionBlock",
")",
"{",
"}",
"public",
"forLoop",
"(",
"loopHead",
",",
"loopExit",
")",
"{",
"return",
"new",
"Context",
"(",
"loopHead",
",",
"loopExit",
",",
"this",
".",
"exceptionBlock",
")",
";",
"}",
"public",
"forExcepts",
"(",
"exceptionBlock",
")",
"{",
"return",
"new",
"Context",
"(",
"this",
".",
"loopHead",
",",
"this",
".",
"loopExit",
",",
"exceptionBlock",
")",
";",
"}",
"}",
"export",
"class",
"ControlFlowGraph",
"{",
"private",
"_blocks",
":",
"Block",
"[",
"]",
"=",
"[",
"]",
";",
"private",
"globalId",
"=",
"0",
";",
"private",
"entry",
":",
"Block",
";",
"private",
"exit",
":",
"Block",
";",
"private",
"successors",
"=",
"new",
"Set",
"<",
"[",
"Block",
",",
"Block",
"]",
">",
"(",
"(",
"[",
"b1",
",",
"b2",
"]",
")",
"=>",
"b1",
".",
"id",
"+",
"','",
"+",
"b2",
".",
"id",
")",
";",
"private",
"loopVariables",
":",
"ast",
".",
"SyntaxNode",
"[",
"]",
"[",
"]",
"=",
"[",
"]",
";",
"constructor",
"(",
"node",
")",
"{",
"if",
"(",
"!",
"node",
")",
"{",
"throw",
"'argument undefined'",
";",
"}",
"let",
"statements",
"=",
"[",
"]",
";",
"if",
"(",
"node",
".",
"type",
"==",
"ast",
".",
"MODULE",
")",
"{",
"statements",
"=",
"Array",
".",
"isArray",
"(",
"node",
".",
"code",
")",
"?",
"node",
".",
"code",
":",
"[",
"node",
".",
"code",
"]",
";",
"}",
"else",
"if",
"(",
"node",
".",
"type",
"==",
"ast",
".",
"DEF",
")",
"{",
"statements",
"=",
"Array",
".",
"isArray",
"(",
"node",
".",
"code",
")",
"?",
"node",
".",
"code",
":",
"[",
"node",
".",
"code",
"]",
";",
"}",
"[",
"this",
".",
"entry",
",",
"this",
".",
"exit",
"]",
"=",
"this",
".",
"makeCFG",
"(",
"'entry'",
",",
"statements",
",",
"new",
"Context",
"(",
"null",
",",
"null",
",",
"this",
".",
"makeBlock",
"(",
"'exceptional exit'",
")",
")",
")",
";",
"}",
"private",
"makeBlock",
"(",
"hint",
",",
"statements",
"=",
"[",
"]",
")",
"{",
"const",
"b",
"=",
"new",
"Block",
"(",
"this",
".",
"globalId",
"++",
",",
"hint",
",",
"statements",
")",
";",
"if",
"(",
"this",
".",
"loopVariables",
".",
"length",
")",
"{",
"b",
".",
"loopVariables",
"=",
"this",
".",
"loopVariables",
"[",
"this",
".",
"loopVariables",
".",
"length",
"-",
"1",
"]",
";",
"}",
"this",
".",
"_blocks",
".",
"push",
"(",
"b",
")",
";",
"return",
"b",
";",
"}",
"public",
"get",
"blocks",
"(",
")",
":",
"Block",
"[",
"]",
"{",
"const",
"visited",
"=",
"[",
"]",
";",
"const",
"toVisit",
"=",
"new",
"BlockSet",
"(",
"this",
".",
"entry",
")",
";",
"while",
"(",
"toVisit",
".",
"size",
")",
"{",
"const",
"block",
"=",
"toVisit",
".",
"take",
"(",
")",
";",
"visited",
".",
"push",
"(",
"block",
")",
";",
"this",
".",
"successors",
".",
"items",
".",
"forEach",
"(",
"(",
"[",
"pred",
",",
"succ",
"]",
")",
"=>",
"{",
"if",
"(",
"pred",
"===",
"block",
"&&",
"visited",
".",
"indexOf",
"(",
"succ",
")",
"<",
"0",
")",
"{",
"toVisit",
".",
"add",
"(",
"succ",
")",
";",
"}",
"}",
")",
";",
"}",
"return",
"visited",
";",
"}",
"public",
"getSuccessors",
"(",
"block",
")",
"{",
"return",
"this",
".",
"successors",
".",
"items",
".",
"filter",
"(",
"(",
"[",
"p",
",",
"_",
"]",
")",
"=>",
"p",
"==",
"block",
")",
".",
"map",
"(",
"(",
"[",
"_",
",",
"s",
"]",
")",
"=>",
"s",
")",
";",
"}",
"public",
"getPredecessors",
"(",
"block",
")",
"{",
"return",
"this",
".",
"successors",
".",
"items",
".",
"filter",
"(",
"(",
"[",
"_",
",",
"s",
"]",
")",
"=>",
"s",
"==",
"block",
")",
".",
"map",
"(",
"(",
"[",
"p",
",",
"_",
"]",
")",
"=>",
"p",
")",
";",
"}",
"public",
"print",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'CFG'",
",",
"'ENTRY:'",
",",
"this",
".",
"entry",
".",
"id",
",",
"'EXIT:'",
",",
"this",
".",
"exit",
".",
"id",
")",
";",
"this",
".",
"blocks",
".",
"forEach",
"(",
"block",
"=>",
"{",
"console",
".",
"log",
"(",
"block",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"block",
"===",
"this",
".",
"exit",
")",
"{",
"console",
".",
"log",
"(",
"' EXIT'",
")",
";",
"}",
"else",
"{",
"console",
".",
"log",
"(",
"' SUCC'",
",",
"this",
".",
"getSuccessors",
"(",
"block",
")",
".",
"map",
"(",
"b",
"=>",
"b",
".",
"id",
".",
"toString",
"(",
")",
")",
".",
"join",
"(",
"','",
")",
")",
";",
"}",
"}",
")",
";",
"}",
"private",
"link",
"(",
"...",
"blocks",
")",
"{",
"for",
"(",
"let",
"i",
"=",
"1",
";",
"i",
"<",
"blocks",
".",
"length",
";",
"i",
"++",
")",
"this",
".",
"successors",
".",
"add",
"(",
"[",
"blocks",
"[",
"i",
"-",
"1",
"]",
",",
"blocks",
"[",
"i",
"]",
"]",
")",
";",
"}",
"private",
"handleIf",
"(",
"statement",
",",
"last",
",",
"context",
")",
"{",
"const",
"ifCondBlock",
"=",
"this",
".",
"makeBlock",
"(",
"'if cond'",
",",
"[",
"statement",
".",
"cond",
"]",
")",
";",
"if",
"(",
"!",
"statement",
".",
"code",
")",
"console",
".",
"log",
"(",
"statement",
")",
";",
"const",
"[",
"bodyEntry",
",",
"bodyExit",
"]",
"=",
"this",
".",
"makeCFG",
"(",
"'if body'",
",",
"statement",
".",
"code",
",",
"context",
")",
";",
"this",
".",
"link",
"(",
"last",
",",
"ifCondBlock",
")",
";",
"this",
".",
"link",
"(",
"ifCondBlock",
",",
"bodyEntry",
")",
";",
"const",
"joinBlock",
"=",
"this",
".",
"makeBlock",
"(",
"'conditional join'",
")",
";",
"this",
".",
"link",
"(",
"bodyExit",
",",
"joinBlock",
")",
";",
"let",
"lastCondBlock",
"=",
"ifCondBlock",
";",
"if",
"(",
"statement",
".",
"elif",
")",
"{",
"statement",
".",
"elif",
".",
"forEach",
"(",
"elif",
"=>",
"{",
"const",
"elifCondBlock",
"=",
"this",
".",
"makeBlock",
"(",
"'elif cond'",
",",
"[",
"elif",
".",
"cond",
"]",
")",
";",
"this",
".",
"link",
"(",
"lastCondBlock",
",",
"elifCondBlock",
")",
";",
"const",
"[",
"elifEntry",
",",
"elifExit",
"]",
"=",
"this",
".",
"makeCFG",
"(",
"'elif body'",
",",
"elif",
".",
"code",
",",
"context",
")",
";",
"this",
".",
"link",
"(",
"elifCondBlock",
",",
"elifEntry",
")",
";",
"this",
".",
"link",
"(",
"elifExit",
",",
"joinBlock",
")",
";",
"lastCondBlock",
"=",
"elifCondBlock",
";",
"}",
")",
";",
"}",
"if",
"(",
"statement",
".",
"else",
")",
"{",
"let",
"elseStmt",
"=",
"statement",
".",
"else",
"as",
"ast",
".",
"Else",
";",
"if",
"(",
"elseStmt",
".",
"code",
"&&",
"elseStmt",
".",
"code",
".",
"length",
")",
"{",
"const",
"elseCondBlock",
"=",
"this",
".",
"makeBlock",
"(",
"'else cond'",
",",
"[",
"elseStmt",
"]",
")",
";",
"this",
".",
"link",
"(",
"lastCondBlock",
",",
"elseCondBlock",
")",
";",
"const",
"[",
"elseEntry",
",",
"elseExit",
"]",
"=",
"this",
".",
"makeCFG",
"(",
"'else body'",
",",
"elseStmt",
".",
"code",
",",
"context",
")",
";",
"this",
".",
"link",
"(",
"elseCondBlock",
",",
"elseEntry",
")",
";",
"this",
".",
"link",
"(",
"elseExit",
",",
"joinBlock",
")",
";",
"lastCondBlock",
"=",
"elseCondBlock",
";",
"}",
"}",
"this",
".",
"link",
"(",
"lastCondBlock",
",",
"joinBlock",
")",
";",
"return",
"joinBlock",
";",
"}",
"private",
"handleWhile",
"(",
"statement",
",",
"last",
",",
"context",
")",
"{",
"const",
"loopHeadBlock",
"=",
"this",
".",
"makeBlock",
"(",
"'while loop head'",
",",
"[",
"statement",
".",
"cond",
"]",
")",
";",
"this",
".",
"link",
"(",
"last",
",",
"loopHeadBlock",
")",
";",
"const",
"afterLoop",
"=",
"this",
".",
"makeBlock",
"(",
"'while loop join'",
")",
";",
"this",
".",
"loopVariables",
".",
"push",
"(",
"[",
"statement",
".",
"cond",
"]",
")",
";",
"const",
"[",
"bodyEntry",
",",
"bodyExit",
"]",
"=",
"this",
".",
"makeCFG",
"(",
"'while body'",
",",
"statement",
".",
"code",
",",
"context",
".",
"forLoop",
"(",
"loopHeadBlock",
",",
"afterLoop",
")",
")",
";",
"this",
".",
"loopVariables",
".",
"pop",
"(",
")",
";",
"this",
".",
"link",
"(",
"loopHeadBlock",
",",
"bodyEntry",
")",
";",
"this",
".",
"link",
"(",
"bodyExit",
",",
"loopHeadBlock",
")",
";",
"this",
".",
"link",
"(",
"loopHeadBlock",
",",
"afterLoop",
")",
";",
"return",
"afterLoop",
";",
"}",
"private",
"handleFor",
"(",
"statement",
",",
"last",
",",
"context",
")",
"{",
"const",
"loopHeadBlock",
"=",
"this",
".",
"makeBlock",
"(",
"'for loop head'",
",",
"[",
"{",
"type",
":",
"ast",
".",
"ASSIGN",
",",
"op",
":",
"undefined",
",",
"sources",
":",
"statement",
".",
"iter",
",",
"targets",
":",
"statement",
".",
"target",
",",
"location",
":",
"statement",
".",
"decl_location",
",",
"}",
",",
"]",
")",
";",
"this",
".",
"link",
"(",
"last",
",",
"loopHeadBlock",
")",
";",
"const",
"afterLoop",
"=",
"this",
".",
"makeBlock",
"(",
"'for loop join'",
")",
";",
"this",
".",
"loopVariables",
".",
"push",
"(",
"statement",
".",
"target",
")",
";",
"const",
"[",
"bodyEntry",
",",
"bodyExit",
"]",
"=",
"this",
".",
"makeCFG",
"(",
"'for body'",
",",
"statement",
".",
"code",
",",
"context",
".",
"forLoop",
"(",
"loopHeadBlock",
",",
"afterLoop",
")",
")",
";",
"this",
".",
"loopVariables",
".",
"pop",
"(",
")",
";",
"this",
".",
"link",
"(",
"loopHeadBlock",
",",
"bodyEntry",
")",
";",
"this",
".",
"link",
"(",
"bodyExit",
",",
"loopHeadBlock",
")",
";",
"this",
".",
"link",
"(",
"loopHeadBlock",
",",
"afterLoop",
")",
";",
"return",
"afterLoop",
";",
"}",
"private",
"handleWith",
"(",
"statement",
",",
"last",
",",
"context",
")",
"{",
"const",
"assignments",
"=",
"statement",
".",
"items",
".",
"map",
"(",
"(",
"{",
"with",
":",
"w",
",",
"as",
":",
"a",
"}",
")",
"=>",
"<",
"ast",
".",
"Assignment",
">",
"{",
"type",
":",
"ast",
".",
"ASSIGN",
",",
"targets",
":",
"[",
"a",
"]",
",",
"sources",
":",
"[",
"w",
"]",
",",
"location",
":",
"w",
".",
"location",
",",
"}",
")",
";",
"const",
"resourceBlock",
"=",
"this",
".",
"makeBlock",
"(",
"'with'",
",",
"assignments",
")",
";",
"this",
".",
"link",
"(",
"last",
",",
"resourceBlock",
")",
";",
"const",
"[",
"bodyEntry",
",",
"bodyExit",
"]",
"=",
"this",
".",
"makeCFG",
"(",
"'with body'",
",",
"statement",
".",
"code",
",",
"context",
")",
";",
"this",
".",
"link",
"(",
"resourceBlock",
",",
"bodyEntry",
")",
";",
"return",
"bodyExit",
";",
"}",
"private",
"handleTry",
"(",
"statement",
",",
"last",
",",
"context",
")",
"{",
"const",
"afterTry",
"=",
"this",
".",
"makeBlock",
"(",
"'try join'",
")",
";",
"let",
"exnContext",
"=",
"context",
";",
"let",
"handlerExits",
"=",
"[",
"]",
";",
"let",
"handlerHead",
"=",
"undefined",
";",
"if",
"(",
"statement",
".",
"excepts",
")",
"{",
"handlerHead",
"=",
"this",
".",
"makeBlock",
"(",
"'handlers'",
")",
";",
"const",
"handlerCfgs",
"=",
"statement",
".",
"excepts",
".",
"map",
"(",
"handler",
"=>",
"this",
".",
"makeCFG",
"(",
"'handler body'",
",",
"handler",
".",
"code",
",",
"context",
")",
")",
";",
"handlerCfgs",
".",
"forEach",
"(",
"(",
"[",
"exceptEntry",
",",
"_",
"]",
")",
"=>",
"this",
".",
"link",
"(",
"handlerHead",
",",
"exceptEntry",
")",
")",
";",
"exnContext",
"=",
"context",
".",
"forExcepts",
"(",
"handlerHead",
")",
";",
"handlerExits",
"=",
"handlerCfgs",
".",
"map",
"(",
"(",
"[",
"_",
",",
"exceptExit",
"]",
")",
"=>",
"exceptExit",
")",
";",
"}",
"const",
"[",
"bodyEntry",
",",
"bodyExit",
"]",
"=",
"this",
".",
"makeCFG",
"(",
"'try body'",
",",
"statement",
".",
"code",
",",
"exnContext",
")",
";",
"this",
".",
"link",
"(",
"last",
",",
"bodyEntry",
")",
";",
"let",
"normalExit",
"=",
"bodyExit",
";",
"if",
"(",
"handlerHead",
")",
"{",
"this",
".",
"link",
"(",
"bodyExit",
",",
"handlerHead",
")",
";",
"}",
"if",
"(",
"statement",
".",
"else",
")",
"{",
"const",
"[",
"elseEntry",
",",
"elseExit",
"]",
"=",
"this",
".",
"makeCFG",
"(",
"'try else body'",
",",
"statement",
".",
"else",
",",
"context",
")",
";",
"this",
".",
"link",
"(",
"normalExit",
",",
"elseEntry",
")",
";",
"normalExit",
"=",
"elseExit",
";",
"}",
"if",
"(",
"statement",
".",
"finally",
")",
"{",
"const",
"[",
"finallyEntry",
",",
"finallyExit",
"]",
"=",
"this",
".",
"makeCFG",
"(",
"'finally body'",
",",
"statement",
".",
"finally",
",",
"context",
")",
";",
"this",
".",
"link",
"(",
"normalExit",
",",
"finallyEntry",
")",
";",
"this",
".",
"link",
"(",
"finallyExit",
",",
"afterTry",
")",
";",
"handlerExits",
".",
"forEach",
"(",
"handlerExit",
"=>",
"this",
".",
"link",
"(",
"handlerExit",
",",
"finallyEntry",
")",
")",
";",
"}",
"else",
"{",
"handlerExits",
".",
"forEach",
"(",
"handlerExit",
"=>",
"this",
".",
"link",
"(",
"handlerExit",
",",
"afterTry",
")",
")",
";",
"this",
".",
"link",
"(",
"normalExit",
",",
"afterTry",
")",
";",
"}",
"return",
"afterTry",
";",
"}",
"private",
"makeCFG",
"(",
"hint",
",",
"statements",
",",
"context",
")",
"{",
"if",
"(",
"!",
"hint",
")",
"{",
"throw",
"'hint undefined'",
";",
"}",
"if",
"(",
"!",
"statements",
")",
"{",
"throw",
"'statements undefined'",
";",
"}",
"if",
"(",
"!",
"context",
")",
"{",
"throw",
"'context undefined'",
";",
"}",
"const",
"entry",
"=",
"this",
".",
"makeBlock",
"(",
"hint",
")",
";",
"let",
"last",
"=",
"entry",
";",
"statements",
".",
"forEach",
"(",
"statement",
"=>",
"{",
"switch",
"(",
"statement",
".",
"type",
")",
"{",
"case",
"ast",
".",
"IF",
":",
"last",
"=",
"this",
".",
"handleIf",
"(",
"statement",
",",
"last",
",",
"context",
")",
";",
"break",
";",
"case",
"ast",
".",
"WHILE",
":",
"last",
"=",
"this",
".",
"handleWhile",
"(",
"statement",
",",
"last",
",",
"context",
")",
";",
"break",
";",
"case",
"ast",
".",
"FOR",
":",
"last",
"=",
"this",
".",
"handleFor",
"(",
"statement",
",",
"last",
",",
"context",
")",
";",
"break",
";",
"case",
"ast",
".",
"WITH",
":",
"last",
"=",
"this",
".",
"handleWith",
"(",
"statement",
",",
"last",
",",
"context",
")",
";",
"break",
";",
"case",
"ast",
".",
"TRY",
":",
"last",
"=",
"this",
".",
"handleTry",
"(",
"statement",
",",
"last",
",",
"context",
")",
";",
"break",
";",
"case",
"ast",
".",
"RAISE",
":",
"this",
".",
"link",
"(",
"last",
",",
"context",
".",
"exceptionBlock",
")",
";",
"return",
";",
"case",
"ast",
".",
"BREAK",
":",
"this",
".",
"link",
"(",
"last",
",",
"context",
".",
"loopExit",
")",
";",
"return",
";",
"case",
"ast",
".",
"CONTINUE",
":",
"this",
".",
"link",
"(",
"last",
",",
"context",
".",
"loopHead",
")",
";",
"return",
";",
"case",
"ast",
".",
"DEF",
":",
"case",
"ast",
".",
"CLASS",
":",
"default",
":",
"last",
".",
"statements",
".",
"push",
"(",
"statement",
")",
";",
"break",
";",
"}",
"}",
")",
";",
"return",
"[",
"entry",
",",
"last",
"]",
";",
"}",
"/**\n * Based on the algorithm in \"Engineering a Compiler\", 2nd ed., Cooper and Torczon:\n * - p479: computing dominance\n * - p498-500: dominator trees and frontiers\n * - p544: postdominance and reverse dominance frontier\n */",
"public",
"visitControlDependencies",
"(",
"visit",
")",
"{",
"let",
"blocks",
"=",
"this",
".",
"blocks",
";",
"this",
".",
"postdominators",
"=",
"this",
".",
"findPostdominators",
"(",
"blocks",
")",
";",
"this",
".",
"immediatePostdominators",
"=",
"this",
".",
"getImmediatePostdominators",
"(",
"this",
".",
"postdominators",
".",
"items",
")",
";",
"this",
".",
"reverseDominanceFrontiers",
"=",
"this",
".",
"buildReverseDominanceFrontiers",
"(",
"blocks",
")",
";",
"for",
"(",
"let",
"block",
"of",
"blocks",
")",
"{",
"if",
"(",
"this",
".",
"reverseDominanceFrontiers",
".",
"hasOwnProperty",
"(",
"block",
".",
"id",
")",
")",
"{",
"let",
"frontier",
"=",
"this",
".",
"reverseDominanceFrontiers",
"[",
"block",
".",
"id",
"]",
";",
"for",
"(",
"let",
"frontierBlock",
"of",
"frontier",
".",
"items",
")",
"{",
"for",
"(",
"let",
"controlStmt",
"of",
"frontierBlock",
".",
"statements",
")",
"{",
"for",
"(",
"let",
"stmt",
"of",
"block",
".",
"statements",
")",
"{",
"visit",
"(",
"controlStmt",
",",
"stmt",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"private",
"postdominators",
"=",
"new",
"PostdominatorSet",
"(",
")",
";",
"private",
"immediatePostdominators",
":",
"PostdominatorSet",
";",
"private",
"reverseDominanceFrontiers",
":",
"{",
"[",
"blockId",
"]",
":",
"BlockSet",
";",
"}",
";",
"private",
"postdominatorExists",
"(",
"block",
",",
"postdominator",
")",
"{",
"return",
"(",
"this",
".",
"postdominators",
".",
"filter",
"(",
"p",
"=>",
"p",
".",
"block",
"==",
"block",
"&&",
"p",
".",
"postdominator",
"==",
"postdominator",
")",
".",
"size",
">",
"0",
")",
";",
"}",
"private",
"getImmediatePostdominator",
"(",
"block",
")",
"{",
"let",
"immediatePostdominators",
"=",
"this",
".",
"immediatePostdominators",
".",
"items",
".",
"filter",
"(",
"p",
"=>",
"p",
".",
"block",
"==",
"block",
")",
";",
"return",
"immediatePostdominators",
"[",
"0",
"]",
";",
"}",
"private",
"findPostdominators",
"(",
"blocks",
")",
"{",
"let",
"postdominators",
"=",
"{",
"}",
";",
"for",
"(",
"let",
"block",
"of",
"blocks",
")",
"{",
"postdominators",
"[",
"block",
".",
"id",
"]",
"=",
"new",
"PostdominatorSet",
"(",
")",
";",
"for",
"(",
"let",
"otherBlock",
"of",
"blocks",
")",
"{",
"let",
"distance",
"=",
"block",
".",
"id",
"==",
"otherBlock",
".",
"id",
"?",
"0",
":",
"Infinity",
";",
"postdominators",
"[",
"block",
".",
"id",
"]",
".",
"add",
"(",
"new",
"Postdominator",
"(",
"distance",
",",
"block",
",",
"otherBlock",
")",
")",
";",
"}",
"}",
"let",
"lastBlock",
"=",
"blocks",
".",
"filter",
"(",
"b",
"=>",
"this",
".",
"getSuccessors",
"(",
"b",
")",
".",
"length",
"==",
"0",
")",
"[",
"0",
"]",
";",
"postdominators",
"[",
"lastBlock",
".",
"id",
"]",
"=",
"new",
"PostdominatorSet",
"(",
"new",
"Postdominator",
"(",
"0",
",",
"lastBlock",
",",
"lastBlock",
")",
")",
";",
"let",
"changed",
"=",
"true",
";",
"while",
"(",
"changed",
"==",
"true",
")",
"{",
"changed",
"=",
"false",
";",
"for",
"(",
"let",
"block",
"of",
"blocks",
")",
"{",
"if",
"(",
"block",
"==",
"lastBlock",
")",
"continue",
";",
"let",
"oldPostdominators",
"=",
"postdominators",
"[",
"block",
".",
"id",
"]",
";",
"let",
"successors",
"=",
"this",
".",
"getSuccessors",
"(",
"block",
")",
";",
"let",
"newPostdominators",
"=",
"new",
"PostdominatorSet",
"(",
"...",
"[",
"]",
".",
"concat",
"(",
"...",
"successors",
".",
"map",
"(",
"s",
"=>",
"postdominators",
"[",
"s",
".",
"id",
"]",
".",
"items",
")",
")",
".",
"reduce",
"(",
"(",
"pCounts",
",",
"p",
")",
"=>",
"{",
"let",
"countIndex",
"=",
"pCounts",
".",
"findIndex",
"(",
"record",
"=>",
"{",
"return",
"record",
".",
"p",
".",
"postdominator",
"==",
"p",
".",
"postdominator",
";",
"}",
")",
";",
"let",
"countRecord",
";",
"if",
"(",
"countIndex",
"==",
"-",
"1",
")",
"{",
"countRecord",
"=",
"{",
"p",
":",
"new",
"Postdominator",
"(",
"p",
".",
"distance",
"+",
"1",
",",
"block",
",",
"p",
".",
"postdominator",
")",
",",
"count",
":",
"0",
",",
"}",
";",
"pCounts",
".",
"push",
"(",
"countRecord",
")",
";",
"}",
"else",
"{",
"countRecord",
"=",
"pCounts",
"[",
"countIndex",
"]",
";",
"pCounts",
"[",
"countIndex",
"]",
".",
"p",
".",
"distance",
"=",
"Math",
".",
"min",
"(",
"pCounts",
"[",
"countIndex",
"]",
".",
"p",
".",
"distance",
",",
"p",
".",
"distance",
"+",
"1",
")",
";",
"}",
"countRecord",
".",
"count",
"++",
";",
"return",
"pCounts",
";",
"}",
",",
"[",
"]",
")",
".",
"filter",
"(",
"(",
"p",
")",
"=>",
"{",
"return",
"p",
".",
"count",
"==",
"successors",
".",
"length",
";",
"}",
")",
".",
"map",
"(",
"(",
"p",
")",
"=>",
"{",
"return",
"p",
".",
"p",
";",
"}",
")",
")",
";",
"newPostdominators",
".",
"add",
"(",
"new",
"Postdominator",
"(",
"0",
",",
"block",
",",
"block",
")",
")",
";",
"if",
"(",
"!",
"oldPostdominators",
".",
"equals",
"(",
"newPostdominators",
")",
")",
"{",
"postdominators",
"[",
"block",
".",
"id",
"]",
"=",
"newPostdominators",
";",
"changed",
"=",
"true",
";",
"}",
"}",
"}",
"let",
"result",
"=",
"new",
"PostdominatorSet",
"(",
")",
";",
"Object",
".",
"keys",
"(",
"postdominators",
")",
".",
"forEach",
"(",
"blockId",
"=>",
"{",
"result",
"=",
"result",
".",
"union",
"(",
"postdominators",
"[",
"blockId",
"]",
")",
";",
"}",
")",
";",
"return",
"result",
";",
"}",
"private",
"getImmediatePostdominators",
"(",
"postdominators",
")",
"{",
"let",
"postdominatorsByBlock",
"=",
"postdominators",
".",
"filter",
"(",
"p",
"=>",
"p",
".",
"block",
"!=",
"p",
".",
"postdominator",
")",
".",
"reduce",
"(",
"(",
"dict",
",",
"postdominator",
")",
"=>",
"{",
"if",
"(",
"!",
"dict",
".",
"hasOwnProperty",
"(",
"postdominator",
".",
"block",
".",
"id",
")",
")",
"{",
"dict",
"[",
"postdominator",
".",
"block",
".",
"id",
"]",
"=",
"[",
"]",
";",
"}",
"dict",
"[",
"postdominator",
".",
"block",
".",
"id",
"]",
".",
"push",
"(",
"postdominator",
")",
";",
"return",
"dict",
";",
"}",
",",
"{",
"}",
")",
";",
"let",
"immediatePostdominators",
"=",
"[",
"]",
";",
"Object",
".",
"keys",
"(",
"postdominatorsByBlock",
")",
".",
"forEach",
"(",
"blockId",
"=>",
"{",
"immediatePostdominators",
".",
"push",
"(",
"postdominatorsByBlock",
"[",
"blockId",
"]",
".",
"sort",
"(",
"(",
"a",
",",
"b",
")",
"=>",
"{",
"return",
"a",
".",
"distance",
"-",
"b",
".",
"distance",
";",
"}",
")",
"[",
"0",
"]",
")",
";",
"}",
")",
";",
"return",
"new",
"PostdominatorSet",
"(",
"...",
"immediatePostdominators",
")",
";",
"}",
"private",
"buildReverseDominanceFrontiers",
"(",
"blocks",
")",
"{",
"let",
"frontiers",
"=",
"{",
"}",
";",
"for",
"(",
"let",
"block",
"of",
"blocks",
")",
"{",
"let",
"successors",
"=",
"this",
".",
"getSuccessors",
"(",
"block",
")",
";",
"if",
"(",
"successors",
".",
"length",
">",
"1",
")",
"{",
"let",
"workQueue",
"=",
"successors",
";",
"let",
"scheduled",
"=",
"[",
"]",
";",
"let",
"blockImmediatePostdominator",
"=",
"this",
".",
"getImmediatePostdominator",
"(",
"block",
")",
";",
"while",
"(",
"workQueue",
".",
"length",
">",
"0",
")",
"{",
"let",
"item",
"=",
"workQueue",
".",
"pop",
"(",
")",
";",
"if",
"(",
"this",
".",
"postdominatorExists",
"(",
"block",
",",
"item",
")",
")",
"continue",
";",
"if",
"(",
"!",
"frontiers",
".",
"hasOwnProperty",
"(",
"item",
".",
"id",
")",
")",
"{",
"frontiers",
"[",
"item",
".",
"id",
"]",
"=",
"new",
"BlockSet",
"(",
")",
";",
"}",
"let",
"frontier",
"=",
"frontiers",
"[",
"item",
".",
"id",
"]",
";",
"frontier",
".",
"add",
"(",
"block",
")",
";",
"let",
"immediatePostdominator",
"=",
"this",
".",
"getImmediatePostdominator",
"(",
"item",
")",
";",
"if",
"(",
"immediatePostdominator",
".",
"postdominator",
"!=",
"blockImmediatePostdominator",
".",
"postdominator",
")",
"{",
"this",
".",
"getSuccessors",
"(",
"item",
")",
".",
"forEach",
"(",
"b",
"=>",
"{",
"if",
"(",
"scheduled",
".",
"indexOf",
"(",
"b",
")",
"==",
"-",
"1",
")",
"{",
"scheduled",
".",
"push",
"(",
"b",
")",
";",
"workQueue",
".",
"push",
"(",
"b",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"}",
"}",
"return",
"frontiers",
";",
"}",
"}",
"/**\n * A block and another block that postdominates it. Distance is the length of the longest path\n * from the block to its postdominator.\n */",
"class",
"Postdominator",
"{",
"constructor",
"(",
"distance",
",",
"block",
",",
"postdominator",
")",
"{",
"this",
".",
"distance",
"=",
"distance",
";",
"this",
".",
"block",
"=",
"block",
";",
"this",
".",
"postdominator",
"=",
"postdominator",
";",
"}",
"distance",
":",
"number",
";",
"block",
":",
"Block",
";",
"postdominator",
":",
"Block",
";",
"}",
"/**\n * A set of postdominators\n */",
"class",
"PostdominatorSet",
"extends",
"Set",
"<",
"Postdominator",
">",
"{",
"constructor",
"(",
"...",
"items",
")",
"{",
"super",
"(",
"p",
"=>",
"p",
".",
"block",
".",
"id",
"+",
"','",
"+",
"p",
".",
"postdominator",
".",
"id",
",",
"...",
"items",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
2,
null,
null,
5,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
null,
173,
null,
null,
173,
null,
null,
null,
null,
31,
null,
173,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
31,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4669,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
2,
null,
5,
null,
null,
null,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
5,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
0,
null,
173,
null,
31,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
0,
null,
173,
null,
31,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
0,
null,
173,
null,
31,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
0,
null,
173,
null,
31,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
0,
null,
173,
null,
31,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
31,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
2,
null,
5,
null,
31,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
4,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
173,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
5,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
5,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
5,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
173,
null,
173,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
152 | [
"import",
"{",
"Location",
",",
"Module",
",",
"parse",
"}",
"from",
"'./python-parser'",
";",
"import",
"{",
"ControlFlowGraph",
"}",
"from",
"'./control-flow'",
";",
"import",
"{",
"DataflowAnalyzer",
"}",
"from",
"'./data-flow'",
";",
"import",
"{",
"NumberSet",
",",
"range",
",",
"Set",
"}",
"from",
"'./set'",
";",
"function",
"lineRange",
"(",
"loc",
")",
"{",
"return",
"range",
"(",
"loc",
".",
"first_line",
",",
"loc",
".",
"last_line",
"+",
"(",
"loc",
".",
"last_column",
"?",
"1",
":",
"0",
")",
")",
";",
"}",
"export",
"class",
"LocationSet",
"extends",
"Set",
"<",
"Location",
">",
"{",
"constructor",
"(",
"...",
"items",
")",
"{",
"super",
"(",
"l",
"=>",
"[",
"l",
".",
"first_line",
",",
"l",
".",
"first_column",
",",
"l",
".",
"last_line",
",",
"l",
".",
"last_column",
"]",
".",
"toString",
"(",
")",
",",
"...",
"items",
")",
";",
"}",
"}",
"function",
"within",
"(",
"inner",
",",
"outer",
")",
"{",
"let",
"leftWithin",
"=",
"outer",
".",
"first_line",
"<",
"inner",
".",
"first_line",
"||",
"(",
"outer",
".",
"first_line",
"==",
"inner",
".",
"first_line",
"&&",
"outer",
".",
"first_column",
"<=",
"inner",
".",
"first_column",
")",
";",
"let",
"rightWithin",
"=",
"outer",
".",
"last_line",
">",
"inner",
".",
"last_line",
"||",
"(",
"outer",
".",
"last_line",
"==",
"inner",
".",
"last_line",
"&&",
"outer",
".",
"last_column",
">=",
"inner",
".",
"last_column",
")",
";",
"return",
"leftWithin",
"&&",
"rightWithin",
";",
"}",
"function",
"isPositionBetween",
"(",
"line",
",",
"column",
",",
"start_line",
",",
"start_column",
",",
"end_line",
",",
"end_column",
")",
"{",
"let",
"afterStart",
"=",
"line",
">",
"start_line",
"||",
"(",
"line",
"==",
"start_line",
"&&",
"column",
">=",
"start_column",
")",
";",
"let",
"beforeEnd",
"=",
"line",
"<",
"end_line",
"||",
"(",
"line",
"==",
"end_line",
"&&",
"column",
"<=",
"end_column",
")",
";",
"return",
"afterStart",
"&&",
"beforeEnd",
";",
"}",
"function",
"intersect",
"(",
"l1",
",",
"l2",
")",
"{",
"return",
"(",
"isPositionBetween",
"(",
"l1",
".",
"first_line",
",",
"l1",
".",
"first_column",
",",
"l2",
".",
"first_line",
",",
"l2",
".",
"first_column",
",",
"l2",
".",
"last_line",
",",
"l2",
".",
"last_column",
")",
"||",
"isPositionBetween",
"(",
"l1",
".",
"last_line",
",",
"l1",
".",
"last_column",
",",
"l2",
".",
"first_line",
",",
"l2",
".",
"first_column",
",",
"l2",
".",
"last_line",
",",
"l2",
".",
"last_column",
")",
"||",
"within",
"(",
"l1",
",",
"l2",
")",
"||",
"within",
"(",
"l2",
",",
"l1",
")",
")",
";",
"}",
"export",
"enum",
"SliceDirection",
"{",
"Forward",
",",
"Backward",
"}",
"/**\n * More general slice: given locations of important syntax nodes, find locations of all relevant\n * definitions. Locations can be mapped to lines later.\n * seedLocations are symbol locations.\n */",
"export",
"function",
"slice",
"(",
"ast",
",",
"seedLocations",
"?",
",",
"dataflowAnalyzer",
"?",
",",
"direction",
"=",
"SliceDirection",
".",
"Backward",
")",
"{",
"dataflowAnalyzer",
"=",
"dataflowAnalyzer",
"||",
"new",
"DataflowAnalyzer",
"(",
")",
";",
"const",
"cfg",
"=",
"new",
"ControlFlowGraph",
"(",
"ast",
")",
";",
"const",
"dfa",
"=",
"dataflowAnalyzer",
".",
"analyze",
"(",
"cfg",
")",
".",
"dataflows",
";",
"let",
"acceptLocation",
"=",
"(",
"loc",
")",
"=>",
"true",
";",
"let",
"sliceLocations",
"=",
"new",
"LocationSet",
"(",
")",
";",
"if",
"(",
"seedLocations",
")",
"{",
"let",
"seedStatementLocations",
"=",
"findSeedStatementLocations",
"(",
"seedLocations",
",",
"cfg",
")",
";",
"acceptLocation",
"=",
"loc",
"=>",
"seedStatementLocations",
".",
"some",
"(",
"seedStmtLoc",
"=>",
"intersect",
"(",
"seedStmtLoc",
",",
"loc",
")",
")",
";",
"sliceLocations",
"=",
"new",
"LocationSet",
"(",
"...",
"seedStatementLocations",
".",
"items",
")",
";",
"}",
"let",
"lastSize",
";",
"do",
"{",
"lastSize",
"=",
"sliceLocations",
".",
"size",
";",
"for",
"(",
"let",
"flow",
"of",
"dfa",
".",
"items",
")",
"{",
"const",
"[",
"start",
",",
"end",
"]",
"=",
"direction",
"===",
"SliceDirection",
".",
"Backward",
"?",
"[",
"flow",
".",
"fromNode",
".",
"location",
",",
"flow",
".",
"toNode",
".",
"location",
"]",
":",
"[",
"flow",
".",
"toNode",
".",
"location",
",",
"flow",
".",
"fromNode",
".",
"location",
"]",
";",
"if",
"(",
"acceptLocation",
"(",
"end",
")",
")",
"{",
"sliceLocations",
".",
"add",
"(",
"end",
")",
";",
"}",
"if",
"(",
"sliceLocations",
".",
"some",
"(",
"loc",
"=>",
"within",
"(",
"end",
",",
"loc",
")",
")",
")",
"{",
"sliceLocations",
".",
"add",
"(",
"start",
")",
";",
"}",
"}",
"}",
"while",
"(",
"sliceLocations",
".",
"size",
">",
"lastSize",
")",
";",
"return",
"sliceLocations",
";",
"}",
"function",
"findSeedStatementLocations",
"(",
"seedLocations",
",",
"cfg",
")",
"{",
"let",
"seedStatementLocations",
"=",
"new",
"LocationSet",
"(",
")",
";",
"seedLocations",
".",
"items",
".",
"forEach",
"(",
"seedLoc",
"=>",
"{",
"for",
"(",
"let",
"block",
"of",
"cfg",
".",
"blocks",
")",
"{",
"for",
"(",
"let",
"statement",
"of",
"block",
".",
"statements",
")",
"{",
"if",
"(",
"intersect",
"(",
"seedLoc",
",",
"statement",
".",
"location",
")",
")",
"{",
"seedStatementLocations",
".",
"add",
"(",
"statement",
".",
"location",
")",
";",
"}",
"}",
"}",
"}",
")",
";",
"return",
"seedStatementLocations",
";",
"}",
"/**\n * Slice: given a set of lines in a program, return lines it depends on.\n * OUT OF DATE: use slice() instead of sliceLines().\n */",
"export",
"function",
"sliceLines",
"(",
"code",
",",
"relevantLineNumbers",
")",
"{",
"const",
"ast",
"=",
"parse",
"(",
"code",
")",
";",
"const",
"cfg",
"=",
"new",
"ControlFlowGraph",
"(",
"ast",
")",
";",
"let",
"dataflowAnalyzer",
"=",
"new",
"DataflowAnalyzer",
"(",
")",
";",
"const",
"dfa",
"=",
"dataflowAnalyzer",
".",
"analyze",
"(",
"cfg",
")",
".",
"dataflows",
";",
"let",
"lastSize",
";",
"do",
"{",
"lastSize",
"=",
"relevantLineNumbers",
".",
"size",
";",
"for",
"(",
"let",
"flow",
"of",
"dfa",
".",
"items",
")",
"{",
"const",
"fromLines",
"=",
"lineRange",
"(",
"flow",
".",
"fromNode",
".",
"location",
")",
";",
"const",
"toLines",
"=",
"lineRange",
"(",
"flow",
".",
"toNode",
".",
"location",
")",
";",
"const",
"startLines",
"=",
"toLines",
";",
"const",
"endLines",
"=",
"fromLines",
";",
"if",
"(",
"!",
"relevantLineNumbers",
".",
"intersect",
"(",
"startLines",
")",
".",
"empty",
")",
"{",
"relevantLineNumbers",
"=",
"relevantLineNumbers",
".",
"union",
"(",
"endLines",
")",
";",
"}",
"}",
"}",
"while",
"(",
"relevantLineNumbers",
".",
"size",
">",
"lastSize",
")",
";",
"return",
"relevantLineNumbers",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
46475,
null,
163,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
163,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
163,
null,
163,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
3,
null,
3,
null,
3,
null,
3,
null,
3,
null,
3,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
163,
null,
163,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
318,
null,
12619,
null,
null,
27926,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
42366,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
163,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
163,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
12619,
null,
42366,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
46475,
null,
2,
null,
46475,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
42366,
null,
null,
null,
null,
null,
null,
null,
null,
27926,
null,
null,
null,
null,
null,
null,
null,
30,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
46475,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
46475,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
46475,
null,
null,
null,
null,
46475,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
153 | [
"import",
"{",
"Cell",
"}",
"from",
"'./cell'",
";",
"import",
"{",
"LocationSet",
"}",
"from",
"'./slice'",
";",
"export",
"class",
"CellSlice",
"{",
"/**\n * Construct an instance of a cell slice.\n */",
"constructor",
"(",
"cell",
",",
"slice",
",",
"executionTime",
"?",
")",
"{",
"this",
".",
"cell",
"=",
"cell",
";",
"this",
".",
"_slice",
"=",
"slice",
";",
"this",
".",
"executionTime",
"=",
"executionTime",
";",
"}",
"/**\n * Get the text in the slice of a cell.\n */",
"get",
"textSlice",
"(",
")",
":",
"string",
"{",
"return",
"this",
".",
"getTextSlice",
"(",
"false",
")",
";",
"}",
"/**\n * Get the text of all lines in a slice (no deletions from lines).\n */",
"get",
"textSliceLines",
"(",
")",
":",
"string",
"{",
"return",
"this",
".",
"getTextSlice",
"(",
"true",
")",
";",
"}",
"private",
"getTextSlice",
"(",
"fullLines",
")",
"{",
"let",
"sliceLocations",
"=",
"this",
".",
"slice",
".",
"items",
";",
"let",
"textLines",
"=",
"this",
".",
"cell",
".",
"text",
".",
"split",
"(",
"'\\n'",
")",
";",
"return",
"sliceLocations",
".",
"sort",
"(",
"(",
"l1",
",",
"l2",
")",
"=>",
"l1",
".",
"first_line",
"-",
"l2",
".",
"first_line",
")",
".",
"map",
"(",
"loc",
"=>",
"{",
"const",
"lines",
"=",
"textLines",
".",
"slice",
"(",
"loc",
".",
"first_line",
"-",
"1",
",",
"loc",
".",
"last_line",
"+",
"(",
"loc",
".",
"last_column",
">",
"0",
"?",
"0",
":",
"-",
"1",
")",
")",
";",
"if",
"(",
"!",
"fullLines",
")",
"{",
"if",
"(",
"loc",
".",
"last_line",
"===",
"loc",
".",
"first_line",
")",
"{",
"lines",
"[",
"0",
"]",
"=",
"lines",
"[",
"0",
"]",
".",
"slice",
"(",
"loc",
".",
"first_column",
",",
"loc",
".",
"last_column",
")",
";",
"}",
"else",
"{",
"lines",
"[",
"0",
"]",
"=",
"lines",
"[",
"0",
"]",
".",
"slice",
"(",
"loc",
".",
"first_column",
")",
";",
"const",
"last",
"=",
"lines",
".",
"length",
"-",
"1",
";",
"lines",
"[",
"last",
"]",
"=",
"lines",
"[",
"last",
"]",
".",
"slice",
"(",
"0",
",",
"loc",
".",
"last_column",
")",
";",
"}",
"}",
"return",
"lines",
".",
"join",
"(",
"'\\n'",
")",
";",
"}",
")",
".",
"filter",
"(",
"text",
"=>",
"text",
"!=",
"''",
")",
".",
"join",
"(",
"'\\n'",
")",
";",
"}",
"/**\n * Get the slice.\n */",
"get",
"slice",
"(",
")",
":",
"LocationSet",
"{",
"return",
"this",
".",
"_slice",
";",
"}",
"/**\n * Set the slice.\n */",
"set",
"slice",
"(",
"slice",
")",
"{",
"this",
".",
"_slice",
"=",
"slice",
";",
"}",
"readonly",
"cell",
":",
"Cell",
";",
"readonly",
"executionTime",
":",
"Date",
";",
"private",
"_slice",
":",
"LocationSet",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
352,
null,
12619,
null,
26,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
8,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
154 | [
"import",
"{",
"expect",
"}",
"from",
"'chai'",
";",
"import",
"{",
"SyntaxNode",
",",
"parse",
"}",
"from",
"'../python-parser'",
";",
"import",
"{",
"ControlFlowGraph",
"}",
"from",
"'../control-flow'",
";",
"import",
"{",
"DataflowAnalyzer",
",",
"Dataflow",
",",
"Ref",
",",
"ReferenceType",
",",
"RefSet",
",",
"SymbolType",
"}",
"from",
"'../data-flow'",
";",
"import",
"{",
"Set",
"}",
"from",
"'../set'",
";",
"import",
"{",
"JsonSpecs",
",",
"DefaultSpecs",
"}",
"from",
"'../specs'",
";",
"import",
"{",
"printNode",
"}",
"from",
"'../printNode'",
";",
"import",
"{",
"SymbolTable",
"}",
"from",
"'../symbol-table'",
";",
"describe",
"(",
"'detects dataflow dependencies'",
",",
"(",
")",
"=>",
"{",
"function",
"analyze",
"(",
"...",
"codeLines",
")",
"{",
"let",
"code",
"=",
"codeLines",
".",
"concat",
"(",
"''",
")",
".",
"join",
"(",
"'\\n'",
")",
";",
"let",
"analyzer",
"=",
"new",
"DataflowAnalyzer",
"(",
")",
";",
"printNode",
";",
"return",
"analyzer",
".",
"analyze",
"(",
"new",
"ControlFlowGraph",
"(",
"parse",
"(",
"code",
")",
")",
")",
".",
"dataflows",
";",
"}",
"function",
"analyzeLineDeps",
"(",
"...",
"codeLines",
")",
"{",
"return",
"analyze",
"(",
"...",
"codeLines",
")",
".",
"items",
".",
"map",
"(",
"dep",
"=>",
"[",
"dep",
".",
"toNode",
".",
"location",
".",
"first_line",
",",
"dep",
".",
"fromNode",
".",
"location",
".",
"first_line",
"]",
")",
";",
"}",
"it",
"(",
"'from variable uses to names'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyzeLineDeps",
"(",
"'a = 1'",
",",
"'b = a'",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"[",
"2",
",",
"1",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"'handles multiple statements per line'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyzeLineDeps",
"(",
"'a = 1'",
",",
"'b = a; c = b'",
",",
"'d = c'",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"[",
"2",
",",
"1",
"]",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"[",
"3",
",",
"2",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"'only links from a use to its most recent def'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyzeLineDeps",
"(",
"'a = 2'",
",",
"'a.prop = 3'",
",",
"'a = 4'",
",",
"'b = a'",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"[",
"4",
",",
"3",
"]",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"not",
".",
"deep",
".",
"include",
"(",
"[",
"4",
",",
"1",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"'handles augmenting assignment'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyzeLineDeps",
"(",
"'a = 2'",
",",
"'a += 3'",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"[",
"2",
",",
"1",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"'links between statements, not symbol locations'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyze",
"(",
"'a = 1'",
",",
"'b = a'",
")",
";",
"expect",
"(",
"deps",
".",
"items",
"[",
"0",
"]",
".",
"fromNode",
".",
"location",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"{",
"first_line",
":",
"1",
",",
"first_column",
":",
"0",
",",
"last_line",
":",
"1",
",",
"last_column",
":",
"5",
",",
"}",
")",
";",
"expect",
"(",
"deps",
".",
"items",
"[",
"0",
"]",
".",
"toNode",
".",
"location",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"{",
"first_line",
":",
"2",
",",
"first_column",
":",
"0",
",",
"last_line",
":",
"2",
",",
"last_column",
":",
"5",
",",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'links to a multi-line dependency'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyze",
"(",
"'a = func('",
",",
"' 1)'",
",",
"'b = a'",
")",
";",
"expect",
"(",
"deps",
".",
"items",
"[",
"0",
"]",
".",
"fromNode",
".",
"location",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"{",
"first_line",
":",
"1",
",",
"first_column",
":",
"0",
",",
"last_line",
":",
"2",
",",
"last_column",
":",
"6",
",",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'to a full for-loop declaration'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyze",
"(",
"'for i in range(a, b):'",
",",
"' print(i)'",
")",
";",
"expect",
"(",
"deps",
".",
"items",
"[",
"0",
"]",
".",
"fromNode",
".",
"location",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"{",
"first_line",
":",
"1",
",",
"first_column",
":",
"0",
",",
"last_line",
":",
"1",
",",
"last_column",
":",
"21",
",",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'links from a class use to its def'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyzeLineDeps",
"(",
"'class C(object):'",
",",
"' pass'",
",",
"''",
",",
"'c = C()'",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"[",
"[",
"4",
",",
"1",
"]",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"'links from a function use to its def'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyzeLineDeps",
"(",
"'def func():'",
",",
"' pass'",
",",
"''",
",",
"'func()'",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"[",
"[",
"4",
",",
"1",
"]",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'detects control dependencies'",
",",
"(",
")",
"=>",
"{",
"function",
"analyze",
"(",
"...",
"codeLines",
")",
"{",
"let",
"code",
"=",
"codeLines",
".",
"concat",
"(",
"''",
")",
".",
"join",
"(",
"'\\n'",
")",
";",
"const",
"deps",
"=",
"[",
"]",
";",
"new",
"ControlFlowGraph",
"(",
"parse",
"(",
"code",
")",
")",
".",
"visitControlDependencies",
"(",
"(",
"control",
",",
"stmt",
")",
"=>",
"deps",
".",
"push",
"(",
"[",
"stmt",
".",
"location",
".",
"first_line",
",",
"control",
".",
"location",
".",
"first_line",
"]",
")",
")",
";",
"return",
"deps",
";",
"}",
"it",
"(",
"'to an if-statement'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyze",
"(",
"'if cond:'",
",",
"' print(a)'",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"[",
"[",
"2",
",",
"1",
"]",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"'for multiple statements in a block'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyze",
"(",
"'if cond:'",
",",
"' print(a)'",
",",
"' print(b)'",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"[",
"[",
"2",
",",
"1",
"]",
",",
"[",
"3",
",",
"1",
"]",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"'from an else to an if'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyze",
"(",
"'if cond:'",
",",
"' print(a)'",
",",
"'elif cond2:'",
",",
"' print(b)'",
",",
"'else:'",
",",
"' print(b)'",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"[",
"3",
",",
"1",
"]",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"[",
"5",
",",
"3",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"'not from a join to an if-condition'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyze",
"(",
"'if cond:'",
",",
"' print(a)'",
",",
"'print(b)'",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"[",
"[",
"2",
",",
"1",
"]",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"'not from a join to a for-loop'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyze",
"(",
"'for i in range(10):'",
",",
"' print(a)'",
",",
"'print(b)'",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"[",
"[",
"2",
",",
"1",
"]",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"'to a for-loop'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyze",
"(",
"'for i in range(10):'",
",",
"' print(a)'",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"[",
"2",
",",
"1",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"'skipping non-dependencies'",
",",
"(",
")",
"=>",
"{",
"let",
"deps",
"=",
"analyze",
"(",
"'a = 1'",
",",
"'b = 2'",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"[",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'getDefs'",
",",
"(",
")",
"=>",
"{",
"function",
"getDefsFromStatements",
"(",
"specs",
"?",
",",
"...",
"codeLines",
")",
"{",
"let",
"code",
"=",
"codeLines",
".",
"concat",
"(",
"''",
")",
".",
"join",
"(",
"'\\n'",
")",
";",
"let",
"module",
"=",
"parse",
"(",
"code",
")",
";",
"let",
"analyzer",
"=",
"new",
"DataflowAnalyzer",
"(",
"specs",
"||",
"DefaultSpecs",
")",
";",
"return",
"module",
".",
"code",
".",
"reduce",
"(",
"(",
"refSet",
",",
"stmt",
")",
"=>",
"{",
"const",
"refs",
"=",
"analyzer",
".",
"getDefs",
"(",
"stmt",
",",
"refSet",
")",
";",
"return",
"refSet",
".",
"union",
"(",
"refs",
")",
";",
"}",
",",
"new",
"RefSet",
"(",
")",
")",
".",
"items",
";",
"}",
"function",
"getDefsFromStatement",
"(",
"code",
",",
"mmap",
"?",
")",
"{",
"mmap",
"=",
"mmap",
"||",
"DefaultSpecs",
";",
"code",
"=",
"code",
"+",
"'\\n'",
";",
"let",
"mod",
"=",
"parse",
"(",
"code",
")",
";",
"let",
"analyzer",
"=",
"new",
"DataflowAnalyzer",
"(",
"mmap",
")",
";",
"return",
"analyzer",
".",
"getDefs",
"(",
"mod",
".",
"code",
"[",
"0",
"]",
",",
"new",
"RefSet",
"(",
")",
")",
".",
"items",
";",
"}",
"function",
"getDefNamesFromStatement",
"(",
"code",
",",
"mmap",
"?",
")",
"{",
"return",
"getDefsFromStatement",
"(",
"code",
",",
"mmap",
")",
".",
"map",
"(",
"def",
"=>",
"def",
".",
"name",
")",
";",
"}",
"describe",
"(",
"'detects definitions'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'for assignments'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefsFromStatement",
"(",
"'a = 1'",
")",
";",
"expect",
"(",
"defs",
"[",
"0",
"]",
")",
".",
"to",
".",
"include",
"(",
"{",
"type",
":",
"SymbolType",
".",
"VARIABLE",
",",
"name",
":",
"'a'",
",",
"level",
":",
"ReferenceType",
".",
"DEFINITION",
",",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'for augmenting assignments'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefsFromStatement",
"(",
"'a += 1'",
")",
";",
"expect",
"(",
"defs",
"[",
"0",
"]",
")",
".",
"to",
".",
"include",
"(",
"{",
"type",
":",
"SymbolType",
".",
"VARIABLE",
",",
"name",
":",
"'a'",
",",
"level",
":",
"ReferenceType",
".",
"UPDATE",
",",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'for imports'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefsFromStatement",
"(",
"'import lib'",
")",
";",
"expect",
"(",
"defs",
"[",
"0",
"]",
")",
".",
"to",
".",
"include",
"(",
"{",
"type",
":",
"SymbolType",
".",
"IMPORT",
",",
"name",
":",
"'lib'",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'for from-imports'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefsFromStatement",
"(",
"'from mod import func'",
")",
";",
"expect",
"(",
"defs",
"[",
"0",
"]",
")",
".",
"to",
".",
"include",
"(",
"{",
"type",
":",
"SymbolType",
".",
"IMPORT",
",",
"name",
":",
"'func'",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'for function declarations'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefsFromStatement",
"(",
"[",
"'def func():'",
",",
"' return 0'",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"expect",
"(",
"defs",
"[",
"0",
"]",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"{",
"type",
":",
"SymbolType",
".",
"FUNCTION",
",",
"name",
":",
"'func'",
",",
"location",
":",
"{",
"first_line",
":",
"1",
",",
"first_column",
":",
"0",
",",
"last_line",
":",
"4",
",",
"last_column",
":",
"-",
"1",
",",
"}",
",",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'for class declarations'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefsFromStatement",
"(",
"[",
"'class C(object):'",
",",
"' def __init__(self):'",
",",
"' pass'",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"expect",
"(",
"defs",
"[",
"0",
"]",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"{",
"type",
":",
"SymbolType",
".",
"CLASS",
",",
"name",
":",
"'C'",
",",
"location",
":",
"{",
"first_line",
":",
"1",
",",
"first_column",
":",
"0",
",",
"last_line",
":",
"5",
",",
"last_column",
":",
"-",
"1",
",",
"}",
",",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'that are weak (marked as updates)'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'for dictionary assignments'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefsFromStatement",
"(",
"[",
"\"d['a'] = 1\"",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"expect",
"(",
"defs",
".",
"length",
")",
".",
"to",
".",
"equal",
"(",
"1",
")",
";",
"expect",
"(",
"defs",
"[",
"0",
"]",
".",
"level",
")",
".",
"to",
".",
"equal",
"(",
"ReferenceType",
".",
"UPDATE",
")",
";",
"expect",
"(",
"defs",
"[",
"0",
"]",
".",
"name",
")",
".",
"to",
".",
"equal",
"(",
"'d'",
")",
";",
"}",
")",
";",
"it",
"(",
"'for property assignments'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefsFromStatement",
"(",
"[",
"'obj.a = 1'",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"expect",
"(",
"defs",
".",
"length",
")",
".",
"to",
".",
"equal",
"(",
"1",
")",
";",
"expect",
"(",
"defs",
"[",
"0",
"]",
".",
"level",
")",
".",
"to",
".",
"equal",
"(",
"ReferenceType",
".",
"UPDATE",
")",
";",
"expect",
"(",
"defs",
"[",
"0",
"]",
".",
"name",
")",
".",
"to",
".",
"equal",
"(",
"'obj'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'from annotations'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'from our def annotations'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefsFromStatement",
"(",
"'\"\"\"defs: [{ \"name\": \"a\", \"pos\": [[0, 0], [0, 11]] }]\"\"\"%some_magic'",
")",
";",
"expect",
"(",
"defs",
"[",
"0",
"]",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"{",
"type",
":",
"SymbolType",
".",
"MAGIC",
",",
"name",
":",
"'a'",
",",
"location",
":",
"{",
"first_line",
":",
"1",
",",
"first_column",
":",
"0",
",",
"last_line",
":",
"1",
",",
"last_column",
":",
"11",
",",
"}",
",",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'computing the def location relative to the line it appears on'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefsFromStatements",
"(",
"undefined",
",",
"'# this is an empty line'",
",",
"'\"\"\"defs: [{ \"name\": \"a\", \"pos\": [[0, 0], [0, 11]] }]\"\"\"%some_magic'",
")",
";",
"expect",
"(",
"defs",
"[",
"0",
"]",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"{",
"location",
":",
"{",
"first_line",
":",
"2",
",",
"first_column",
":",
"0",
",",
"last_line",
":",
"2",
",",
"last_column",
":",
"11",
",",
"}",
",",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'including'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'function arguments'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefNamesFromStatement",
"(",
"'func(a)'",
")",
";",
"expect",
"(",
"defs",
".",
"length",
")",
".",
"to",
".",
"equal",
"(",
"1",
")",
";",
"}",
")",
";",
"it",
"(",
"'the object a function is called on'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefNamesFromStatement",
"(",
"'obj.func()'",
")",
";",
"expect",
"(",
"defs",
".",
"length",
")",
".",
"to",
".",
"equal",
"(",
"1",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'; given a spec,'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'can ignore all arguments'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefsFromStatement",
"(",
"'func(a, b, c)'",
",",
"{",
"__builtins__",
":",
"{",
"functions",
":",
"[",
"'func'",
"]",
"}",
"}",
")",
";",
"expect",
"(",
"defs",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"[",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"'assumes arguments have side-effects, without a spec'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefsFromStatement",
"(",
"'func(a, b, c)'",
",",
"{",
"__builtins__",
":",
"{",
"functions",
":",
"[",
"]",
"}",
"}",
")",
";",
"expect",
"(",
"defs",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"defs",
".",
"length",
")",
".",
"to",
".",
"equal",
"(",
"3",
")",
";",
"const",
"names",
"=",
"defs",
".",
"map",
"(",
"d",
"=>",
"d",
".",
"name",
")",
";",
"expect",
"(",
"names",
")",
".",
"to",
".",
"include",
"(",
"'a'",
")",
";",
"expect",
"(",
"names",
")",
".",
"to",
".",
"include",
"(",
"'b'",
")",
";",
"expect",
"(",
"names",
")",
".",
"to",
".",
"include",
"(",
"'c'",
")",
";",
"}",
")",
";",
"it",
"(",
"'can ignore the method receiver'",
",",
"(",
")",
"=>",
"{",
"const",
"specs",
"=",
"{",
"__builtins__",
":",
"{",
"types",
":",
"{",
"C",
":",
"{",
"methods",
":",
"[",
"'m'",
"]",
"}",
"}",
"}",
"}",
";",
"let",
"defs",
"=",
"getDefsFromStatements",
"(",
"specs",
",",
"'x=C()'",
",",
"'x.m()'",
")",
";",
"expect",
"(",
"defs",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"defs",
".",
"length",
")",
".",
"to",
".",
"equal",
"(",
"1",
")",
";",
"expect",
"(",
"defs",
"[",
"0",
"]",
".",
"name",
")",
".",
"to",
".",
"equal",
"(",
"'x'",
")",
";",
"expect",
"(",
"defs",
"[",
"0",
"]",
".",
"level",
")",
".",
"to",
".",
"equal",
"(",
"ReferenceType",
".",
"DEFINITION",
")",
";",
"}",
")",
";",
"it",
"(",
"'assumes method call affects the receiver, without a spec'",
",",
"(",
")",
"=>",
"{",
"const",
"specs",
"=",
"{",
"__builtins__",
":",
"{",
"}",
"}",
";",
"let",
"defs",
"=",
"getDefsFromStatements",
"(",
"specs",
",",
"'x=C()'",
",",
"'x.m()'",
")",
";",
"expect",
"(",
"defs",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"defs",
".",
"length",
")",
".",
"to",
".",
"equal",
"(",
"2",
")",
";",
"expect",
"(",
"defs",
"[",
"1",
"]",
".",
"name",
")",
".",
"to",
".",
"equal",
"(",
"'x'",
")",
";",
"expect",
"(",
"defs",
"[",
"1",
"]",
".",
"level",
")",
".",
"to",
".",
"equal",
"(",
"ReferenceType",
".",
"UPDATE",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"\"doesn't detect definitions\"",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'for names used outside a function call'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefNamesFromStatement",
"(",
"'a + func()'",
")",
";",
"expect",
"(",
"defs",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"[",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"'for functions called early in a call chain'",
",",
"(",
")",
"=>",
"{",
"let",
"defs",
"=",
"getDefNamesFromStatement",
"(",
"'func().func()'",
")",
";",
"expect",
"(",
"defs",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"[",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'getUses'",
",",
"(",
")",
"=>",
"{",
"function",
"getUseNames",
"(",
"...",
"codeLines",
")",
"{",
"let",
"code",
"=",
"codeLines",
".",
"concat",
"(",
"''",
")",
".",
"join",
"(",
"'\\n'",
")",
";",
"let",
"mod",
"=",
"parse",
"(",
"code",
")",
";",
"let",
"analyzer",
"=",
"new",
"DataflowAnalyzer",
"(",
")",
";",
"return",
"analyzer",
".",
"getUses",
"(",
"mod",
".",
"code",
"[",
"0",
"]",
")",
".",
"items",
".",
"map",
"(",
"use",
"=>",
"use",
".",
"name",
")",
";",
"}",
"describe",
"(",
"'detects uses'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'of functions'",
",",
"(",
")",
"=>",
"{",
"let",
"uses",
"=",
"getUseNames",
"(",
"'func()'",
")",
";",
"expect",
"(",
"uses",
")",
".",
"to",
".",
"include",
"(",
"'func'",
")",
";",
"}",
")",
";",
"it",
"(",
"'for undefined symbols in functions'",
",",
"(",
")",
"=>",
"{",
"let",
"uses",
"=",
"getUseNames",
"(",
"'def func(arg):'",
",",
"' print(a)'",
")",
";",
"expect",
"(",
"uses",
")",
".",
"to",
".",
"include",
"(",
"'a'",
")",
";",
"}",
")",
";",
"it",
"(",
"'handles augassign'",
",",
"(",
")",
"=>",
"{",
"let",
"uses",
"=",
"getUseNames",
"(",
"'x -= 1'",
")",
";",
"expect",
"(",
"uses",
")",
".",
"to",
".",
"include",
"(",
"'x'",
")",
";",
"}",
")",
";",
"it",
"(",
"'of functions inside classes'",
",",
"(",
")",
"=>",
"{",
"let",
"uses",
"=",
"getUseNames",
"(",
"'class Baz():'",
",",
"' def quux(self):'",
",",
"' func()'",
")",
";",
"expect",
"(",
"uses",
")",
".",
"to",
".",
"include",
"(",
"'func'",
")",
";",
"}",
")",
";",
"it",
"(",
"'of variables inside classes'",
",",
"(",
")",
"=>",
"{",
"let",
"uses",
"=",
"getUseNames",
"(",
"'class Baz():'",
",",
"' def quux(self):'",
",",
"' self.data = a'",
")",
";",
"expect",
"(",
"uses",
")",
".",
"to",
".",
"include",
"(",
"'a'",
")",
";",
"}",
")",
";",
"it",
"(",
"'of functions and variables inside nested classes'",
",",
"(",
")",
"=>",
"{",
"let",
"uses",
"=",
"getUseNames",
"(",
"'class Bar():'",
",",
"' class Baz():'",
",",
"' class Qux():'",
",",
"' def quux(self):'",
",",
"' func()'",
",",
"' self.data = a'",
")",
";",
"expect",
"(",
"uses",
")",
".",
"to",
".",
"include",
"(",
"'func'",
")",
";",
"expect",
"(",
"uses",
")",
".",
"to",
".",
"include",
"(",
"'a'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'ignores uses'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'for symbols defined within functions'",
",",
"(",
")",
"=>",
"{",
"let",
"uses",
"=",
"getUseNames",
"(",
"'def func(arg):'",
",",
"' print(arg)'",
",",
"' var = 1'",
",",
"' print(var)'",
")",
";",
"expect",
"(",
"uses",
")",
".",
"to",
".",
"not",
".",
"include",
"(",
"'arg'",
")",
";",
"expect",
"(",
"uses",
")",
".",
"to",
".",
"not",
".",
"include",
"(",
"'var'",
")",
";",
"}",
")",
";",
"it",
"(",
"'for params used in an instance function body'",
",",
"(",
")",
"=>",
"{",
"let",
"uses",
"=",
"getUseNames",
"(",
"'class Foo():'",
",",
"' def func(arg1):'",
",",
"' print(arg1)'",
")",
";",
"expect",
"(",
"uses",
")",
".",
"to",
".",
"not",
".",
"include",
"(",
"'arg1'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27926,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
30,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2143,
null,
2143,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
0,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27926,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13908,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
2,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27926,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27926,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
155 | [
"import",
"{",
"Cell",
"}",
"from",
"\"..\"",
";",
"export",
"class",
"TestCell",
"implements",
"Cell",
"{",
"public",
"executionEventId",
":",
"string",
";",
"public",
"persistentId",
":",
"string",
";",
"constructor",
"(",
"public",
"text",
",",
"public",
"executionCount",
",",
"executionEventId",
"?",
",",
"persistentId",
"?",
",",
"public",
"hasError",
"=",
"false",
")",
"{",
"this",
".",
"executionEventId",
"=",
"executionEventId",
"||",
"genid",
"(",
")",
";",
"this",
".",
"persistentId",
"=",
"persistentId",
"||",
"genid",
"(",
")",
";",
"}",
"public",
"deepCopy",
"(",
")",
"{",
"return",
"this",
";",
"}",
"}",
"let",
"ID",
"=",
"0",
";",
"function",
"genid",
"(",
")",
"{",
"return",
"'id'",
"+",
"(",
"ID",
"++",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
3,
null,
2,
null,
null,
2,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
156 | [
"import",
"{",
"expect",
"}",
"from",
"'chai'",
";",
"import",
"{",
"LocationSet",
"}",
"from",
"'../slice'",
";",
"import",
"{",
"CellSlice",
"}",
"from",
"'../cellslice'",
";",
"import",
"{",
"TestCell",
"}",
"from",
"'./testcell'",
";",
"describe",
"(",
"'CellSlice'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'yields a text slice based on a set of locations'",
",",
"(",
")",
"=>",
"{",
"let",
"cellSlice",
"=",
"new",
"CellSlice",
"(",
"new",
"TestCell",
"(",
"[",
"'a = 1'",
",",
"'b = 2'",
",",
"'c = 3'",
",",
"'d = 4'",
",",
"''",
"]",
".",
"join",
"(",
"'\\n'",
")",
",",
"1",
")",
",",
"new",
"LocationSet",
"(",
"{",
"first_line",
":",
"1",
",",
"first_column",
":",
"0",
",",
"last_line",
":",
"1",
",",
"last_column",
":",
"5",
"}",
",",
"{",
"first_line",
":",
"2",
",",
"first_column",
":",
"4",
",",
"last_line",
":",
"3",
",",
"last_column",
":",
"4",
"}",
")",
")",
";",
"expect",
"(",
"cellSlice",
".",
"textSlice",
")",
".",
"to",
".",
"equal",
"(",
"[",
"'a = 1'",
",",
"'2'",
",",
"'c = '",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'yields entire lines if requested'",
",",
"(",
")",
"=>",
"{",
"let",
"cellSlice",
"=",
"new",
"CellSlice",
"(",
"new",
"TestCell",
"(",
"[",
"'a = 1'",
",",
"'b = 2'",
",",
"'c = 3'",
",",
"'d = 4'",
",",
"''",
"]",
".",
"join",
"(",
"'\\n'",
")",
",",
"1",
")",
",",
"new",
"LocationSet",
"(",
"{",
"first_line",
":",
"1",
",",
"first_column",
":",
"0",
",",
"last_line",
":",
"1",
",",
"last_column",
":",
"5",
"}",
",",
"{",
"first_line",
":",
"2",
",",
"first_column",
":",
"4",
",",
"last_line",
":",
"3",
",",
"last_column",
":",
"4",
"}",
")",
")",
";",
"expect",
"(",
"cellSlice",
".",
"textSliceLines",
")",
".",
"to",
".",
"equal",
"(",
"[",
"'a = 1'",
",",
"'b = 2'",
",",
"'c = 3'",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
157 | [
"import",
"{",
"expect",
"}",
"from",
"'chai'",
";",
"import",
"{",
"parse",
",",
"Def",
"}",
"from",
"'../python-parser'",
";",
"import",
"{",
"ControlFlowGraph",
"}",
"from",
"'../control-flow'",
";",
"describe",
"(",
"'ControlFlowGraph'",
",",
"(",
")",
"=>",
"{",
"function",
"makeCfg",
"(",
"...",
"codeLines",
")",
"{",
"let",
"code",
"=",
"codeLines",
".",
"concat",
"(",
"''",
")",
".",
"join",
"(",
"'\\n'",
")",
";",
"return",
"new",
"ControlFlowGraph",
"(",
"parse",
"(",
"code",
")",
")",
";",
"}",
"it",
"(",
"'builds the right successor structure for try-except'",
",",
"(",
")",
"=>",
"{",
"let",
"cfg",
"=",
"makeCfg",
"(",
"'try:'",
",",
"' return 0'",
",",
"'except:'",
",",
"' return 1'",
")",
";",
"let",
"handlerHead",
"=",
"cfg",
".",
"blocks",
".",
"filter",
"(",
"b",
"=>",
"b",
".",
"hint",
"==",
"'handlers'",
")",
".",
"pop",
"(",
")",
";",
"expect",
"(",
"cfg",
".",
"getPredecessors",
"(",
"handlerHead",
")",
".",
"pop",
"(",
")",
".",
"hint",
")",
".",
"to",
".",
"equal",
"(",
"'try body'",
")",
";",
"}",
")",
";",
"it",
"(",
"'builds a cfg for a function body'",
",",
"(",
")",
"=>",
"{",
"let",
"ast",
"=",
"parse",
"(",
"[",
"'def foo(n):'",
",",
"' if n < 4:'",
",",
"' return 1'",
",",
"' else:'",
",",
"' return 2'",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"expect",
"(",
"ast",
".",
"code",
".",
"length",
")",
".",
"to",
".",
"be",
".",
"equal",
"(",
"1",
")",
";",
"expect",
"(",
"ast",
".",
"code",
"[",
"0",
"]",
".",
"type",
")",
".",
"to",
".",
"be",
".",
"equal",
"(",
"'def'",
")",
";",
"const",
"cfg",
"=",
"new",
"ControlFlowGraph",
"(",
"ast",
".",
"code",
"[",
"0",
"]",
"as",
"Def",
")",
";",
"expect",
"(",
"cfg",
".",
"blocks",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"cfg",
".",
"blocks",
".",
"length",
")",
".",
"to",
".",
"be",
".",
"equal",
"(",
"6",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
42366,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
42366,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
42366,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
158 | [
"import",
"{",
"Graph",
"}",
"from",
"\"../graph\"",
";",
"import",
"{",
"expect",
"}",
"from",
"\"chai\"",
";",
"describe",
"(",
"'graph'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'handles empty'",
",",
"(",
")",
"=>",
"{",
"const",
"g",
"=",
"new",
"Graph",
"<",
"string",
">",
"(",
"s",
"=>",
"s",
")",
";",
"expect",
"(",
"g",
".",
"nodes",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"g",
".",
"nodes",
".",
"length",
")",
".",
"eq",
"(",
"0",
")",
";",
"}",
")",
";",
"it",
"(",
"'tracks nodes'",
",",
"(",
")",
"=>",
"{",
"const",
"g",
"=",
"new",
"Graph",
"<",
"string",
">",
"(",
"s",
"=>",
"s",
")",
";",
"g",
".",
"addEdge",
"(",
"'a'",
",",
"'b'",
")",
";",
"g",
".",
"addEdge",
"(",
"'b'",
",",
"'c'",
")",
";",
"const",
"ns",
"=",
"g",
".",
"nodes",
";",
"expect",
"(",
"ns",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"ns",
".",
"length",
")",
".",
"equals",
"(",
"3",
")",
";",
"expect",
"(",
"ns",
")",
".",
"to",
".",
"include",
"(",
"'a'",
")",
";",
"expect",
"(",
"ns",
")",
".",
"to",
".",
"include",
"(",
"'b'",
")",
";",
"expect",
"(",
"ns",
")",
".",
"to",
".",
"include",
"(",
"'c'",
")",
";",
"}",
")",
";",
"it",
"(",
"'sorts forests'",
",",
"(",
")",
"=>",
"{",
"const",
"g",
"=",
"new",
"Graph",
"<",
"string",
">",
"(",
"s",
"=>",
"s",
")",
";",
"g",
".",
"addEdge",
"(",
"'a'",
",",
"'b'",
")",
";",
"g",
".",
"addEdge",
"(",
"'c'",
",",
"'d'",
")",
";",
"const",
"s",
"=",
"g",
".",
"topoSort",
"(",
")",
";",
"expect",
"(",
"s",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"s",
".",
"length",
")",
".",
"eq",
"(",
"4",
")",
";",
"expect",
"(",
"s",
")",
".",
"to",
".",
"include",
"(",
"'a'",
")",
";",
"expect",
"(",
"s",
")",
".",
"to",
".",
"include",
"(",
"'b'",
")",
";",
"expect",
"(",
"s",
")",
".",
"to",
".",
"include",
"(",
"'c'",
")",
";",
"expect",
"(",
"s",
")",
".",
"to",
".",
"include",
"(",
"'d'",
")",
";",
"expect",
"(",
"s",
".",
"indexOf",
"(",
"'a'",
")",
"<",
"s",
".",
"indexOf",
"(",
"'b'",
")",
",",
"\"a before b\"",
")",
";",
"expect",
"(",
"s",
".",
"indexOf",
"(",
"'c'",
")",
"<",
"s",
".",
"indexOf",
"(",
"'d'",
")",
",",
"\"c before d\"",
")",
";",
"}",
")",
";",
"it",
"(",
"'sorts dags'",
",",
"(",
")",
"=>",
"{",
"const",
"g",
"=",
"new",
"Graph",
"<",
"string",
">",
"(",
"s",
"=>",
"s",
")",
";",
"g",
".",
"addEdge",
"(",
"'a'",
",",
"'b'",
")",
";",
"g",
".",
"addEdge",
"(",
"'b'",
",",
"'c'",
")",
";",
"g",
".",
"addEdge",
"(",
"'a'",
",",
"'c'",
")",
";",
"const",
"s",
"=",
"g",
".",
"topoSort",
"(",
")",
";",
"expect",
"(",
"s",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"s",
".",
"length",
")",
".",
"eq",
"(",
"3",
")",
";",
"expect",
"(",
"s",
"[",
"0",
"]",
")",
".",
"eq",
"(",
"'a'",
")",
";",
"expect",
"(",
"s",
"[",
"1",
"]",
")",
".",
"eq",
"(",
"'b'",
")",
";",
"expect",
"(",
"s",
"[",
"2",
"]",
")",
".",
"eq",
"(",
"'c'",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
356,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
356,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
356,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
356,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
159 | [
"import",
"{",
"ExecutionLogSlicer",
"}",
"from",
"'../log-slicer'",
";",
"import",
"{",
"Location",
",",
"DataflowAnalyzer",
"}",
"from",
"'..'",
";",
"import",
"{",
"expect",
"}",
"from",
"'chai'",
";",
"import",
"{",
"TestCell",
"}",
"from",
"'./testcell'",
";",
"function",
"loc",
"(",
"line0",
",",
"col0",
",",
"line1",
"=",
"line0",
"+",
"1",
",",
"col1",
"=",
"0",
")",
"{",
"return",
"{",
"first_line",
":",
"line0",
",",
"first_column",
":",
"col0",
",",
"last_line",
":",
"line1",
",",
"last_column",
":",
"col1",
"}",
";",
"}",
"function",
"makeLog",
"(",
"lines",
")",
"{",
"const",
"cells",
"=",
"lines",
".",
"map",
"(",
"(",
"text",
",",
"i",
")",
"=>",
"new",
"TestCell",
"(",
"text",
",",
"i",
"+",
"1",
")",
")",
";",
"const",
"logSlicer",
"=",
"new",
"ExecutionLogSlicer",
"(",
"new",
"DataflowAnalyzer",
"(",
")",
")",
";",
"cells",
".",
"forEach",
"(",
"cell",
"=>",
"logSlicer",
".",
"logExecution",
"(",
"cell",
")",
")",
";",
"return",
"logSlicer",
";",
"}",
"describe",
"(",
"'log-slicer'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'does the basics'",
",",
"(",
")",
"=>",
"{",
"const",
"lines",
"=",
"[",
"'x=5'",
",",
"'y=6'",
",",
"'print(x+y)'",
"]",
";",
"const",
"logSlicer",
"=",
"makeLog",
"(",
"lines",
")",
";",
"const",
"lastCell",
"=",
"logSlicer",
".",
"cellExecutions",
"[",
"logSlicer",
".",
"cellExecutions",
".",
"length",
"-",
"1",
"]",
".",
"cell",
";",
"const",
"slices",
"=",
"logSlicer",
".",
"sliceAllExecutions",
"(",
"lastCell",
".",
"persistentId",
")",
";",
"expect",
"(",
"slices",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"slices",
".",
"length",
")",
".",
"eq",
"(",
"1",
")",
";",
"const",
"slice",
"=",
"slices",
"[",
"0",
"]",
";",
"expect",
"(",
"slice",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"slice",
".",
"cellSlices",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"slice",
".",
"cellSlices",
".",
"length",
")",
".",
"eq",
"(",
"3",
")",
";",
"slice",
".",
"cellSlices",
".",
"forEach",
"(",
"(",
"cs",
",",
"i",
")",
"=>",
"{",
"expect",
"(",
"cs",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"cs",
".",
"textSliceLines",
")",
".",
"eq",
"(",
"lines",
"[",
"i",
"]",
")",
";",
"expect",
"(",
"cs",
".",
"textSlice",
")",
".",
"eq",
"(",
"lines",
"[",
"i",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"\"does jim's demo\"",
",",
"(",
")",
"=>",
"{",
"const",
"lines",
"=",
"[",
"\"import pandas as pd\"",
",",
"\"Cars = {'Brand': ['Honda Civic','Toyota Corolla','Ford Focus','Audi A4'], 'Price': [22000,25000,27000,35000]}\\n\"",
"+",
"\"df = pd.DataFrame(Cars,columns= ['Brand', 'Price'])\"",
",",
"\"def check(df, size=11):\\n\"",
"+",
"\" print(df)\"",
",",
"\"print(df)\"",
",",
"\"x = df['Brand'].values\"",
"]",
";",
"const",
"logSlicer",
"=",
"makeLog",
"(",
"lines",
")",
";",
"const",
"lastCell",
"=",
"logSlicer",
".",
"cellExecutions",
"[",
"logSlicer",
".",
"cellExecutions",
".",
"length",
"-",
"1",
"]",
".",
"cell",
";",
"const",
"slice",
"=",
"logSlicer",
".",
"sliceLatestExecution",
"(",
"lastCell",
".",
"persistentId",
")",
";",
"expect",
"(",
"slice",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"slice",
".",
"cellSlices",
")",
".",
"to",
".",
"exist",
";",
"[",
"1",
",",
"2",
",",
"5",
"]",
".",
"forEach",
"(",
"(",
"c",
",",
"i",
")",
"=>",
"expect",
"(",
"slice",
".",
"cellSlices",
"[",
"i",
"]",
".",
"textSlice",
")",
".",
"eq",
"(",
"lines",
"[",
"c",
"-",
"1",
"]",
")",
")",
";",
"const",
"cellCounts",
"=",
"slice",
".",
"cellSlices",
".",
"map",
"(",
"cell",
"=>",
"cell",
".",
"cell",
".",
"executionCount",
")",
";",
"[",
"3",
",",
"4",
"]",
".",
"forEach",
"(",
"c",
"=>",
"expect",
"(",
"cellCounts",
")",
".",
"to",
".",
"not",
".",
"include",
"(",
"c",
")",
")",
";",
"}",
")",
";",
"describe",
"(",
"\"getDependentCells\"",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"\"handles simple in-order\"",
",",
"(",
")",
"=>",
"{",
"const",
"lines",
"=",
"[",
"\"x = 3\"",
",",
"\"y = x+1\"",
"]",
";",
"const",
"logSlicer",
"=",
"makeLog",
"(",
"lines",
")",
";",
"const",
"deps",
"=",
"logSlicer",
".",
"getDependentCells",
"(",
"logSlicer",
".",
"cellExecutions",
"[",
"0",
"]",
".",
"cell",
".",
"executionEventId",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"1",
")",
";",
"expect",
"(",
"deps",
"[",
"0",
"]",
".",
"text",
")",
".",
"to",
".",
"equal",
"(",
"lines",
"[",
"1",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"\"handles variable redefinition\"",
",",
"(",
")",
"=>",
"{",
"const",
"lines",
"=",
"[",
"\"x = 3\"",
",",
"\"y = x+1\"",
",",
"\"x = 4\"",
",",
"\"y = x*2\"",
",",
"]",
";",
"const",
"logSlicer",
"=",
"makeLog",
"(",
"lines",
")",
";",
"const",
"deps",
"=",
"logSlicer",
".",
"getDependentCells",
"(",
"logSlicer",
".",
"cellExecutions",
"[",
"0",
"]",
".",
"cell",
".",
"executionEventId",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"1",
")",
";",
"expect",
"(",
"deps",
"[",
"0",
"]",
".",
"text",
")",
".",
"to",
".",
"equal",
"(",
"lines",
"[",
"1",
"]",
")",
";",
"const",
"deps2",
"=",
"logSlicer",
".",
"getDependentCells",
"(",
"logSlicer",
".",
"cellExecutions",
"[",
"2",
"]",
".",
"cell",
".",
"executionEventId",
")",
";",
"expect",
"(",
"deps2",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"deps2",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"1",
")",
";",
"expect",
"(",
"deps2",
"[",
"0",
"]",
".",
"text",
")",
".",
"to",
".",
"equal",
"(",
"lines",
"[",
"3",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"\"handles no deps\"",
",",
"(",
")",
"=>",
"{",
"const",
"lines",
"=",
"[",
"\"x = 3\\nprint(x)\"",
",",
"\"y = 2\\nprint(y)\"",
",",
"]",
";",
"const",
"logSlicer",
"=",
"makeLog",
"(",
"lines",
")",
";",
"const",
"deps",
"=",
"logSlicer",
".",
"getDependentCells",
"(",
"logSlicer",
".",
"cellExecutions",
"[",
"0",
"]",
".",
"cell",
".",
"executionEventId",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"0",
")",
";",
"}",
")",
";",
"it",
"(",
"\"works transitively\"",
",",
"(",
")",
"=>",
"{",
"const",
"lines",
"=",
"[",
"\"x = 3\"",
",",
"\"y = x+1\"",
",",
"\"z = y-1\"",
"]",
";",
"const",
"logSlicer",
"=",
"makeLog",
"(",
"lines",
")",
";",
"const",
"deps",
"=",
"logSlicer",
".",
"getDependentCells",
"(",
"logSlicer",
".",
"cellExecutions",
"[",
"0",
"]",
".",
"cell",
".",
"executionEventId",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"2",
")",
";",
"const",
"deplines",
"=",
"deps",
".",
"map",
"(",
"d",
"=>",
"d",
".",
"text",
")",
";",
"expect",
"(",
"deplines",
")",
".",
"includes",
"(",
"lines",
"[",
"1",
"]",
")",
";",
"expect",
"(",
"deplines",
")",
".",
"includes",
"(",
"lines",
"[",
"2",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"\"includes all defs within cells\"",
",",
"(",
")",
"=>",
"{",
"const",
"lines",
"=",
"[",
"\"x = 3\\nq = 2\"",
",",
"\"y = x+1\"",
",",
"\"z = q-1\"",
"]",
";",
"const",
"logSlicer",
"=",
"makeLog",
"(",
"lines",
")",
";",
"const",
"deps",
"=",
"logSlicer",
".",
"getDependentCells",
"(",
"logSlicer",
".",
"cellExecutions",
"[",
"0",
"]",
".",
"cell",
".",
"executionEventId",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"2",
")",
";",
"const",
"deplines",
"=",
"deps",
".",
"map",
"(",
"d",
"=>",
"d",
".",
"text",
")",
";",
"expect",
"(",
"deplines",
")",
".",
"includes",
"(",
"lines",
"[",
"1",
"]",
")",
";",
"expect",
"(",
"deplines",
")",
".",
"includes",
"(",
"lines",
"[",
"2",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"\"handles cell re-execution\"",
",",
"(",
")",
"=>",
"{",
"const",
"lines",
"=",
"[",
"[",
"\"0\"",
",",
"\"x = 2\\nprint(x)\"",
"]",
",",
"[",
"\"1\"",
",",
"\"y = x+1\\nprint(y)\"",
"]",
",",
"[",
"\"2\"",
",",
"\"q = 2\"",
"]",
",",
"[",
"\"0\"",
",",
"\"x = 20\\nprint(x)\"",
"]",
"]",
";",
"const",
"cells",
"=",
"lines",
".",
"map",
"(",
"(",
"[",
"pid",
",",
"text",
"]",
",",
"i",
")",
"=>",
"new",
"TestCell",
"(",
"text",
",",
"i",
"+",
"1",
",",
"undefined",
",",
"pid",
")",
")",
";",
"const",
"logSlicer",
"=",
"new",
"ExecutionLogSlicer",
"(",
"new",
"DataflowAnalyzer",
"(",
")",
")",
";",
"cells",
".",
"forEach",
"(",
"cell",
"=>",
"logSlicer",
".",
"logExecution",
"(",
"cell",
")",
")",
";",
"const",
"rerunFirst",
"=",
"logSlicer",
".",
"cellExecutions",
"[",
"3",
"]",
".",
"cell",
".",
"executionEventId",
";",
"const",
"deps",
"=",
"logSlicer",
".",
"getDependentCells",
"(",
"rerunFirst",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"1",
")",
";",
"expect",
"(",
"deps",
"[",
"0",
"]",
".",
"text",
")",
".",
"equals",
"(",
"lines",
"[",
"1",
"]",
"[",
"1",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"\"handles cell re-execution no-op\"",
",",
"(",
")",
"=>",
"{",
"const",
"lines",
"=",
"[",
"[",
"\"0\"",
",",
"\"x = 2\\nprint(x)\"",
"]",
",",
"[",
"\"1\"",
",",
"\"y = 3\\nprint(y)\"",
"]",
",",
"[",
"\"2\"",
",",
"\"q = 2\"",
"]",
",",
"[",
"\"0\"",
",",
"\"x = 20\\nprint(x)\"",
"]",
",",
"]",
";",
"const",
"cells",
"=",
"lines",
".",
"map",
"(",
"(",
"[",
"pid",
",",
"text",
"]",
",",
"i",
")",
"=>",
"new",
"TestCell",
"(",
"text",
",",
"i",
"+",
"1",
",",
"undefined",
",",
"pid",
")",
")",
";",
"const",
"logSlicer",
"=",
"new",
"ExecutionLogSlicer",
"(",
"new",
"DataflowAnalyzer",
"(",
")",
")",
";",
"cells",
".",
"forEach",
"(",
"cell",
"=>",
"logSlicer",
".",
"logExecution",
"(",
"cell",
")",
")",
";",
"const",
"deps",
"=",
"logSlicer",
".",
"getDependentCells",
"(",
"logSlicer",
".",
"cellExecutions",
"[",
"3",
"]",
".",
"cell",
".",
"executionEventId",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"0",
")",
";",
"}",
")",
";",
"it",
"(",
"\"return result in topo order\"",
",",
"(",
")",
"=>",
"{",
"const",
"lines",
"=",
"[",
"[",
"\"0\"",
",",
"\"x = 1\"",
"]",
",",
"[",
"\"0\"",
",",
"\"y = 2*x\"",
"]",
",",
"[",
"\"0\"",
",",
"\"z = x*y\"",
"]",
",",
"[",
"\"0\"",
",",
"\"x = 2\"",
"]",
",",
"[",
"\"1\"",
",",
"\"y = x*2\"",
"]",
",",
"[",
"\"2\"",
",",
"\"z = y*x\"",
"]",
",",
"[",
"\"0\"",
",",
"\"x = 3\"",
"]",
",",
"]",
";",
"const",
"cells",
"=",
"lines",
".",
"map",
"(",
"(",
"[",
"pid",
",",
"text",
"]",
",",
"i",
")",
"=>",
"new",
"TestCell",
"(",
"text",
",",
"i",
"+",
"1",
",",
"undefined",
",",
"pid",
")",
")",
";",
"const",
"logSlicer",
"=",
"new",
"ExecutionLogSlicer",
"(",
"new",
"DataflowAnalyzer",
"(",
")",
")",
";",
"cells",
".",
"forEach",
"(",
"cell",
"=>",
"logSlicer",
".",
"logExecution",
"(",
"cell",
")",
")",
";",
"const",
"lastEvent",
"=",
"logSlicer",
".",
"cellExecutions",
"[",
"logSlicer",
".",
"cellExecutions",
".",
"length",
"-",
"1",
"]",
".",
"cell",
".",
"executionEventId",
";",
"const",
"deps",
"=",
"logSlicer",
".",
"getDependentCells",
"(",
"lastEvent",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"2",
")",
";",
"expect",
"(",
"deps",
"[",
"0",
"]",
".",
"text",
")",
".",
"equals",
"(",
"'y = x*2'",
")",
";",
"expect",
"(",
"deps",
"[",
"1",
"]",
".",
"text",
")",
".",
"equals",
"(",
"'z = y*x'",
")",
";",
"}",
")",
";",
"it",
"(",
"\"can be called multiple times\"",
",",
"(",
")",
"=>",
"{",
"const",
"lines",
"=",
"[",
"[",
"\"0\"",
",",
"\"x = 1\"",
"]",
",",
"[",
"\"1\"",
",",
"\"y = 2*x\"",
"]",
",",
"[",
"\"2\"",
",",
"\"z = x*y\"",
"]",
",",
"]",
";",
"const",
"cells",
"=",
"lines",
".",
"map",
"(",
"(",
"[",
"pid",
",",
"text",
"]",
",",
"i",
")",
"=>",
"new",
"TestCell",
"(",
"text",
",",
"i",
"+",
"1",
",",
"undefined",
",",
"pid",
")",
")",
";",
"const",
"logSlicer",
"=",
"new",
"ExecutionLogSlicer",
"(",
"new",
"DataflowAnalyzer",
"(",
")",
")",
";",
"cells",
".",
"forEach",
"(",
"cell",
"=>",
"logSlicer",
".",
"logExecution",
"(",
"cell",
")",
")",
";",
"const",
"deps",
"=",
"logSlicer",
".",
"getDependentCells",
"(",
"logSlicer",
".",
"cellExecutions",
"[",
"0",
"]",
".",
"cell",
".",
"executionEventId",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"2",
")",
";",
"expect",
"(",
"deps",
"[",
"0",
"]",
".",
"text",
")",
".",
"equals",
"(",
"'y = 2*x'",
")",
";",
"expect",
"(",
"deps",
"[",
"1",
"]",
".",
"text",
")",
".",
"equals",
"(",
"'z = x*y'",
")",
";",
"const",
"edits",
"=",
"[",
"[",
"\"0\"",
",",
"\"x = 2\"",
"]",
",",
"[",
"\"1\"",
",",
"\"y = x*2\"",
"]",
",",
"[",
"\"2\"",
",",
"\"z = y*x\"",
"]",
",",
"[",
"\"0\"",
",",
"\"x = 3\"",
"]",
",",
"]",
";",
"const",
"cellEdits",
"=",
"edits",
".",
"map",
"(",
"(",
"[",
"pid",
",",
"text",
"]",
",",
"i",
")",
"=>",
"new",
"TestCell",
"(",
"text",
",",
"i",
"+",
"1",
",",
"undefined",
",",
"pid",
")",
")",
";",
"cellEdits",
".",
"forEach",
"(",
"cell",
"=>",
"logSlicer",
".",
"logExecution",
"(",
"cell",
")",
")",
";",
"const",
"lastEvent",
"=",
"logSlicer",
".",
"cellExecutions",
"[",
"logSlicer",
".",
"cellExecutions",
".",
"length",
"-",
"1",
"]",
".",
"cell",
".",
"executionEventId",
";",
"const",
"deps2",
"=",
"logSlicer",
".",
"getDependentCells",
"(",
"lastEvent",
")",
";",
"expect",
"(",
"deps2",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"deps2",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"2",
")",
";",
"expect",
"(",
"deps2",
"[",
"0",
"]",
".",
"text",
")",
".",
"equals",
"(",
"'y = x*2'",
")",
";",
"expect",
"(",
"deps2",
"[",
"1",
"]",
".",
"text",
")",
".",
"equals",
"(",
"'z = y*x'",
")",
";",
"}",
")",
";",
"it",
"(",
"\"handles api calls\"",
",",
"(",
")",
"=>",
"{",
"const",
"lines",
"=",
"[",
"[",
"\"0\"",
",",
"\"from matplotlib.pyplot import scatter\\nfrom sklearn.cluster import KMeans\\nfrom sklearn import datasets\"",
"]",
",",
"[",
"\"1\"",
",",
"\"data = datasets.load_iris().data[:,2:4]\\npetal_length, petal_width = data[:,1], data[:,0]\"",
"]",
",",
"[",
"\"2\"",
",",
"\"k=3\"",
"]",
",",
"[",
"\"3\"",
",",
"\"clusters = KMeans(n_clusters=k).fit(data).labels_\"",
"]",
",",
"[",
"\"4\"",
",",
"\"scatter(petal_length, petal_width, c=clusters)\"",
"]",
",",
"[",
"\"2\"",
",",
"\"k=4\"",
"]",
",",
"]",
";",
"const",
"cells",
"=",
"lines",
".",
"map",
"(",
"(",
"[",
"pid",
",",
"text",
"]",
",",
"i",
")",
"=>",
"new",
"TestCell",
"(",
"text",
",",
"i",
"+",
"1",
",",
"undefined",
",",
"pid",
")",
")",
";",
"const",
"logSlicer",
"=",
"new",
"ExecutionLogSlicer",
"(",
"new",
"DataflowAnalyzer",
"(",
")",
")",
";",
"cells",
".",
"forEach",
"(",
"cell",
"=>",
"logSlicer",
".",
"logExecution",
"(",
"cell",
")",
")",
";",
"const",
"lastEvent",
"=",
"logSlicer",
".",
"cellExecutions",
"[",
"logSlicer",
".",
"cellExecutions",
".",
"length",
"-",
"1",
"]",
".",
"cell",
".",
"executionEventId",
";",
"const",
"deps",
"=",
"logSlicer",
".",
"getDependentCells",
"(",
"lastEvent",
")",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"deps",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"2",
")",
";",
"const",
"sliceText",
"=",
"deps",
".",
"map",
"(",
"c",
"=>",
"c",
".",
"text",
")",
";",
"expect",
"(",
"sliceText",
")",
".",
"to",
".",
"include",
"(",
"lines",
"[",
"3",
"]",
"[",
"1",
"]",
")",
";",
"expect",
"(",
"sliceText",
")",
".",
"to",
".",
"include",
"(",
"lines",
"[",
"4",
"]",
"[",
"1",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
163,
null,
3,
null,
3,
null,
3,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27927,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27927,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27927,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27927,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
27927,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27927,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27927,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27927,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27927,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27927,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27927,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27927,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27927,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27927,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
160 | [
"import",
"{",
"expect",
"}",
"from",
"'chai'",
";",
"import",
"{",
"MagicsRewriter",
",",
"MatchPosition",
",",
"PylabLineMagicRewriter",
",",
"TimeLineMagicRewriter",
",",
"}",
"from",
"'../rewrite-magics'",
";",
"describe",
"(",
"'MagicsRewriter'",
",",
"(",
")",
"=>",
"{",
"let",
"magicsTranslator",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"magicsTranslator",
"=",
"new",
"MagicsRewriter",
"(",
")",
";",
"}",
")",
";",
"function",
"rewrite",
"(",
"...",
"codeLines",
")",
"{",
"return",
"magicsTranslator",
".",
"rewrite",
"(",
"codeLines",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"}",
"it",
"(",
"'comments out line magics and annotates them with their position'",
",",
"(",
")",
"=>",
"{",
"let",
"rewritten",
"=",
"rewrite",
"(",
"'%some_magic arg1 arg2'",
")",
";",
"expect",
"(",
"rewritten",
")",
".",
"to",
".",
"equal",
"(",
"'#%some_magic arg1 arg2'",
")",
";",
"}",
")",
";",
"it",
"(",
"'rewrites line magics with line continuations'",
",",
"(",
")",
"=>",
"{",
"let",
"rewritten",
"=",
"rewrite",
"(",
"'%some_magic arg1 \\\\ '",
",",
"' arg2'",
")",
";",
"expect",
"(",
"rewritten",
")",
".",
"to",
".",
"equal",
"(",
"[",
"'#%some_magic arg1 \\\\ '",
",",
"'# arg2'",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'allows line magics to start after any number of whitespaces'",
",",
"(",
")",
"=>",
"{",
"let",
"rewritten",
"=",
"rewrite",
"(",
"' %some_magic arg1 arg2'",
")",
";",
"expect",
"(",
"rewritten",
")",
".",
"to",
".",
"equal",
"(",
"'# %some_magic arg1 arg2'",
")",
";",
"}",
")",
";",
"it",
"(",
"\"doesn't detect a % mid-line as a magic\"",
",",
"(",
")",
"=>",
"{",
"let",
"rewritten",
"=",
"rewrite",
"(",
"'print(a) %some_magic'",
")",
";",
"expect",
"(",
"rewritten",
")",
".",
"to",
".",
"equal",
"(",
"'print(a) %some_magic'",
")",
";",
"}",
")",
";",
"it",
"(",
"'by default comments out cell magics'",
",",
"(",
")",
"=>",
"{",
"let",
"rewritten",
"=",
"rewrite",
"(",
"'%%some_cell_magic'",
",",
"'line 1'",
",",
"'line 2'",
")",
";",
"expect",
"(",
"rewritten",
")",
".",
"to",
".",
"equal",
"(",
"[",
"'##%%some_cell_magic'",
",",
"'##line 1'",
",",
"'##line 2'",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'allows cell magics to start after any number of whitespaces'",
",",
"(",
")",
"=>",
"{",
"let",
"rewritten",
"=",
"rewrite",
"(",
"' %%some_cell_magic'",
")",
";",
"expect",
"(",
"rewritten",
")",
".",
"to",
".",
"equal",
"(",
"'## %%some_cell_magic'",
")",
";",
"}",
")",
";",
"it",
"(",
"'does not treat VS Code cell markers as magic'",
",",
"(",
")",
"=>",
"{",
"const",
"code",
"=",
"[",
"'#%%'",
",",
"'x=3'",
"]",
";",
"let",
"rewritten",
"=",
"rewrite",
"(",
"...",
"code",
")",
";",
"expect",
"(",
"rewritten",
")",
".",
"to",
".",
"equal",
"(",
"code",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"\"does nothing to text that doesn't have magics\"",
",",
"(",
")",
"=>",
"{",
"let",
"rewritten",
"=",
"rewrite",
"(",
"'print(a)'",
")",
";",
"expect",
"(",
"rewritten",
")",
".",
"to",
".",
"equal",
"(",
"'print(a)'",
")",
";",
"}",
")",
";",
"it",
"(",
"'applies custom rewrite rules and annotations'",
",",
"(",
")",
"=>",
"{",
"let",
"magicsTranslator",
"=",
"new",
"MagicsRewriter",
"(",
"[",
"{",
"commandName",
":",
"'foo'",
",",
"rewrite",
":",
"(",
"_",
",",
"__",
",",
"___",
")",
"=>",
"{",
"return",
"{",
"text",
":",
"'# foo_found'",
",",
"annotations",
":",
"[",
"{",
"key",
":",
"'foo_tag'",
",",
"value",
":",
"'bar_value'",
"}",
"]",
",",
"}",
";",
"}",
",",
"}",
",",
"]",
")",
";",
"let",
"rewritten",
"=",
"magicsTranslator",
".",
"rewrite",
"(",
"'%foo arg1 arg2'",
")",
";",
"expect",
"(",
"rewritten",
")",
".",
"to",
".",
"equal",
"(",
"\"'''foo_tag: bar_value''' # foo_found\"",
")",
";",
"}",
")",
";",
"let",
"EXAMPLE_POSITION",
"=",
"[",
"{",
"line",
":",
"0",
",",
"col",
":",
"0",
"}",
",",
"{",
"line",
":",
"0",
",",
"col",
":",
"10",
"}",
",",
"]",
";",
"describe",
"(",
"'TimeLineMagicRewriter'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'replaces %time with an equivalent-length string literal'",
",",
"(",
")",
"=>",
"{",
"let",
"rewrite",
"=",
"new",
"TimeLineMagicRewriter",
"(",
")",
".",
"rewrite",
"(",
"'%time print(a)'",
",",
"''",
",",
"EXAMPLE_POSITION",
")",
";",
"expect",
"(",
"rewrite",
".",
"text",
")",
".",
"to",
".",
"equal",
"(",
"'\" \" print(a)'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'MatplotlibLineMagicRewriter'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'adds annotations for its position and defined symbols'",
",",
"(",
")",
"=>",
"{",
"let",
"rewrite",
"=",
"new",
"PylabLineMagicRewriter",
"(",
")",
".",
"rewrite",
"(",
"'%pylab inline'",
",",
"'%pylab inline'",
",",
"EXAMPLE_POSITION",
")",
";",
"expect",
"(",
"rewrite",
".",
"text",
")",
".",
"to",
".",
"be",
".",
"undefined",
";",
"expect",
"(",
"rewrite",
".",
"annotations",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"[",
"{",
"key",
":",
"'defs'",
",",
"value",
":",
"JSON",
".",
"stringify",
"(",
"[",
"{",
"name",
":",
"'numpy'",
",",
"pos",
":",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"10",
"]",
"]",
"}",
",",
"{",
"name",
":",
"'matplotlib'",
",",
"pos",
":",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"10",
"]",
"]",
"}",
",",
"{",
"name",
":",
"'pylab'",
",",
"pos",
":",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"10",
"]",
"]",
"}",
",",
"{",
"name",
":",
"'mlab'",
",",
"pos",
":",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"10",
"]",
"]",
"}",
",",
"{",
"name",
":",
"'pyplot'",
",",
"pos",
":",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"10",
"]",
"]",
"}",
",",
"{",
"name",
":",
"'np'",
",",
"pos",
":",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"10",
"]",
"]",
"}",
",",
"{",
"name",
":",
"'plt'",
",",
"pos",
":",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"10",
"]",
"]",
"}",
",",
"{",
"name",
":",
"'display'",
",",
"pos",
":",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"10",
"]",
"]",
"}",
",",
"{",
"name",
":",
"'figsize'",
",",
"pos",
":",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"10",
"]",
"]",
"}",
",",
"{",
"name",
":",
"'getfigs'",
",",
"pos",
":",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"10",
"]",
"]",
"}",
",",
"]",
")",
",",
"}",
",",
"]",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
161 | [
"import",
"{",
"expect",
"}",
"from",
"'chai'",
";",
"import",
"{",
"SlicedExecution",
"}",
"from",
"'../log-slicer'",
";",
"import",
"{",
"LocationSet",
"}",
"from",
"'../slice'",
";",
"import",
"{",
"Cell",
"}",
"from",
"'../cell'",
";",
"import",
"{",
"CellSlice",
"}",
"from",
"'../cellslice'",
";",
"import",
"{",
"TestCell",
"}",
"from",
"'./testcell'",
";",
"describe",
"(",
"'SlicedExecution'",
",",
"(",
")",
"=>",
"{",
"function",
"cell",
"(",
"executionEventId",
",",
"text",
",",
"executionCount",
"?",
",",
"id",
"?",
")",
"{",
"if",
"(",
"executionCount",
"===",
"undefined",
")",
"executionCount",
"=",
"1",
";",
"return",
"new",
"TestCell",
"(",
"text",
",",
"executionCount",
",",
"executionEventId",
",",
"id",
")",
";",
"}",
"function",
"cellSlice",
"(",
"cell",
",",
"slice",
")",
"{",
"return",
"new",
"CellSlice",
"(",
"cell",
",",
"slice",
")",
";",
"}",
"function",
"location",
"(",
"first_line",
",",
"first_column",
",",
"last_line",
",",
"last_column",
")",
"{",
"return",
"{",
"first_line",
":",
"first_line",
",",
"first_column",
":",
"first_column",
",",
"last_line",
":",
"last_line",
",",
"last_column",
":",
"last_column",
",",
"}",
";",
"}",
"function",
"slicedExecution",
"(",
"...",
"cellSlices",
")",
"{",
"return",
"new",
"SlicedExecution",
"(",
"new",
"Date",
"(",
")",
",",
"cellSlices",
")",
";",
"}",
"describe",
"(",
"'merge'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'unions slices with different cells'",
",",
"(",
")",
"=>",
"{",
"let",
"slice1",
"=",
"slicedExecution",
"(",
"cellSlice",
"(",
"cell",
"(",
"'1'",
",",
"'a = 1'",
",",
"1",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
")",
")",
";",
"let",
"slice2",
"=",
"slicedExecution",
"(",
"cellSlice",
"(",
"cell",
"(",
"'2'",
",",
"'b = 2'",
",",
"2",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
")",
")",
";",
"let",
"merged",
"=",
"slice1",
".",
"merge",
"(",
"slice2",
")",
";",
"expect",
"(",
"merged",
".",
"cellSlices",
"[",
"0",
"]",
".",
"cell",
".",
"executionEventId",
")",
".",
"to",
".",
"equal",
"(",
"'1'",
")",
";",
"expect",
"(",
"merged",
".",
"cellSlices",
"[",
"1",
"]",
".",
"cell",
".",
"executionEventId",
")",
".",
"to",
".",
"equal",
"(",
"'2'",
")",
";",
"}",
")",
";",
"it",
"(",
"'will not include the same locations from the same cell twice'",
",",
"(",
")",
"=>",
"{",
"let",
"slice1",
"=",
"slicedExecution",
"(",
"cellSlice",
"(",
"cell",
"(",
"'1'",
",",
"'a = 1'",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
")",
")",
";",
"let",
"slice2",
"=",
"slicedExecution",
"(",
"cellSlice",
"(",
"cell",
"(",
"'1'",
",",
"'a = 1'",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
")",
")",
";",
"let",
"merged",
"=",
"slice1",
".",
"merge",
"(",
"slice2",
")",
";",
"expect",
"(",
"merged",
".",
"cellSlices",
".",
"length",
")",
".",
"to",
".",
"equal",
"(",
"1",
")",
";",
"expect",
"(",
"merged",
".",
"cellSlices",
"[",
"0",
"]",
".",
"slice",
".",
"size",
")",
".",
"to",
".",
"equal",
"(",
"1",
")",
";",
"}",
")",
";",
"it",
"(",
"'considers two cells sharing ID and execution count but differing in execution event '",
"+",
"'ID to be different'",
",",
"(",
")",
"=>",
"{",
"let",
"slice1",
"=",
"slicedExecution",
"(",
"cellSlice",
"(",
"cell",
"(",
"'1'",
",",
"'a = 1'",
",",
"1",
",",
"'id1'",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
")",
")",
";",
"let",
"slice2",
"=",
"slicedExecution",
"(",
"cellSlice",
"(",
"cell",
"(",
"'2'",
",",
"'a = 1'",
",",
"1",
",",
"'id1'",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
")",
")",
";",
"let",
"merged",
"=",
"slice1",
".",
"merge",
"(",
"slice2",
")",
";",
"expect",
"(",
"merged",
".",
"cellSlices",
".",
"length",
")",
".",
"to",
".",
"equal",
"(",
"2",
")",
";",
"}",
")",
";",
"it",
"(",
"'will include complementary ranges from two slices of the same cell'",
",",
"(",
")",
"=>",
"{",
"let",
"slice1",
"=",
"slicedExecution",
"(",
"cellSlice",
"(",
"cell",
"(",
"'1'",
",",
"'a = 1'",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
")",
")",
";",
"let",
"slice2",
"=",
"slicedExecution",
"(",
"cellSlice",
"(",
"cell",
"(",
"'1'",
",",
"'a = 1'",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"4",
")",
")",
")",
")",
";",
"let",
"merged",
"=",
"slice1",
".",
"merge",
"(",
"slice2",
")",
";",
"expect",
"(",
"merged",
".",
"cellSlices",
".",
"length",
")",
".",
"to",
".",
"equal",
"(",
"1",
")",
";",
"expect",
"(",
"merged",
".",
"cellSlices",
"[",
"0",
"]",
".",
"slice",
".",
"size",
")",
".",
"to",
".",
"equal",
"(",
"2",
")",
";",
"expect",
"(",
"merged",
".",
"cellSlices",
"[",
"0",
"]",
".",
"slice",
".",
"items",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
";",
"expect",
"(",
"merged",
".",
"cellSlices",
"[",
"0",
"]",
".",
"slice",
".",
"items",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"4",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'reorders the cells in execution order'",
",",
"(",
")",
"=>",
"{",
"let",
"slice1",
"=",
"slicedExecution",
"(",
"cellSlice",
"(",
"cell",
"(",
"'2'",
",",
"'a = 1'",
",",
"2",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
")",
")",
";",
"let",
"slice2",
"=",
"slicedExecution",
"(",
"cellSlice",
"(",
"cell",
"(",
"'1'",
",",
"'a = 1'",
",",
"1",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"4",
")",
")",
")",
")",
";",
"let",
"merged",
"=",
"slice1",
".",
"merge",
"(",
"slice2",
")",
";",
"expect",
"(",
"merged",
".",
"cellSlices",
"[",
"0",
"]",
".",
"cell",
".",
"executionCount",
")",
".",
"to",
".",
"equal",
"(",
"1",
")",
";",
"expect",
"(",
"merged",
".",
"cellSlices",
"[",
"1",
"]",
".",
"cell",
".",
"executionCount",
")",
".",
"to",
".",
"equal",
"(",
"2",
")",
";",
"}",
")",
";",
"it",
"(",
"'can do an n-way merge with a bunch of cells'",
",",
"(",
")",
"=>",
"{",
"let",
"slice1",
"=",
"slicedExecution",
"(",
"cellSlice",
"(",
"cell",
"(",
"'1'",
",",
"'a = 1'",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
")",
",",
"cellSlice",
"(",
"cell",
"(",
"'2'",
",",
"'b = 1'",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
")",
")",
";",
"let",
"slice2",
"=",
"slicedExecution",
"(",
"cellSlice",
"(",
"cell",
"(",
"'3'",
",",
"'c = 1'",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
")",
",",
"cellSlice",
"(",
"cell",
"(",
"'4'",
",",
"'d = 1'",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
")",
")",
";",
"let",
"slice3",
"=",
"slicedExecution",
"(",
"cellSlice",
"(",
"cell",
"(",
"'5'",
",",
"'e = 1'",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
")",
",",
"cellSlice",
"(",
"cell",
"(",
"'6'",
",",
"'f = 1'",
")",
",",
"new",
"LocationSet",
"(",
"location",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
")",
")",
";",
"let",
"merged",
"=",
"slice1",
".",
"merge",
"(",
"slice2",
",",
"slice3",
")",
";",
"expect",
"(",
"merged",
".",
"cellSlices",
".",
"length",
")",
".",
"to",
".",
"equal",
"(",
"6",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
352,
null,
2,
null,
2,
null,
3,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
352,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
3,
null,
3,
null,
3,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
17960,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
162 | [
"import",
"{",
"expect",
"}",
"from",
"'chai'",
";",
"import",
"{",
"parse",
",",
"walk",
"}",
"from",
"'../python-parser'",
";",
"import",
"*",
"as",
"py",
"from",
"'../python-parser'",
";",
"describe",
"(",
"'python parser'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'can parse floats that have no digits before the dot'",
",",
"(",
")",
"=>",
"{",
"parse",
"(",
"'a = .2\\n'",
")",
";",
"}",
")",
";",
"it",
"(",
"'can also parse calls on objects'",
",",
"(",
")",
"=>",
"{",
"parse",
"(",
"'obj.prop\\n'",
")",
";",
"}",
")",
";",
"it",
"(",
"'can parse comments'",
",",
"(",
")",
"=>",
"{",
"const",
"tree",
"=",
"parse",
"(",
"'#\\n'",
")",
";",
"expect",
"(",
"tree",
".",
"code",
")",
".",
"to",
".",
"be",
".",
"an",
"(",
"'array'",
")",
";",
"expect",
"(",
"tree",
".",
"code",
".",
"length",
")",
".",
"to",
".",
"equal",
"(",
"0",
")",
";",
"}",
")",
";",
"it",
"(",
"'can parse scientific notation'",
",",
"(",
")",
"=>",
"{",
"parse",
"(",
"'1e5\\n'",
")",
";",
"}",
")",
";",
"it",
"(",
"'can parse imaginary numbers'",
",",
"(",
")",
"=>",
"{",
"parse",
"(",
"'x = 12j\\n'",
")",
";",
"}",
")",
";",
"it",
"(",
"'can parse lambdas with keyword'",
",",
"(",
")",
"=>",
"{",
"parse",
"(",
"'f = (lambda document, **variety: document)\\n'",
")",
";",
"}",
")",
";",
"it",
"(",
"'parses a dictionary with a `comp_for`'",
",",
"(",
")",
"=>",
"{",
"let",
"mod",
"=",
"parse",
"(",
"'{k: v for (k, v) in d.items()}\\n'",
")",
";",
"expect",
"(",
"mod",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"mod",
".",
"code",
")",
".",
"to",
".",
"have",
".",
"length",
";",
"let",
"node",
"=",
"mod",
".",
"code",
"[",
"0",
"]",
"as",
"py",
".",
"DictExpr",
";",
"expect",
"(",
"node",
".",
"entries",
".",
"length",
")",
".",
"to",
".",
"equal",
"(",
"1",
")",
";",
"expect",
"(",
"node",
".",
"comp_for",
")",
".",
"to",
".",
"exist",
";",
"}",
")",
";",
"it",
"(",
"'can parse line continuations'",
",",
"(",
")",
"=>",
"{",
"parse",
"(",
"[",
"'a = b\\\\'",
",",
"'.func(1, 2)\\\\'",
",",
"'.func(3, 4)'",
",",
"''",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'produces the full location of a line for a call statement'",
",",
"(",
")",
"=>",
"{",
"let",
"node",
"=",
"parse",
"(",
"[",
"'obj.func()'",
",",
"''",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
".",
"code",
"[",
"0",
"]",
";",
"expect",
"(",
"node",
".",
"location",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"{",
"first_line",
":",
"1",
",",
"first_column",
":",
"0",
",",
"last_line",
":",
"1",
",",
"last_column",
":",
"10",
",",
"}",
")",
";",
"}",
")",
";",
"it",
"(",
"'does not crash on correct code after parsing bad code'",
",",
"(",
")",
"=>",
"{",
"expect",
"(",
"(",
")",
"=>",
"parse",
"(",
"'print(1\\n'",
")",
")",
".",
"to",
".",
"throw",
"(",
")",
";",
"expect",
"(",
"(",
")",
"=>",
"parse",
"(",
"'a + 1\\nb = a\\n'",
")",
")",
".",
"not",
".",
"to",
".",
"throw",
"(",
")",
";",
"}",
")",
";",
"it",
"(",
"'handles docstrings'",
",",
"(",
")",
"=>",
"{",
"let",
"node",
"=",
"parse",
"(",
"[",
"'def foo():'",
",",
"' \"\"\"'",
",",
"' this function'",
",",
"' does nothing'",
",",
"' \"\"\"'",
",",
"' pass\\n'",
",",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"expect",
"(",
"node",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"node",
".",
"code",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"1",
")",
";",
"expect",
"(",
"node",
".",
"code",
"[",
"0",
"]",
".",
"type",
")",
".",
"to",
".",
"equal",
"(",
"'def'",
")",
";",
"const",
"def",
"=",
"node",
".",
"code",
"[",
"0",
"]",
"as",
"py",
".",
"Def",
";",
"expect",
"(",
"def",
".",
"code",
")",
".",
"to",
".",
"have",
".",
"length",
"(",
"2",
")",
";",
"expect",
"(",
"def",
".",
"code",
"[",
"0",
"]",
".",
"type",
")",
".",
"to",
".",
"equal",
"(",
"'literal'",
")",
";",
"expect",
"(",
"def",
".",
"code",
"[",
"1",
"]",
".",
"type",
")",
".",
"to",
".",
"equal",
"(",
"'pass'",
")",
";",
"const",
"docstring",
"=",
"def",
".",
"code",
"[",
"0",
"]",
"as",
"py",
".",
"Literal",
";",
"expect",
"(",
"docstring",
")",
".",
"to",
".",
"exist",
";",
"expect",
"(",
"docstring",
".",
"type",
")",
".",
"to",
".",
"equal",
"(",
"'literal'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"describe",
"(",
"'ast walker'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"\"doesn't crash on try-execpt blocks\"",
",",
"(",
")",
"=>",
"{",
"let",
"tree",
"=",
"parse",
"(",
"[",
"'try:'",
",",
"' pass'",
",",
"'except:'",
",",
"' pass'",
",",
"''",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"walk",
"(",
"tree",
")",
";",
"}",
")",
";",
"it",
"(",
"\"doesn't crash on with-statements\"",
",",
"(",
")",
"=>",
"{",
"let",
"tree",
"=",
"parse",
"(",
"[",
"'with sns.axes_style(\"white\"):'",
",",
"' pass'",
",",
"''",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"walk",
"(",
"tree",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
19653,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
1688,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
163 | [
"import",
"{",
"expect",
"}",
"from",
"'chai'",
";",
"import",
"{",
"ProgramBuilder",
"}",
"from",
"'../program-builder'",
";",
"import",
"{",
"Cell",
"}",
"from",
"'../cell'",
";",
"import",
"{",
"TestCell",
"}",
"from",
"'./testcell'",
";",
"describe",
"(",
"'program builder'",
",",
"(",
")",
"=>",
"{",
"function",
"createCell",
"(",
"executionEventId",
",",
"text",
",",
"executionCount",
"?",
")",
"{",
"return",
"new",
"TestCell",
"(",
"text",
",",
"executionCount",
",",
"executionEventId",
")",
";",
"}",
"let",
"programBuilder",
";",
"beforeEach",
"(",
"(",
")",
"=>",
"{",
"programBuilder",
"=",
"new",
"ProgramBuilder",
"(",
")",
";",
"}",
")",
";",
"it",
"(",
"'appends cell contents in order'",
",",
"(",
")",
"=>",
"{",
"programBuilder",
".",
"add",
"(",
"createCell",
"(",
"'id1'",
",",
"'print(1)'",
")",
",",
"createCell",
"(",
"'id2'",
",",
"'print(2)'",
")",
")",
";",
"let",
"code",
"=",
"programBuilder",
".",
"buildTo",
"(",
"'id2'",
")",
".",
"text",
";",
"expect",
"(",
"code",
")",
".",
"to",
".",
"equal",
"(",
"[",
"'print(1)'",
",",
"'print(2)'",
",",
"''",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'builds a map from lines to cells'",
",",
"(",
")",
"=>",
"{",
"let",
"cell1",
"=",
"createCell",
"(",
"'id1'",
",",
"'print(1)'",
")",
";",
"let",
"cell2",
"=",
"createCell",
"(",
"'id2'",
",",
"'print(2)'",
")",
";",
"programBuilder",
".",
"add",
"(",
"cell1",
",",
"cell2",
")",
";",
"let",
"lineToCellMap",
"=",
"programBuilder",
".",
"buildTo",
"(",
"'id2'",
")",
".",
"lineToCellMap",
";",
"expect",
"(",
"lineToCellMap",
"[",
"1",
"]",
")",
".",
"to",
".",
"equal",
"(",
"cell1",
")",
";",
"expect",
"(",
"lineToCellMap",
"[",
"2",
"]",
")",
".",
"to",
".",
"equal",
"(",
"cell2",
")",
";",
"}",
")",
";",
"it",
"(",
"'builds a map from cells to lines'",
",",
"(",
")",
"=>",
"{",
"let",
"cell1",
"=",
"createCell",
"(",
"'id1'",
",",
"'print(1)'",
")",
";",
"let",
"cell2",
"=",
"createCell",
"(",
"'id2'",
",",
"'print(2)'",
")",
";",
"programBuilder",
".",
"add",
"(",
"cell1",
",",
"cell2",
")",
";",
"let",
"cellToLineMap",
"=",
"programBuilder",
".",
"buildTo",
"(",
"'id2'",
")",
".",
"cellToLineMap",
";",
"expect",
"(",
"cellToLineMap",
"[",
"'id1'",
"]",
".",
"items",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"[",
"1",
"]",
")",
";",
"expect",
"(",
"cellToLineMap",
"[",
"'id2'",
"]",
".",
"items",
")",
".",
"to",
".",
"deep",
".",
"equal",
"(",
"[",
"2",
"]",
")",
";",
"}",
")",
";",
"it",
"(",
"'stops after the specified cell'",
",",
"(",
")",
"=>",
"{",
"programBuilder",
".",
"add",
"(",
"createCell",
"(",
"'id1'",
",",
"'print(1)'",
")",
",",
"createCell",
"(",
"'id2'",
",",
"'print(2)'",
")",
")",
";",
"let",
"code",
"=",
"programBuilder",
".",
"buildTo",
"(",
"'id1'",
")",
".",
"text",
";",
"expect",
"(",
"code",
")",
".",
"to",
".",
"equal",
"(",
"'print(1)\\n'",
")",
";",
"}",
")",
";",
"it",
"(",
"'skips cells with errors'",
",",
"(",
")",
"=>",
"{",
"let",
"badCell",
"=",
"createCell",
"(",
"'idE'",
",",
"'print(2)'",
")",
";",
"badCell",
".",
"hasError",
"=",
"true",
";",
"programBuilder",
".",
"add",
"(",
"createCell",
"(",
"'id1'",
",",
"'print(1)'",
")",
",",
"badCell",
",",
"createCell",
"(",
"'id3'",
",",
"'print(3)'",
")",
")",
";",
"let",
"code",
"=",
"programBuilder",
".",
"buildTo",
"(",
"'id3'",
")",
".",
"text",
";",
"expect",
"(",
"code",
")",
".",
"to",
".",
"equal",
"(",
"[",
"'print(1)'",
",",
"'print(3)'",
",",
"''",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'includes cells that end with errors'",
",",
"(",
")",
"=>",
"{",
"let",
"badCell",
"=",
"createCell",
"(",
"'idE'",
",",
"'print(bad_name)'",
")",
";",
"badCell",
".",
"hasError",
"=",
"true",
";",
"programBuilder",
".",
"add",
"(",
"createCell",
"(",
"'id1'",
",",
"'print(1)'",
")",
",",
"createCell",
"(",
"'id2'",
",",
"'print(2)'",
")",
",",
"badCell",
")",
";",
"let",
"code",
"=",
"programBuilder",
".",
"buildTo",
"(",
"'idE'",
")",
".",
"text",
";",
"expect",
"(",
"code",
")",
".",
"to",
".",
"equal",
"(",
"[",
"'print(1)'",
",",
"'print(2)'",
",",
"'print(bad_name)'",
",",
"''",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'skips cells that fail to parse'",
",",
"(",
")",
"=>",
"{",
"let",
"badCell",
"=",
"createCell",
"(",
"'idE'",
",",
"'causes_syntax_error('",
")",
";",
"let",
"oldConsoleLog",
"=",
"console",
".",
"log",
";",
"console",
".",
"log",
"=",
"(",
")",
"=>",
"{",
"}",
";",
"programBuilder",
".",
"add",
"(",
"createCell",
"(",
"'id1'",
",",
"'print(1)'",
")",
",",
"badCell",
",",
"createCell",
"(",
"'id3'",
",",
"'print(3)'",
")",
")",
";",
"console",
".",
"log",
"=",
"oldConsoleLog",
";",
"let",
"code",
"=",
"programBuilder",
".",
"buildTo",
"(",
"'id3'",
")",
".",
"text",
";",
"expect",
"(",
"code",
")",
".",
"to",
".",
"equal",
"(",
"[",
"'print(1)'",
",",
"'print(3)'",
",",
"''",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'doesn\\'t skip cells with array slices'",
",",
"(",
")",
"=>",
"{",
"programBuilder",
".",
"add",
"(",
"createCell",
"(",
"'id1'",
",",
"'array[0:1]'",
")",
",",
"createCell",
"(",
"'id2'",
",",
"'print(x)'",
")",
")",
";",
"let",
"code",
"=",
"programBuilder",
".",
"buildTo",
"(",
"'id2'",
")",
".",
"text",
";",
"expect",
"(",
"code",
")",
".",
"to",
".",
"equal",
"(",
"\"array[0:1]\\nprint(x)\\n\"",
")",
";",
"}",
")",
";",
"it",
"(",
"'skips cells that were executed in prior kernels'",
",",
"(",
")",
"=>",
"{",
"programBuilder",
".",
"add",
"(",
"createCell",
"(",
"'id1'",
",",
"'print(1)'",
",",
"1",
")",
",",
"createCell",
"(",
"'id2'",
",",
"'print(2)'",
",",
"1",
")",
",",
"createCell",
"(",
"'id3'",
",",
"'print(3)'",
",",
"2",
")",
",",
"createCell",
"(",
"'id3'",
",",
"'print(4)'",
",",
"1",
")",
")",
";",
"let",
"code",
"=",
"programBuilder",
".",
"buildTo",
"(",
"'id3'",
")",
".",
"text",
";",
"expect",
"(",
"code",
")",
".",
"to",
".",
"equals",
"(",
"[",
"'print(4)'",
",",
"''",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'constructs a tree for the program'",
",",
"(",
")",
"=>",
"{",
"programBuilder",
".",
"add",
"(",
"createCell",
"(",
"'id1'",
",",
"'print(1)'",
")",
",",
"createCell",
"(",
"'id2'",
",",
"'print(2)'",
")",
")",
";",
"let",
"tree",
"=",
"programBuilder",
".",
"buildTo",
"(",
"'id2'",
")",
".",
"tree",
";",
"expect",
"(",
"tree",
".",
"code",
".",
"length",
")",
".",
"to",
".",
"equal",
"(",
"2",
")",
";",
"}",
")",
";",
"it",
"(",
"'adjusts the node locations'",
",",
"(",
")",
"=>",
"{",
"programBuilder",
".",
"add",
"(",
"createCell",
"(",
"'id1'",
",",
"'print(1)'",
")",
",",
"createCell",
"(",
"'id2'",
",",
"'print(2)'",
")",
")",
";",
"let",
"tree",
"=",
"programBuilder",
".",
"buildTo",
"(",
"'id2'",
")",
".",
"tree",
";",
"expect",
"(",
"tree",
".",
"code",
"[",
"0",
"]",
".",
"location",
".",
"first_line",
")",
".",
"to",
".",
"equal",
"(",
"1",
")",
";",
"expect",
"(",
"tree",
".",
"code",
"[",
"1",
"]",
".",
"location",
".",
"first_line",
")",
".",
"to",
".",
"equal",
"(",
"2",
")",
";",
"}",
")",
";",
"it",
"(",
"'annotates tree nodes with cell ID info'",
",",
"(",
")",
"=>",
"{",
"programBuilder",
".",
"add",
"(",
"createCell",
"(",
"'id1'",
",",
"'print(1)'",
")",
")",
";",
"let",
"tree",
"=",
"programBuilder",
".",
"buildTo",
"(",
"'id1'",
")",
".",
"tree",
";",
"expect",
"(",
"tree",
".",
"code",
"[",
"0",
"]",
".",
"location",
".",
"path",
")",
".",
"to",
".",
"equal",
"(",
"'id1'",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
352,
null,
2,
null,
2,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
352,
null,
null,
null,
null,
null,
null,
null,
null,
null,
352,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
352,
null,
null,
null,
null,
null,
null,
null,
null,
null,
352,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
352,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
352,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
352,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
318,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
318,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
318,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
164 | [
"import",
"{",
"expect",
"}",
"from",
"'chai'",
";",
"import",
"{",
"Location",
",",
"parse",
",",
"locationString",
"}",
"from",
"'../python-parser'",
";",
"import",
"{",
"LocationSet",
",",
"slice",
"}",
"from",
"'../slice'",
";",
"import",
"{",
"DataflowAnalyzer",
"}",
"from",
"'../data-flow'",
";",
"function",
"loc",
"(",
"line0",
",",
"col0",
",",
"line1",
"=",
"line0",
"+",
"1",
",",
"col1",
"=",
"0",
")",
"{",
"return",
"{",
"first_line",
":",
"line0",
",",
"first_column",
":",
"col0",
",",
"last_line",
":",
"line1",
",",
"last_column",
":",
"col1",
"}",
";",
"}",
"describe",
"(",
"'slice'",
",",
"(",
")",
"=>",
"{",
"it",
"(",
"'statements including the def and use'",
",",
"(",
")",
"=>",
"{",
"let",
"ast",
"=",
"parse",
"(",
"[",
"'a = 1'",
",",
"'b = a'",
",",
"''",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"let",
"locations",
"=",
"slice",
"(",
"ast",
",",
"new",
"LocationSet",
"(",
"loc",
"(",
"2",
",",
"0",
",",
"2",
",",
"5",
")",
")",
")",
";",
"expect",
"(",
"locations",
".",
"items",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"loc",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'at least yields the statement for a seed'",
",",
"(",
")",
"=>",
"{",
"let",
"ast",
"=",
"parse",
"(",
"[",
"'c = 1'",
",",
"''",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"let",
"locations",
"=",
"slice",
"(",
"ast",
",",
"new",
"LocationSet",
"(",
"loc",
"(",
"1",
",",
"0",
",",
"1",
",",
"2",
")",
")",
")",
";",
"expect",
"(",
"locations",
".",
"items",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"loc",
"(",
"1",
",",
"0",
",",
"1",
",",
"5",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'does our current demo'",
",",
"(",
")",
"=>",
"{",
"const",
"ast",
"=",
"parse",
"(",
"[",
"'from matplotlib.pyplot import scatter'",
",",
"'from sklearn.cluster import KMeans'",
",",
"'from sklearn import datasets'",
",",
"'data = datasets.load_iris().data[:,2:4]'",
",",
"'petal_length, petal_width = data[:,0], data[:,1]'",
",",
"'print(\"Average petal length: %.3f\" % (sum(petal_length) / len(petal_length),))'",
",",
"'clusters = KMeans(n_clusters=5).fit(data).labels_'",
",",
"'scatter(petal_length, petal_width, c=clusters)'",
",",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"const",
"da",
"=",
"new",
"DataflowAnalyzer",
"(",
")",
";",
"const",
"locations",
"=",
"slice",
"(",
"ast",
",",
"new",
"LocationSet",
"(",
"loc",
"(",
"8",
",",
"0",
",",
"8",
",",
"46",
")",
")",
",",
"da",
")",
";",
"const",
"lineNums",
"=",
"locations",
".",
"items",
".",
"map",
"(",
"loc",
"=>",
"loc",
".",
"first_line",
")",
";",
"[",
"1",
",",
"2",
",",
"3",
",",
"4",
",",
"5",
",",
"7",
",",
"8",
"]",
".",
"forEach",
"(",
"line",
"=>",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"deep",
".",
"include",
"(",
"line",
")",
")",
";",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"not",
".",
"include",
"(",
"6",
")",
";",
"}",
")",
";",
"it",
"(",
"'uses api specs to decide mutating methods'",
",",
"(",
")",
"=>",
"{",
"const",
"ast",
"=",
"parse",
"(",
"[",
"'import pandas as pd'",
",",
"'d = pd.read_csv(\"some_path\")'",
",",
"'d.pop(\"Column\")'",
",",
"'d.memory_usage()'",
",",
"'d.count()'",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"const",
"da",
"=",
"new",
"DataflowAnalyzer",
"(",
")",
";",
"const",
"criterion",
"=",
"new",
"LocationSet",
"(",
"loc",
"(",
"5",
",",
"0",
",",
"5",
",",
"12",
")",
")",
";",
"const",
"locations",
"=",
"slice",
"(",
"ast",
",",
"criterion",
",",
"da",
")",
";",
"const",
"lineNums",
"=",
"locations",
".",
"items",
".",
"map",
"(",
"loc",
"=>",
"loc",
".",
"first_line",
")",
";",
"[",
"1",
",",
"2",
",",
"3",
",",
"5",
"]",
".",
"forEach",
"(",
"line",
"=>",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"include",
"(",
"line",
")",
")",
";",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"not",
".",
"include",
"(",
"4",
")",
";",
"}",
")",
";",
"it",
"(",
"'joins inferred types'",
",",
"(",
")",
"=>",
"{",
"const",
"ast",
"=",
"parse",
"(",
"[",
"'import pandas as pd'",
",",
"'import random'",
",",
"'if random.choice([1,2]) == 1:'",
",",
"' data = pd.read_csv(\"some_path\")'",
",",
"'else:'",
",",
"' data = pd.read_csv(\"other_path\")'",
",",
"'data.pop(\"Column\")'",
",",
"'data.memory_usage()'",
",",
"'data.count()'",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"const",
"criterion",
"=",
"new",
"LocationSet",
"(",
"loc",
"(",
"9",
",",
"0",
",",
"9",
",",
"12",
")",
")",
";",
"const",
"locations",
"=",
"slice",
"(",
"ast",
",",
"criterion",
",",
"new",
"DataflowAnalyzer",
"(",
")",
")",
";",
"const",
"lineNums",
"=",
"locations",
".",
"items",
".",
"map",
"(",
"loc",
"=>",
"loc",
".",
"first_line",
")",
";",
"[",
"1",
",",
"2",
",",
"3",
",",
"4",
",",
"5",
",",
"6",
",",
"7",
",",
"9",
"]",
".",
"forEach",
"(",
"line",
"=>",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"include",
"(",
"line",
")",
")",
";",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"not",
".",
"include",
"(",
"8",
")",
";",
"}",
")",
";",
"it",
"(",
"'does the documentation example'",
",",
"(",
")",
"=>",
"{",
"const",
"ast",
"=",
"parse",
"(",
"[",
"'sum = 0'",
",",
"'diff_sum = 0'",
",",
"'for i in range(min(len(A), len(B))):'",
",",
"' sum += A[i] + B[i]'",
",",
"' diff_sum += A[i] - B[i]'",
",",
"'print(sum)'",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"const",
"da",
"=",
"new",
"DataflowAnalyzer",
"(",
")",
";",
"const",
"criterion",
"=",
"new",
"LocationSet",
"(",
"loc",
"(",
"6",
",",
"0",
",",
"6",
",",
"10",
")",
")",
";",
"const",
"locations",
"=",
"slice",
"(",
"ast",
",",
"criterion",
",",
"da",
")",
";",
"const",
"lineNums",
"=",
"locations",
".",
"items",
".",
"map",
"(",
"loc",
"=>",
"loc",
".",
"first_line",
")",
";",
"[",
"1",
",",
"3",
",",
"4",
",",
"6",
"]",
".",
"forEach",
"(",
"line",
"=>",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"include",
"(",
"line",
")",
")",
";",
"[",
"2",
",",
"5",
"]",
".",
"forEach",
"(",
"line",
"=>",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"not",
".",
"include",
"(",
"line",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'eliminates functions without side-effects'",
",",
"(",
")",
"=>",
"{",
"const",
"ast",
"=",
"parse",
"(",
"[",
"'def innocent(i):'",
",",
"' [1,2,3][i] = 3'",
",",
"'a=0'",
",",
"'innocent(a)'",
",",
"'b=2*a'",
",",
"'print(b)'",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"const",
"da",
"=",
"new",
"DataflowAnalyzer",
"(",
")",
";",
"const",
"criterion",
"=",
"new",
"LocationSet",
"(",
"loc",
"(",
"6",
",",
"0",
",",
"6",
",",
"8",
")",
")",
";",
"const",
"locations",
"=",
"slice",
"(",
"ast",
",",
"criterion",
",",
"da",
")",
";",
"const",
"lineNums",
"=",
"locations",
".",
"items",
".",
"map",
"(",
"loc",
"=>",
"loc",
".",
"first_line",
")",
";",
"[",
"3",
",",
"5",
",",
"6",
"]",
".",
"forEach",
"(",
"line",
"=>",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"include",
"(",
"line",
")",
")",
";",
"[",
"1",
",",
"2",
",",
"4",
"]",
".",
"forEach",
"(",
"line",
"=>",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"not",
".",
"include",
"(",
"line",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'keeps functions with item updates'",
",",
"(",
")",
"=>",
"{",
"const",
"ast",
"=",
"parse",
"(",
"[",
"'def zap(x):'",
",",
"' x[1]=\"zap\"'",
",",
"'a=[1,2,3]'",
",",
"'zap(a)'",
",",
"'b=a[2]'",
",",
"'print(b)'",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"const",
"da",
"=",
"new",
"DataflowAnalyzer",
"(",
")",
";",
"const",
"criterion",
"=",
"new",
"LocationSet",
"(",
"loc",
"(",
"6",
",",
"0",
",",
"6",
",",
"8",
")",
")",
";",
"const",
"locations",
"=",
"slice",
"(",
"ast",
",",
"criterion",
",",
"da",
")",
";",
"const",
"lineNums",
"=",
"locations",
".",
"items",
".",
"map",
"(",
"loc",
"=>",
"loc",
".",
"first_line",
")",
";",
"[",
"1",
",",
"3",
",",
"4",
",",
"5",
",",
"6",
"]",
".",
"forEach",
"(",
"line",
"=>",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"include",
"(",
"line",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'keeps functions with field updates'",
",",
"(",
")",
"=>",
"{",
"const",
"ast",
"=",
"parse",
"(",
"[",
"'class C:'",
",",
"' f = 0'",
",",
"'def zap(x):'",
",",
"' x.f += 1'",
",",
"'def innocent(x):'",
",",
"' print(x.f)'",
",",
"'a=C()'",
",",
"'zap(a)'",
",",
"'innocent(a)'",
",",
"'b=a.f'",
",",
"'print(b)'",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"const",
"da",
"=",
"new",
"DataflowAnalyzer",
"(",
")",
";",
"const",
"criterion",
"=",
"new",
"LocationSet",
"(",
"loc",
"(",
"11",
",",
"0",
",",
"11",
",",
"8",
")",
")",
";",
"const",
"locations",
"=",
"slice",
"(",
"ast",
",",
"criterion",
",",
"da",
")",
";",
"const",
"lineNums",
"=",
"locations",
".",
"items",
".",
"map",
"(",
"loc",
"=>",
"loc",
".",
"first_line",
")",
";",
"[",
"1",
",",
"3",
",",
"7",
",",
"8",
",",
"10",
",",
"11",
"]",
".",
"forEach",
"(",
"line",
"=>",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"include",
"(",
"line",
")",
")",
";",
"[",
"5",
",",
"9",
"]",
".",
"forEach",
"(",
"line",
"=>",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"not",
".",
"include",
"(",
"line",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"'handles transitive updates'",
",",
"(",
")",
"=>",
"{",
"const",
"ast",
"=",
"parse",
"(",
"[",
"'import pandas as pd'",
",",
"'df=pd.read_from_csv(\"path\")'",
",",
"'def zap(x):'",
",",
"' x.pop(\"Column\")'",
",",
"'zap(df)'",
",",
"'df.count()'",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"const",
"criterion",
"=",
"new",
"LocationSet",
"(",
"loc",
"(",
"6",
",",
"0",
",",
"6",
",",
"10",
")",
")",
";",
"const",
"locations",
"=",
"slice",
"(",
"ast",
",",
"criterion",
",",
"new",
"DataflowAnalyzer",
"(",
")",
")",
";",
"const",
"lineNums",
"=",
"locations",
".",
"items",
".",
"map",
"(",
"loc",
"=>",
"loc",
".",
"first_line",
")",
";",
"[",
"1",
",",
"2",
",",
"3",
",",
"5",
",",
"6",
"]",
".",
"forEach",
"(",
"line",
"=>",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"include",
"(",
"line",
")",
")",
";",
"}",
")",
";",
"it",
"(",
"\"does jim's demo\"",
",",
"(",
")",
"=>",
"{",
"const",
"ast",
"=",
"parse",
"(",
"[",
"\"import pandas as pd\"",
",",
"\"Cars = {'Brand': ['Honda Civic','Toyota Corolla','Ford Focus','Audi A4'], 'Price': [22000,25000,27000,35000]}\"",
",",
"\"df = pd.DataFrame(Cars,columns= ['Brand', 'Price'])\"",
",",
"\"def check(df, size=11):\"",
",",
"\" print(df)\"",
",",
"\"print(df)\"",
",",
"\"x = df['Brand'].values\"",
"]",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"const",
"criterion",
"=",
"new",
"LocationSet",
"(",
"loc",
"(",
"7",
",",
"0",
",",
"7",
",",
"21",
")",
")",
";",
"const",
"locations",
"=",
"slice",
"(",
"ast",
",",
"criterion",
",",
"new",
"DataflowAnalyzer",
"(",
")",
")",
";",
"const",
"lineNums",
"=",
"locations",
".",
"items",
".",
"map",
"(",
"loc",
"=>",
"loc",
".",
"first_line",
")",
";",
"[",
"1",
",",
"2",
",",
"3",
",",
"7",
"]",
".",
"forEach",
"(",
"line",
"=>",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"include",
"(",
"line",
")",
")",
";",
"[",
"4",
",",
"5",
",",
"6",
"]",
".",
"forEach",
"(",
"line",
"=>",
"expect",
"(",
"lineNums",
")",
".",
"to",
".",
"not",
".",
"include",
"(",
"line",
")",
")",
";",
"}",
")",
";",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
163,
null,
3,
null,
3,
null,
3,
null,
null,
null,
null,
null,
3,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27926,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27926,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27926,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27926,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27926,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
27926,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
12619,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
165 | [
"import",
"React",
"from",
"'react'",
";",
"import",
"ReactDOM",
"from",
"'react-dom'",
";",
"import",
"{",
"createStore",
"}",
"from",
"'@ice/store'",
";",
"import",
"'react-app-polyfill/ie11'",
";",
"import",
"'react-app-polyfill/stable'",
";",
"const",
"delay",
"=",
"(",
"time",
")",
"=>",
"new",
"Promise",
"(",
"(",
"resolve",
")",
"=>",
"setTimeout",
"(",
"(",
")",
"=>",
"resolve",
"(",
")",
",",
"time",
")",
")",
";",
"const",
"counter",
"=",
"{",
"state",
":",
"0",
",",
"reducers",
":",
"{",
"increment",
":",
"(",
"prevState",
")",
"=>",
"prevState",
"+",
"1",
",",
"decrement",
":",
"(",
"prevState",
")",
"=>",
"prevState",
"-",
"1",
",",
"}",
",",
"effects",
":",
"(",
")",
"=>",
"(",
"{",
"async",
"asyncDecrement",
"(",
")",
"{",
"await",
"delay",
"(",
"1000",
")",
";",
"this",
".",
"decrement",
"(",
")",
";",
"}",
",",
"}",
")",
",",
"}",
";",
"const",
"models",
"=",
"{",
"counter",
",",
"}",
";",
"const",
"store",
"=",
"createStore",
"(",
"models",
")",
";",
"const",
"{",
"useModel",
"}",
"=",
"store",
";",
"function",
"Counter",
"(",
")",
"{",
"const",
"[",
"count",
",",
"dispatchers",
"]",
"=",
"useModel",
"(",
"'counter'",
")",
";",
"const",
"{",
"increment",
",",
"asyncDecrement",
"}",
"=",
"dispatchers",
";",
"return",
"(",
"<",
"div",
">",
"<",
"span",
">",
"{",
"count",
"}",
"<",
"/span>",
"<",
"button",
"type",
"=",
"\"button\"",
"onClick",
"=",
"{",
"increment",
"}",
">",
"+",
"<",
"/button>",
"<",
"button",
"type",
"=",
"\"button\"",
"onClick",
"=",
"{",
"asyncDecrement",
"}",
">",
"-",
"<",
"/button>",
"<",
"/div>);",
"}",
"const",
"{",
"Provider",
"}",
"=",
"store",
";",
"function",
"App",
"(",
")",
"{",
"return",
"(",
"<",
"Provider",
">",
"<",
"Counter",
"/>",
"<",
"/Provider>);",
"}",
"const",
"rootElement",
"=",
"document",
".",
"getElementById",
"(",
"'root'",
")",
";",
"ReactDOM",
".",
"render",
"(",
"<",
"App",
"/>, rootElement);"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
9,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
9,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
15,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
166 | [
"import",
"{",
"Injectable",
"}",
"from",
"'@angular/core'",
";",
"@",
"Injectable",
"(",
"{",
"providedIn",
":",
"'root'",
",",
"}",
")",
"export",
"class",
"LocalStorageService",
"{",
"set",
"(",
"key",
",",
"value",
")",
"{",
"localStorage",
".",
"setItem",
"(",
"key",
",",
"value",
")",
";",
"}",
"get",
"(",
"key",
")",
"{",
"return",
"localStorage",
".",
"getItem",
"(",
"key",
")",
";",
"}",
"remove",
"(",
"key",
")",
"{",
"localStorage",
".",
"removeItem",
"(",
"key",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
2,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
167 | [
"import",
"{",
"HttpClient",
",",
"HttpHeaders",
"}",
"from",
"'@angular/common/http'",
";",
"import",
"{",
"Injectable",
"}",
"from",
"'@angular/core'",
";",
"import",
"{",
"Observable",
"}",
"from",
"'rxjs'",
";",
"import",
"{",
"IDefaultReturnType",
",",
"ISearchQuery",
",",
"ISearchService",
",",
"}",
"from",
"'@sourceloop/search-client'",
";",
"import",
"{",
"LocalStorageService",
"}",
"from",
"'./local-storage.service'",
";",
"@",
"Injectable",
"(",
"{",
"providedIn",
":",
"'root'",
",",
"}",
")",
"export",
"class",
"SearchService",
"implements",
"ISearchService",
"<",
"IDefaultReturnType",
">",
"{",
"constructor",
"(",
"private",
"readonly",
"http",
",",
"private",
"readonly",
"localStorageService",
")",
"{",
"}",
"searchApiRequest",
"(",
"requestParameters",
",",
"saveInRecents",
")",
"{",
"const",
"httpOptions",
"=",
"{",
"headers",
":",
"new",
"HttpHeaders",
"(",
"{",
"'Content-Type'",
":",
"'application/json'",
",",
"Authorization",
":",
"`Bearer ${",
"this",
".",
"localStorageService",
".",
"get",
"(",
"'token'",
")",
"}`",
",",
"}",
")",
",",
"}",
";",
"let",
"url",
"=",
"''",
";",
"url",
"=",
"`http://localhost:3000/search?query[match]=${",
"requestParameters",
".",
"match",
"}`",
";",
"url",
"+=",
"`&query[limit]=${",
"requestParameters",
".",
"limit",
"}`",
";",
"url",
"+=",
"`&query[limitByType]=${",
"requestParameters",
".",
"limitByType",
"}`",
";",
"url",
"+=",
"`&query[order]=${",
"requestParameters",
".",
"order",
"}`",
";",
"url",
"+=",
"`&saveInRecents=${",
"saveInRecents",
"}`",
";",
"if",
"(",
"requestParameters",
".",
"sources",
"?.",
"length",
")",
"{",
"url",
"=",
"url",
"+",
"`&query[sources][0]=${",
"requestParameters",
".",
"sources",
"}`",
";",
"}",
"return",
"this",
".",
"http",
".",
"get",
"<",
"Array",
"<",
"IDefaultReturnType",
">",
">",
"(",
"url",
",",
"httpOptions",
")",
";",
"}",
"recentSearchApiRequest",
"(",
")",
"{",
"const",
"httpOptions",
"=",
"{",
"headers",
":",
"new",
"HttpHeaders",
"(",
"{",
"'Content-Type'",
":",
"'application/json'",
",",
"Authorization",
":",
"`Bearer ${",
"this",
".",
"localStorageService",
".",
"get",
"(",
"'token'",
")",
"}`",
",",
"}",
")",
",",
"}",
";",
"return",
"this",
".",
"http",
".",
"get",
"<",
"Array",
"<",
"ISearchQuery",
">",
">",
"(",
"`http://localhost:3000/search/recents`",
",",
"httpOptions",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
160,
null,
null,
null,
3231,
null,
null,
null,
18,
null,
37595,
null,
8,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
18,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
168 | [
"import",
"{",
"Component",
"}",
"from",
"'@angular/core'",
";",
"import",
"{",
"LocalStorageService",
"}",
"from",
"'../local-storage.service'",
";",
"@",
"Component",
"(",
"{",
"selector",
":",
"'app-token-input'",
",",
"templateUrl",
":",
"'./token-input.component.html'",
",",
"}",
")",
"export",
"class",
"TokenInputComponent",
"{",
"token",
":",
"string",
";",
"tokenSet",
":",
"boolean",
";",
"constructor",
"(",
"private",
"readonly",
"localStorageService",
")",
"{",
"this",
".",
"token",
"=",
"''",
";",
"this",
".",
"tokenSet",
"=",
"false",
";",
"}",
"onSubmit",
"(",
")",
"{",
"this",
".",
"localStorageService",
".",
"set",
"(",
"'token'",
",",
"this",
".",
"token",
")",
";",
"this",
".",
"tokenSet",
"=",
"true",
";",
"this",
".",
"token",
"=",
"''",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3231,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
169 | [
"export",
"const",
"environment",
"=",
"{",
"production",
":",
"false",
",",
"}",
";"
] | [
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null
] |
170 | [
"export",
"const",
"environment",
"=",
"{",
"production",
":",
"true",
"}",
";"
] | [
null,
null,
6,
null,
null,
null,
null,
null,
null,
null
] |
171 | [
"import",
"Vue",
"from",
"\"vue\"",
";",
"import",
"VueRouter",
",",
"{",
"RouteConfig",
"}",
"from",
"\"vue-router\"",
";",
"Vue",
".",
"use",
"(",
"VueRouter",
")",
";",
"const",
"routes",
"=",
"[",
"{",
"path",
":",
"\"/\"",
",",
"name",
":",
"\"Home\"",
",",
"component",
":",
"(",
")",
"=>",
"import",
"(",
"\"../views/home/index.vue\"",
")",
",",
"meta",
":",
"{",
"title",
":",
"\"首页\"",
",",
"headColor",
":",
"\"white\"",
",",
"}",
",",
"}",
",",
"{",
"path",
":",
"\"/login\"",
",",
"name",
":",
"\"Login\"",
",",
"component",
":",
"(",
")",
"=>",
"import",
"(",
"\"../views/login/index.vue\"",
")",
",",
"meta",
":",
"{",
"title",
":",
"\"登录\"",
",",
"}",
",",
"}",
",",
"{",
"path",
":",
"\"/register\"",
",",
"name",
":",
"\"Register\"",
",",
"component",
":",
"(",
")",
"=>",
"import",
"(",
"\"../views/register/index.vue\"",
")",
",",
"meta",
":",
"{",
"title",
":",
"\"注册\"",
",",
"}",
",",
"}",
",",
"{",
"path",
":",
"\"/user\"",
",",
"name",
":",
"\"User\"",
",",
"component",
":",
"(",
")",
"=>",
"import",
"(",
"\"../views/user/index.vue\"",
")",
",",
"meta",
":",
"{",
"title",
":",
"\"个人中心\"",
",",
"}",
",",
"}",
",",
"{",
"path",
":",
"\"/profile\"",
",",
"name",
":",
"\"Profile\"",
",",
"component",
":",
"(",
")",
"=>",
"import",
"(",
"\"../views/profile/index.vue\"",
")",
",",
"meta",
":",
"{",
"title",
":",
"\"账号管理\"",
",",
"}",
",",
"}",
",",
"{",
"path",
":",
"\"/product-list\"",
",",
"name",
":",
"\"ProductList\"",
",",
"component",
":",
"(",
")",
"=>",
"import",
"(",
"\"../views/product-list/index.vue\"",
")",
",",
"meta",
":",
"{",
"isHidden",
":",
"true",
",",
"}",
",",
"}",
",",
"]",
";",
"const",
"router",
"=",
"new",
"VueRouter",
"(",
"{",
"mode",
":",
"\"history\"",
",",
"base",
":",
"process",
".",
"env",
".",
"BASE_URL",
",",
"routes",
",",
"}",
")",
";",
"export",
"default",
"router",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
13,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6310,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
172 | [
"import",
"qs",
"from",
"\"qs\"",
";",
"import",
"Axios",
"from",
"\"axios\"",
";",
"import",
"Vue",
"from",
"\"vue\"",
";",
"const",
"HTTP",
"=",
"Axios",
".",
"create",
"(",
"{",
"baseURL",
":",
"\"\"",
",",
"headers",
":",
"{",
"\"Content-Type\"",
":",
"\"application/x-www-form-urlencoded;charset=UTF-8\"",
"}",
",",
"timeout",
":",
"30000",
",",
"withCredentials",
":",
"false",
"}",
")",
";",
"HTTP",
".",
"interceptors",
".",
"request",
".",
"use",
"(",
"config",
"=>",
"{",
"if",
"(",
"config",
".",
"method",
"===",
"\"post\"",
")",
"{",
"config",
".",
"data",
"=",
"qs",
".",
"stringify",
"(",
"config",
".",
"data",
")",
";",
"}",
"return",
"config",
";",
"}",
",",
"error",
"=>",
"{",
"throw",
"new",
"Error",
"(",
"error",
")",
";",
"}",
")",
";",
"HTTP",
".",
"interceptors",
".",
"response",
".",
"use",
"(",
"response",
"=>",
"{",
"const",
"data",
"=",
"response",
".",
"data",
";",
"return",
"data",
";",
"}",
",",
"error",
"=>",
"{",
"if",
"(",
"Vue",
".",
"prototype",
".",
"$loading",
")",
"{",
"Vue",
".",
"prototype",
".",
"$loading",
".",
"close",
"(",
")",
";",
"}",
"throw",
"new",
"Error",
"(",
"error",
")",
";",
"}",
")",
";",
"export",
"default",
"HTTP",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
446,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
270,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
92,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
173 | [
"import",
"HTTP",
"from",
"\"../utils/http\"",
";",
"export",
"interface",
"LoginParamsProps",
"{",
"username",
":",
"string",
";",
"password",
":",
"string",
";",
"}",
"export",
"interface",
"RegisterParamsProps",
"{",
"username",
":",
"string",
";",
"password",
":",
"string",
";",
"email",
":",
"string",
";",
"phone",
":",
"string",
";",
"question",
":",
"string",
";",
"answer",
":",
"string",
";",
"}",
"export",
"interface",
"ProductListParams",
"{",
"categoryId",
"?",
":",
"number",
";",
"keyword",
"?",
":",
"string",
";",
"pageNum",
":",
"number",
";",
"pageSize",
":",
"number",
";",
"orderBy",
":",
"string",
";",
"}",
"export",
"interface",
"ProductDetailParams",
"{",
"productId",
":",
"number",
";",
"}",
"/**\n * 检查用户登录状态\n */",
"export",
"const",
"checkLogin",
"=",
"async",
"(",
")",
"=>",
"HTTP",
".",
"post",
"(",
"\"/user/get_user_info.do\"",
")",
";",
"/**\n * 去登录\n */",
"export",
"const",
"userLogin",
"=",
"async",
"(",
"params",
")",
"=>",
"HTTP",
".",
"post",
"(",
"\"/user/login.do\"",
",",
"params",
")",
";",
"/**\n * 注册\n */",
"export",
"const",
"userRegister",
"=",
"async",
"(",
"params",
")",
"=>",
"HTTP",
".",
"post",
"(",
"\"/user/register.do\"",
",",
"params",
")",
";",
"/**\n * 退出登录\n */",
"export",
"const",
"logout",
"=",
"async",
"(",
")",
"=>",
"HTTP",
".",
"post",
"(",
"\"/user/logout.do\"",
")",
";",
"/**\n * 商品列表\n * keyword和category不能同时传,会报错500\n */",
"export",
"const",
"getProductList",
"=",
"(",
"params",
")",
"=>",
"HTTP",
".",
"post",
"(",
"\"/product/list.do\"",
",",
"params",
")",
";",
"/**\n * 商品详情\n */",
"export",
"const",
"getProductDetail",
"=",
"(",
"params",
")",
"=>",
"HTTP",
".",
"post",
"(",
"\"/product/detail.do\"",
",",
"params",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
174 | [
"import",
"{",
"Commit",
"}",
"from",
"\"vuex\"",
";",
"import",
"{",
"HomeState",
",",
"UserInfoProps",
"}",
"from",
"\"./interface\"",
";",
"import",
"{",
"checkLogin",
",",
"userLogin",
",",
"LoginParamsProps",
",",
"RegisterParamsProps",
",",
"userRegister",
",",
"logout",
"}",
"from",
"\"../../api/index\"",
";",
"interface",
"RequestDataProps",
"{",
"status",
":",
"number",
";",
"msg",
"?",
":",
"string",
";",
"data",
"?",
":",
"any",
";",
"}",
"const",
"state",
"=",
"{",
"loginStatus",
":",
"false",
",",
"userInfo",
":",
"{",
"answer",
":",
"\"\"",
",",
"createTime",
":",
"0",
",",
"email",
":",
"\"\"",
",",
"id",
":",
"0",
",",
"password",
":",
"\"\"",
",",
"phone",
":",
"\"\"",
",",
"question",
":",
"\"\"",
",",
"role",
":",
"0",
",",
"updateTime",
":",
"0",
",",
"username",
":",
"\"\"",
",",
"}",
",",
"}",
";",
"const",
"mutations",
"=",
"{",
"setStatus",
"(",
"state",
",",
"status",
")",
"{",
"state",
".",
"loginStatus",
"=",
"status",
";",
"}",
",",
"setUserInfo",
"(",
"state",
",",
"info",
")",
"{",
"state",
".",
"userInfo",
"=",
"info",
";",
"}",
",",
"}",
";",
"const",
"getters",
"=",
"{",
"loginStatus",
":",
"(",
"state",
")",
"=>",
"state",
".",
"loginStatus",
",",
"userInfo",
":",
"(",
"state",
")",
"=>",
"state",
".",
"userInfo",
",",
"}",
";",
"const",
"actions",
"=",
"{",
"async",
"judgeLoginStatus",
"(",
"{",
"commit",
"}",
")",
"{",
"const",
"requestData",
"=",
"await",
"checkLogin",
"(",
")",
";",
"commit",
"(",
"\"setStatus\"",
",",
"requestData",
".",
"status",
"===",
"0",
")",
";",
"commit",
"(",
"\"setUserInfo\"",
",",
"requestData",
".",
"data",
")",
";",
"}",
",",
"async",
"toLogin",
"(",
"{",
"commit",
"}",
",",
"info",
")",
"{",
"const",
"requestData",
"=",
"await",
"userLogin",
"(",
"info",
")",
";",
"commit",
"(",
"\"setUserInfo\"",
",",
"requestData",
".",
"data",
")",
";",
"if",
"(",
"requestData",
".",
"status",
"===",
"0",
")",
"{",
"window",
".",
"router",
".",
"back",
"(",
")",
";",
"}",
"else",
"{",
"alert",
"(",
"requestData",
".",
"msg",
")",
";",
"}",
"}",
",",
"async",
"toRegister",
"(",
"{",
"commit",
"}",
",",
"info",
")",
"{",
"const",
"requestData",
"=",
"await",
"userRegister",
"(",
"info",
")",
";",
"if",
"(",
"requestData",
".",
"status",
"===",
"0",
")",
"{",
"window",
".",
"router",
".",
"back",
"(",
")",
";",
"}",
"else",
"{",
"alert",
"(",
"requestData",
".",
"msg",
")",
";",
"}",
"}",
",",
"async",
"toLogout",
"(",
"{",
"commit",
"}",
")",
"{",
"const",
"requestData",
"=",
"await",
"logout",
"(",
")",
";",
"if",
"(",
"requestData",
".",
"status",
"===",
"0",
")",
"{",
"commit",
"(",
"'setStatus'",
",",
"false",
")",
";",
"window",
".",
"router",
".",
"push",
"(",
"{",
"name",
":",
"'Home'",
"}",
")",
";",
"}",
"}",
"}",
";",
"export",
"default",
"{",
"state",
",",
"getters",
",",
"mutations",
",",
"actions",
",",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5825,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
4,
null,
5825,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
5825,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
5825,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5825,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
175 | [
"import",
"{",
"Commit",
"}",
"from",
"\"vuex\"",
";",
"import",
"{",
"getProductList",
",",
"ProductListParams",
",",
"getProductDetail",
",",
"}",
"from",
"\"@/api/index\"",
";",
"import",
"{",
"ProductState",
",",
"ProductItemProps",
",",
"ProductDetailProps",
",",
"}",
"from",
"\"./interface\"",
";",
"const",
"state",
"=",
"{",
"productList",
":",
"[",
"]",
",",
"currentProduct",
":",
"{",
"categoryId",
":",
"0",
",",
"createTime",
":",
"\"\"",
",",
"detail",
":",
"\"\"",
",",
"id",
":",
"0",
",",
"imageHost",
":",
"\"\"",
",",
"mainImage",
":",
"\"\"",
",",
"name",
":",
"\"\"",
",",
"parentCategoryId",
":",
"0",
",",
"price",
":",
"0",
",",
"status",
":",
"0",
",",
"stock",
":",
"0",
",",
"subImages",
":",
"\"\"",
",",
"subtitle",
":",
"\"\"",
",",
"updateTime",
":",
"\"\"",
",",
"}",
",",
"detailShow",
":",
"false",
",",
"}",
";",
"const",
"mutations",
"=",
"{",
"setProductList",
"(",
"state",
",",
"list",
")",
"{",
"state",
".",
"productList",
"=",
"list",
";",
"}",
",",
"setProductInfo",
"(",
"state",
",",
"info",
")",
"{",
"state",
".",
"currentProduct",
"=",
"info",
";",
"}",
",",
"setDetailShow",
"(",
"state",
",",
"bool",
")",
"{",
"state",
".",
"detailShow",
"=",
"bool",
";",
"}",
",",
"}",
";",
"const",
"getters",
"=",
"{",
"productList",
":",
"(",
"state",
")",
"=>",
"state",
".",
"productList",
",",
"}",
";",
"const",
"actions",
"=",
"{",
"async",
"fetchProductList",
"(",
"{",
"state",
",",
"commit",
"}",
",",
"{",
"params",
",",
"loadMore",
"}",
")",
"{",
"const",
"requestData",
"=",
"await",
"getProductList",
"(",
"params",
")",
";",
"const",
"currentData",
"=",
"loadMore",
"?",
"state",
".",
"productList",
".",
"concat",
"(",
"requestData",
".",
"data",
".",
"list",
")",
":",
"requestData",
".",
"data",
".",
"list",
";",
"commit",
"(",
"\"setProductList\"",
",",
"currentData",
")",
";",
"}",
",",
"async",
"fetchProductInfo",
"(",
"{",
"commit",
"}",
",",
"productId",
")",
"{",
"const",
"requestData",
"=",
"await",
"getProductDetail",
"(",
"{",
"productId",
"}",
")",
";",
"commit",
"(",
"\"setDetailShow\"",
",",
"true",
")",
";",
"commit",
"(",
"\"setProductInfo\"",
",",
"requestData",
".",
"data",
")",
";",
"}",
",",
"}",
";",
"export",
"default",
"{",
"state",
",",
"mutations",
",",
"getters",
",",
"actions",
",",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3768,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
4,
null,
3768,
null,
13,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
3768,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
3768,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
3768,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
176 | [
"import",
"Vue",
"from",
"\"vue\"",
";",
"import",
"App",
"from",
"\"./App.vue\"",
";",
"import",
"\"./registerServiceWorker\"",
";",
"import",
"router",
"from",
"\"./router\"",
";",
"import",
"store",
"from",
"\"./store\"",
";",
"import",
"\"./assets/styles/index.scss\"",
";",
"Vue",
".",
"config",
".",
"productionTip",
"=",
"false",
";",
"new",
"Vue",
"(",
"{",
"router",
",",
"store",
",",
"render",
":",
"(",
"h",
")",
"=>",
"h",
"(",
"App",
")",
",",
"}",
")",
".",
"$mount",
"(",
"\"#app\"",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
825,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
177 | [
"export",
"interface",
"DataProps",
"{",
"headList",
":",
"Array",
"<",
"any",
">",
";",
"categoryList",
":",
"Array",
"<",
"any",
">",
";",
"floorList",
":",
"Array",
"<",
"any",
">",
";",
"}",
"export",
"const",
"homeData",
"=",
"{",
"headList",
":",
"[",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/s1125x690_jfs/t29188/301/133996293/200131/61f42a01/5be8eed6Nda6a18a5.jpg!cr_1125x549_0_72!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100008",
",",
"}",
",",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/s1125x690_jfs/t30757/316/208746402/123953/9fa18794/5beb7d13Ne77e9f29.jpg!cr_1125x549_0_72!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100016",
",",
"}",
",",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/jfs/t1/3926/29/4138/254748/5b9b646dE45cbeb7f/f80c8f7c24273bc1.jpg!cr_1125x549_0_72\"",
",",
"categoryId",
":",
"100035",
",",
"}",
",",
"]",
",",
"categoryList",
":",
"[",
"{",
"name",
":",
"\"M超市\"",
",",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/jfs/t25534/207/1767774998/8085/523157d6/5bbc800fN502129b8.png\"",
",",
"categoryId",
":",
"100002",
",",
"}",
",",
"{",
"name",
":",
"\"全球购\"",
",",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/jfs/t21658/347/221358098/7461/f86e6f74/5b03b170Nc9e0ec7c.png\"",
",",
"categoryId",
":",
"100002",
",",
"}",
",",
"{",
"name",
":",
"\"M时尚\"",
",",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/jfs/t1/8385/17/3537/17895/5bd6ca67E09d23550/32d965fe9a9087a2.png\"",
",",
"categoryId",
":",
"100002",
",",
"}",
",",
"{",
"name",
":",
"\"M生鲜\"",
",",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/jfs/t17725/156/1767366877/17404/f45d418b/5ad87bf0N66c5db7c.png\"",
",",
"categoryId",
":",
"100002",
",",
"}",
",",
"{",
"name",
":",
"\"M到家\"",
",",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/jfs/t16990/157/2001547525/17770/a7b93378/5ae01befN2494769f.png\"",
",",
"categoryId",
":",
"100002",
",",
"}",
",",
"{",
"name",
":",
"\"充值缴费\"",
",",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/jfs/t18454/342/2607665324/6406/273daced/5b03b74eN3541598d.png\"",
",",
"categoryId",
":",
"100002",
",",
"}",
",",
"{",
"name",
":",
"\"9.9元拼\"",
",",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/jfs/t22228/270/207441984/11564/88140ab7/5b03fae3N67f78fe3.png\"",
",",
"categoryId",
":",
"100002",
",",
"}",
",",
"{",
"name",
":",
"\"领劵\"",
",",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/jfs/t25258/200/2527038521/14019/3d7a8470/5be92494N557a0c5b.png\"",
",",
"categoryId",
":",
"100002",
",",
"}",
",",
"{",
"name",
":",
"\"省钱\"",
",",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/jfs/t22120/183/200496447/5553/91ed22e0/5b03b7b8Ncea08c5b.png\"",
",",
"categoryId",
":",
"100002",
",",
"}",
",",
"{",
"name",
":",
"\"全部\"",
",",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/jfs/t21481/263/412160889/15938/4246b4f8/5b0cea29N8fb2865f.png\"",
",",
"categoryId",
":",
"100002",
",",
"}",
",",
"]",
",",
"floorList",
":",
"[",
"{",
"headUrl",
":",
"\"//m.360buyimg.com/mobilecms/jfs/t15526/56/2344102455/23273/d8e15d5a/5aa0dbc1Nefd2bd2a.png!q70.jpg.dpg\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"玩3C\"",
",",
"desc",
":",
"\"黑鲨新品大爆炸\"",
",",
"products",
":",
"[",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/n1/jfs/t25144/2/1278469398/101844/cb66b21/5b90f5bfNcd58f18b.png!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100001",
",",
"}",
",",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/s240x240_jfs/t22792/274/2587775944/59292/3666f607/5b87bf15N9409ba0e.png!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100002",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"title",
":",
"\"MMall家电\"",
",",
"desc",
":",
"\"家电狂欢 京彩有你\"",
",",
"products",
":",
"[",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/s240x240_jfs/t22363/318/1484948466/11138/8317fc9b/5b2a528eN7c6bde83.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100003",
",",
"}",
",",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/s240x240_jfs/t22666/293/257815171/29274/6b5605b1/5b2a5295N5a81ad96.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100004",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"title",
":",
"\"MMall超市\"",
",",
"desc",
":",
"\"超市大放价 抢超值好货\"",
",",
"products",
":",
"[",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/n1/jfs/t16852/170/2693122660/56143/28da8c2a/5b063c63N5746e4e4.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100005",
",",
"}",
",",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/n1/jfs/t18877/293/2631103430/85245/f220b40d/5b063c6fN7820b399.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100006",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"title",
":",
"\"爱家\"",
",",
"desc",
":",
"\"家纺热卖 部分低至9.9元\"",
",",
"products",
":",
"[",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/s240x240_jfs/t15244/283/356547262/47743/b6607b0f/5a2a6d51N8830e8b8.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100007",
",",
"}",
",",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/s240x240_jfs/t16057/38/102057973/36179/b957e4ec/5a2a6d55N83655f7f.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100008",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"title",
":",
"\"家有萌宝\"",
",",
"desc",
":",
"\"低至五折\"",
",",
"products",
":",
"[",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/n1/jfs/t17929/299/899794385/17291/d90318f9/5ab4c680N7d291625.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100009",
",",
"}",
",",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/n1/jfs/t18802/262/2452746578/333259/5dcdfb06/5af3ffb4N0c700b57.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100010",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"title",
":",
"\"爱吃\"",
",",
"desc",
":",
"\"9.9包邮,夏日也生动\"",
",",
"products",
":",
"[",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/s240x240_jfs/t14473/103/2042876100/41836/766c1953/5a697f47Nc952ed7f.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100011",
",",
"}",
",",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/s240x240_jfs/t17155/227/2678303408/52223/f7a950c/5b0535d6Ne4073be7.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100012",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"headUrl",
":",
"\"//m.360buyimg.com/mobilecms/jfs/t19381/275/717008577/26686/e58b7ef4/5aa23f27Nfa6d6be3.png!q70.jpg.dpg\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"智能家电馆\"",
",",
"desc",
":",
"\"满减狂欢\"",
",",
"products",
":",
"[",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/s240x240_jfs/t25183/247/391394027/33684/8e1af9dc/5b6d048aNd7dae520.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100013",
",",
"}",
",",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/s240x240_jfs/t1/839/25/11121/19615/5bccb3a0E4b504f77/e55c2fb826efe911.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100014",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"title",
":",
"\"珠宝馆\"",
",",
"desc",
":",
"\"满减优惠\"",
",",
"products",
":",
"[",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/n1/jfs/t19009/357/347377157/13661/d0d9e5fb/5a6e8bb3Nd6182f9f.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100015",
",",
"}",
",",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/n1/jfs/t27889/231/477152414/149859/7a5fb585/5baf1f58N45c2ca6c.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100016",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"title",
":",
"\"鞋靴箱包\"",
",",
"desc",
":",
"\"低至五折\"",
",",
"products",
":",
"[",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/n1/jfs/t21469/359/769885083/29352/68865ed/5b178e49Nc5db7341.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100017",
",",
"}",
",",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/mobilecms/jfs/t1/7091/11/2919/441267/5bd578bfE03e7166a/c5d5222c1802fd21.jpg!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100018",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"title",
":",
"\"童装馆\"",
",",
"desc",
":",
"\"春夏小萌娃\"",
",",
"products",
":",
"[",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/n1/jfs/t20614/194/808562651/89118/894d41a5/5b18ba8dN855ebe44.png!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100019",
",",
"}",
",",
"{",
"imgUrl",
":",
"\"//m.360buyimg.com/n1/jfs/t12460/183/2350810548/47292/f4c5485/5a914202Nfc1b8a12.png!q70.jpg.dpg\"",
",",
"categoryId",
":",
"100020",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
";",
"export",
"const",
"categoryData",
"=",
"[",
"{",
"name",
":",
"\"手机数码\"",
",",
"mainImgUrl",
":",
"\"//img20.360buyimg.com/mcoss/jfs/t16273/143/46476745/45673/cba0840c/5a28ef10N82ab81d3.jpg\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"手机通讯\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"手机\"",
",",
"imgUrl",
":",
"\"//img10.360buyimg.com/focus/s140x140_jfs/t11503/241/2246064496/4783/cea2850e/5a169216N0701c7f1.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"全面屏手机\"",
",",
"imgUrl",
":",
"\"//img30.360buyimg.com/focus/s140x140_jfs/t18955/187/1309277884/11517/fe100782/5ac48d27N3f5bb821.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"游戏手机\"",
",",
"imgUrl",
":",
"\"//img11.360buyimg.com/focus/s140x140_jfs/t11470/45/2362968077/2689/fb36d9a0/5a169238Nc8f0882b.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"拍照手机\"",
",",
"imgUrl",
":",
"\"//img20.360buyimg.com/focus/s140x140_jfs/t12022/66/917351804/2257/7ddc58e5/5a169232Ndf76f53c.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"老年机\"",
",",
"imgUrl",
":",
"\"//img12.360buyimg.com/focus/s140x140_jfs/t11461/339/2354953633/8254/8c8c50d3/5a169217N5d1b842e.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"女性手机\"",
",",
"imgUrl",
":",
"\"//img12.360buyimg.com/focus/s140x140_jfs/t15790/6/2311892256/2742/5ed77924/5a9fa728Nbff29ad2.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"title",
":",
"\"手机配件\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"数据线\"",
",",
"imgUrl",
":",
"\"//img12.360buyimg.com/focus/s140x140_jfs/t18055/312/1342501458/9462/4699ed8a/5ac48672N11cf61fe.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"手机壳\"",
",",
"imgUrl",
":",
"\"//img30.360buyimg.com/focus/s140x140_jfs/t18502/160/1284774717/9251/feb8a496/5ac4878cN658cbb07.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"充电宝\"",
",",
"imgUrl",
":",
"\"//img30.360buyimg.com/focus/s140x140_jfs/t19537/23/1276961949/9676/f4b5be0d/5ac48791Nb224f939.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"手机贴膜\"",
",",
"imgUrl",
":",
"\"//img11.360buyimg.com/focus/s140x140_jfs/t17548/288/1331085893/6458/52545456/5ac486c6N0c8a93dc.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"耳机\"",
",",
"imgUrl",
":",
"\"//img10.360buyimg.com/focus/s140x140_jfs/t17284/353/1280266808/3696/32c00915/5ac486ccN2d8031c1.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"充电器\"",
",",
"imgUrl",
":",
"\"//img11.360buyimg.com/focus/s140x140_jfs/t16774/124/1318736793/3884/cb658723/5ac4874fN6bc007b0.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"title",
":",
"\"摄影摄像\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"单反相机\"",
",",
"imgUrl",
":",
"\"//img14.360buyimg.com/focus/s140x140_jfs/t13765/295/926307178/7966/3228af24/5a1679f2Nc2f659b6.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"数码相机\"",
",",
"imgUrl",
":",
"\"//img20.360buyimg.com/focus/s140x140_jfs/t12814/251/897168610/8107/60a873f/5a1679caNada7f827.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"镜头\"",
",",
"imgUrl",
":",
"\"//img30.360buyimg.com/focus/s140x140_jfs/t12154/164/880046972/2880/86b45b51/5a1679b9N42a5f8e5.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"户外器材\"",
",",
"imgUrl",
":",
"\"//img10.360buyimg.com/focus/s140x140_jfs/t12586/176/939117172/2550/d16b4b6c/5a1679c3N67e2b3f1.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"name",
":",
"\"电脑办公\"",
",",
"mainImgUrl",
":",
"\"//img30.360buyimg.com/mcoss/jfs/t14743/292/279117506/48503/9b7d9f2c/5a28ea97N36cb4d16.jpg\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"热门分类\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"轻薄本\"",
",",
"imgUrl",
":",
"\"//img13.360buyimg.com/focus/s140x140_jfs/t11071/195/2462134264/9117/cd0688bf/5a17ba79N18b9f3d4.png\"",
",",
"}",
",",
"{",
"title",
":",
"\"游戏本\"",
",",
"imgUrl",
":",
"\"//img30.360buyimg.com/focus/s140x140_jfs/t11155/36/2330310765/10690/eb6754c3/5a17ba96N49561fea.png\"",
",",
"}",
",",
"{",
"title",
":",
"\"机械键盘\"",
",",
"imgUrl",
":",
"\"//img12.360buyimg.com/focus/s140x140_jfs/t12304/245/965858782/6481/37cb5a9b/5a17ba5aN0406a1b5.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"组装电脑\"",
",",
"imgUrl",
":",
"\"//img10.360buyimg.com/focus/s140x140_jfs/t14101/325/978287093/8836/e142aa53/5a17ba73N07b12f0c.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"移动硬盘\"",
",",
"imgUrl",
":",
"\"//img12.360buyimg.com/focus/s140x140_jfs/t13228/333/989759736/4764/2a312c2e/5a17ba7fN0740c051.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"曲屏显示器\"",
",",
"imgUrl",
":",
"\"//img30.360buyimg.com/focus/s140x140_jfs/t13798/322/988648789/3644/1adc5615/5a17ba6dNafc95373.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"title",
":",
"\"外设产品\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"鼠标\"",
",",
"imgUrl",
":",
"\"//img20.360buyimg.com/focus/s140x140_jfs/t11881/31/2355374158/3676/22da94de/5a16a5f0Nc6b32dda.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"U盘\"",
",",
"imgUrl",
":",
"\"//img20.360buyimg.com/focus/s140x140_jfs/t12112/355/904591745/4308/6201dffe/5a16a5aaNdac2fe89.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"插座\"",
",",
"imgUrl",
":",
"\"//img14.360buyimg.com/focus/s140x140_jfs/t12031/206/932335399/3567/d6d59ad9/5a16a578N283a0f75.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"电脑工具\"",
",",
"imgUrl",
":",
"\"//img11.360buyimg.com/focus/s140x140_jfs/t12292/173/915309013/5554/78f4ab5e/5a16a560Nc7626d33.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"摄像头\"",
",",
"imgUrl",
":",
"\"//img20.360buyimg.com/focus/s140x140_jfs/t12499/54/910206832/5998/f91002f8/5a16a588Nff477d9d.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"手写板\"",
",",
"imgUrl",
":",
"\"//img13.360buyimg.com/focus/s140x140_jfs/t11734/189/2377033150/4145/b78bfcf/5a16a594Ncb41c95a.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"name",
":",
"\"家用电器\"",
",",
"mainImgUrl",
":",
"\"\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"家用电器\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"电饭煲\"",
",",
"imgUrl",
":",
"\"//img11.360buyimg.com/focus/s140x140_jfs/t14185/134/950962305/3800/eb1bafb8/5a17f224Nea1d3f59.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"豆浆机\"",
",",
"imgUrl",
":",
"\"//img11.360buyimg.com/focus/s140x140_jfs/t14065/132/988058896/1688/99cd0a3d/5a17f229Nc4c681fb.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"冰箱\"",
",",
"imgUrl",
":",
"\"//img12.360buyimg.com/focus/s140x140_jfs/t13153/44/964603695/1011/21d660d2/5a17f6aeN280056ea.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"双开门冰箱\"",
",",
"imgUrl",
":",
"\"//img20.360buyimg.com/focus/s140x140_jfs/t13588/266/943842715/1088/c4ae40e4/5a17f6c5Ne56d7e26.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"冷柜\"",
",",
"imgUrl",
":",
"\"//img12.360buyimg.com/focus/s140x140_jfs/t12928/273/1007467483/3549/52dad666/5a17f69eN1d10e257.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"洗衣机\"",
",",
"imgUrl",
":",
"\"//img12.360buyimg.com/focus/s140x140_jfs/t12481/129/1018625238/1840/43d49869/5a17f6eaN9ec936de.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"电热水器\"",
",",
"imgUrl",
":",
"\"//img13.360buyimg.com/focus/s140x140_jfs/t11053/246/2459202669/4318/fd6bd8d1/5a17f356Nd692ab74.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"电视\"",
",",
"imgUrl",
":",
"\"//img12.360buyimg.com/focus/s140x140_jfs/t11842/356/2416901099/2164/ab77fbaa/5a17f71eN25360979.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"4K超清电视\"",
",",
"imgUrl",
":",
"\"//img30.360buyimg.com/focus/s140x140_jfs/t11386/179/2470866031/2353/dfc7d933/5a17f72cN97075084.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"name",
":",
"\"美妆护肤\"",
",",
"mainImgUrl",
":",
"\"\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"美妆护肤\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"美白\"",
",",
"imgUrl",
":",
"\"//img30.360buyimg.com/focus/s140x140_jfs/t19531/110/2538137867/14848/c3ec84ac/5afd3cc5N8aa4b7c8.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"防晒\"",
",",
"imgUrl",
":",
"\"//img30.360buyimg.com/focus/s140x140_jfs/t17560/320/2504739891/10347/f04150c4/5afd3cbeN77d00886.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"控油\"",
",",
"imgUrl",
":",
"\"//img14.360buyimg.com/focus/s140x140_jfs/t19291/98/2577005836/12222/7107fb29/5afd3cc9N3add85ae.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"name",
":",
"\"男装男鞋\"",
",",
"mainImgUrl",
":",
"\"\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"男装男鞋\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"夹克\"",
",",
"imgUrl",
":",
"\"//img13.360buyimg.com/focus/s140x140_jfs/t12514/85/571462957/6214/29cdf637/5a0e9496Necd5bd0e.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"风衣\"",
",",
"imgUrl",
":",
"\"//img11.360buyimg.com/focus/s140x140_jfs/t11590/82/2013872051/5874/83b5772d/5a0e947eN67f0e537.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"西服\"",
",",
"imgUrl",
":",
"\"//img13.360buyimg.com/focus/s140x140_jfs/t13489/68/552491077/2495/7b517e4b/5a0e9483Na6231535.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"name",
":",
"\"女装女鞋\"",
",",
"mainImgUrl",
":",
"\"\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"家用电器\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"风衣\"",
",",
"imgUrl",
":",
"\"//img12.360buyimg.com/focus/s140x140_jfs/t15313/145/2476673176/2856/879136d7/5a9fc012N86f3fb22.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"长袖T恤\"",
",",
"imgUrl",
":",
"\"//img13.360buyimg.com/focus/s140x140_jfs/t16750/238/698160610/5156/5b1f25b/5a9fbfccN574cba12.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"卫衣\"",
",",
"imgUrl",
":",
"\"//img30.360buyimg.com/focus/s140x140_jfs/t11953/286/2195921828/5728/75b86d5b/5a127fbaN2780918c.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"name",
":",
"\"母婴童装\"",
",",
"mainImgUrl",
":",
"\"\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"母婴童装\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"套装\"",
",",
"imgUrl",
":",
"\"//img14.360buyimg.com/focus/s140x140_jfs/t18790/111/673564180/2396/3d27d79a/5a9f94c1N5b0c8724.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"name",
":",
"\"图书音像\"",
",",
"mainImgUrl",
":",
"\"\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"图书音像\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"文学\"",
",",
"imgUrl",
":",
"\"//img12.360buyimg.com/focus/s140x140_jfs/t19882/234/705045012/17917/e840651a/5b07dfddN7d635871.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"童书\"",
",",
"imgUrl",
":",
"\"//img30.360buyimg.com/focus/s140x140_jfs/t18520/109/1790543750/23751/a98be11f/5ad82a1cN400c11d1.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"name",
":",
"\"户外运动\"",
",",
"mainImgUrl",
":",
"\"\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"户外运动\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"跑步鞋\"",
",",
"imgUrl",
":",
"\"//img30.360buyimg.com/focus/s140x140_jfs/t13993/246/156269250/8757/12386c/5a1fb5e7N12a676b6.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"体育用品\"",
",",
"imgUrl",
":",
"\"//img13.360buyimg.com/focus/s140x140_jfs/t12313/239/1414060687/10293/ca8ad748/5a1fb5e1Nd80abbc2.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"name",
":",
"\"食品生鲜\"",
",",
"mainImgUrl",
":",
"\"\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"家用电器\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"休闲零食\"",
",",
"imgUrl",
":",
"\"//img10.360buyimg.com/focus/s140x140_jfs/t19789/191/2614150696/17735/d2db9aca/5b02411eNb44a03f7.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"牛奶\"",
",",
"imgUrl",
":",
"\"//img13.360buyimg.com/focus/s140x140_jfs/t17479/1/2588472716/22795/d676e57a/5b024117N06151eba.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"name",
":",
"\"酒水饮料\"",
",",
"mainImgUrl",
":",
"\"\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"酒水饮料\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"酒品馆\"",
",",
"imgUrl",
":",
"\"//img14.360buyimg.com/focus/s140x140_jfs/t19432/178/2607825443/22589/446a22a2/5b023705N12de0824.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"name",
":",
"\"家居家装\"",
",",
"mainImgUrl",
":",
"\"\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"家居家装\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"实木餐桌\"",
",",
"imgUrl",
":",
"\"//img13.360buyimg.com/focus/s140x140_jfs/t12772/3/1793374412/9705/e633967a/5a28e6c9N8aaaea3f.jpg\"",
",",
"}",
",",
"{",
"title",
":",
"\"椅子\"",
",",
"imgUrl",
":",
"\"//img10.360buyimg.com/focus/s140x140_jfs/t13888/280/1737354934/3036/f94ecdf8/5a28e0d6N80f30096.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"name",
":",
"\"箱包手袋\"",
",",
"mainImgUrl",
":",
"\"\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"箱包手袋\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"箱子\"",
",",
"imgUrl",
":",
"\"//img20.360buyimg.com/focus/s140x140_jfs/t12364/153/835832532/6803/5b58b137/5a152fb3Nb9f571ea.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"name",
":",
"\"钟表珠宝\"",
",",
"mainImgUrl",
":",
"\"\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"钟表珠宝\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"瑞士手表\"",
",",
"imgUrl",
":",
"\"//img10.360buyimg.com/focus/s140x140_jfs/t14155/271/890296038/3841/f1adee7f/5a166fe1Nc6bd2f12.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"{",
"name",
":",
"\"玩具乐器\"",
",",
"mainImgUrl",
":",
"\"\"",
",",
"list",
":",
"[",
"{",
"title",
":",
"\"家用电器\"",
",",
"productList",
":",
"[",
"{",
"title",
":",
"\"遥控车\"",
",",
"imgUrl",
":",
"\"//img12.360buyimg.com/focus/s140x140_jfs/t17575/123/2617650159/16720/74c14629/5b02a0c6N3f2770d9.jpg\"",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
",",
"}",
",",
"]",
";",
"export",
"const",
"hotData",
"=",
"[",
"{",
"title",
":",
"\"小米手机\"",
",",
"hot",
":",
"1",
",",
"}",
",",
"{",
"title",
":",
"\"笔记本\"",
",",
"hot",
":",
"1",
",",
"}",
",",
"{",
"title",
":",
"\"电脑\"",
",",
"hot",
":",
"0",
",",
"}",
",",
"{",
"title",
":",
"\"平板\"",
",",
"hot",
":",
"0",
",",
"}",
",",
"{",
"title",
":",
"\"液晶电视\"",
",",
"hot",
":",
"1",
",",
"}",
",",
"{",
"title",
":",
"\"家电\"",
",",
"hot",
":",
"0",
",",
"}",
",",
"{",
"title",
":",
"\"玩具\"",
",",
"hot",
":",
"0",
",",
"}",
",",
"]",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
178 | [
"export",
"const",
"APP_NAME",
"=",
"\"Excalidraw\"",
";",
"export",
"const",
"EXCALIDRAW_API",
"=",
"\"https://excalidraw.com/version.json\"",
";",
"export",
"const",
"EXCALIDRAW_ASAR_SOURCE",
"=",
"\"https://excalidraw.com/excalidraw.asar\"",
";",
"export",
"const",
"EXCALIDRAW_GITHUB_PACKAGE_JSON_URL",
"=",
"\"https://raw.githubusercontent.com/excalidraw/excalidraw-desktop/master/package.json\"",
";"
] | [
null,
null,
2,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
2,
null,
null,
null
] |
179 | [
"import",
"*",
"as",
"Store",
"from",
"\"electron-store\"",
";",
"let",
"metadataStore",
";",
"if",
"(",
"!",
"metadataStore",
")",
"{",
"metadataStore",
"=",
"new",
"Store",
"(",
"{",
"}",
")",
";",
"}",
"export",
"const",
"getMetadata",
"=",
"(",
"key",
")",
":",
"Store",
"=>",
"{",
"return",
"metadataStore",
".",
"get",
"(",
"`metadata.${",
"key",
"}`",
")",
";",
"}",
";",
"export",
"const",
"setMetadata",
"=",
"(",
"key",
",",
"value",
")",
"=>",
"{",
"return",
"metadataStore",
".",
"set",
"(",
"`metadata.${",
"key",
"}`",
",",
"value",
")",
";",
"}",
";",
"export",
"const",
"setAppName",
"=",
"(",
"value",
")",
"=>",
"{",
"return",
"metadataStore",
".",
"set",
"(",
"`metadata.appName`",
",",
"value",
")",
";",
"}",
";",
"export",
"const",
"getAppName",
"=",
"(",
")",
"=>",
"{",
"return",
"metadataStore",
".",
"get",
"(",
"`metadata.appName`",
")",
";",
"}",
";",
"export",
"const",
"getAppVersions",
"=",
"(",
")",
"=>",
"{",
"const",
"versions",
"=",
"metadataStore",
".",
"get",
"(",
"`metadata.versions`",
")",
";",
"const",
"{",
"local",
":",
"localVersion",
",",
"remote",
":",
"remoteVersion",
",",
"needsUpdate",
",",
"appVersion",
",",
"}",
"=",
"versions",
";",
"return",
"{",
"needsUpdate",
",",
"app",
":",
"{",
"local",
":",
"\"\"",
",",
"remote",
":",
"appVersion",
"}",
",",
"web",
":",
"{",
"local",
":",
"localVersion",
",",
"remote",
":",
"remoteVersion",
"}",
"}",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
46,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
10705,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
180 | [
"import",
"{",
"BrowserWindow",
",",
"Menu",
",",
"MenuItem",
"}",
"from",
"\"electron\"",
";",
"import",
"*",
"as",
"path",
"from",
"\"path\"",
";",
"import",
"*",
"as",
"url",
"from",
"\"url\"",
";",
"import",
"{",
"APP_NAME",
"}",
"from",
"\"./constants\"",
";",
"import",
"{",
"getAppVersions",
",",
"getAppName",
",",
"getMetadata",
"}",
"from",
"\"./util/metadata\"",
";",
"const",
"ABOUT_PAGE_PATH",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"\"pages\"",
",",
"\"about.html\"",
")",
";",
"const",
"openAboutWindow",
"=",
"(",
")",
"=>",
"{",
"let",
"aboutWindow",
"=",
"new",
"BrowserWindow",
"(",
"{",
"height",
":",
"320",
",",
"width",
":",
"320",
",",
"modal",
":",
"true",
",",
"backgroundColor",
":",
"\"white\"",
",",
"show",
":",
"false",
",",
"webPreferences",
":",
"{",
"contextIsolation",
":",
"true",
",",
"preload",
":",
"`${",
"__dirname",
"}/preload.js`",
"}",
"}",
")",
";",
"aboutWindow",
".",
"loadURL",
"(",
"url",
".",
"format",
"(",
"{",
"pathname",
":",
"ABOUT_PAGE_PATH",
",",
"protocol",
":",
"\"file\"",
",",
"slashes",
":",
"true",
"}",
")",
")",
";",
"aboutWindow",
".",
"setMenuBarVisibility",
"(",
"false",
")",
";",
"aboutWindow",
".",
"center",
"(",
")",
";",
"aboutWindow",
".",
"on",
"(",
"\"ready-to-show\"",
",",
"(",
")",
"=>",
"aboutWindow",
".",
"show",
"(",
")",
")",
";",
"aboutWindow",
".",
"on",
"(",
"\"show\"",
",",
"(",
")",
"=>",
"{",
"const",
"aboutContent",
"=",
"{",
"appName",
":",
"getAppName",
"(",
")",
",",
"iconPath",
":",
"getMetadata",
"(",
"\"appIconPath\"",
")",
",",
"versions",
":",
"getAppVersions",
"(",
")",
"}",
";",
"aboutWindow",
".",
"webContents",
".",
"send",
"(",
"\"show-about-contents\"",
",",
"aboutContent",
")",
";",
"}",
")",
";",
"}",
";",
"export",
"const",
"setupMenu",
"=",
"(",
"activeWindow",
",",
"options",
"=",
"{",
"}",
")",
"=>",
"{",
"const",
"isDarwin",
"=",
"process",
".",
"platform",
"===",
"\"darwin\"",
";",
"const",
"defaultMenuItems",
"=",
"Menu",
".",
"getApplicationMenu",
"(",
")",
".",
"items",
";",
"const",
"menuTemplate",
"=",
"[",
"]",
";",
"if",
"(",
"isDarwin",
")",
"{",
"defaultMenuItems",
".",
"shift",
"(",
")",
";",
"menuTemplate",
".",
"push",
"(",
"{",
"label",
":",
"APP_NAME",
",",
"submenu",
":",
"[",
"{",
"label",
":",
"`About ${",
"APP_NAME",
"}`",
",",
"enabled",
":",
"true",
",",
"click",
":",
"(",
")",
"=>",
"openAboutWindow",
"(",
")",
"}",
",",
"]",
"}",
")",
";",
"menuTemplate",
".",
"push",
"(",
"...",
"defaultMenuItems",
")",
";",
"}",
"else",
"{",
"defaultMenuItems",
".",
"pop",
"(",
")",
";",
"menuTemplate",
".",
"push",
"(",
"...",
"defaultMenuItems",
")",
";",
"menuTemplate",
".",
"push",
"(",
"{",
"label",
":",
"\"Help\"",
",",
"submenu",
":",
"[",
"{",
"label",
":",
"`About ${",
"APP_NAME",
"}`",
",",
"enabled",
":",
"true",
",",
"click",
":",
"(",
")",
"=>",
"openAboutWindow",
"(",
")",
"}",
",",
"]",
"}",
")",
";",
"}",
"const",
"appMenu",
"=",
"Menu",
".",
"buildFromTemplate",
"(",
"menuTemplate",
")",
";",
"Menu",
".",
"setApplicationMenu",
"(",
"appMenu",
")",
";",
"}",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
348,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
348,
null,
6,
null,
null,
null,
null,
null,
null,
null,
8,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
548,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
181 | [
"import",
"*",
"as",
"fs",
"from",
"\"fs\"",
";",
"import",
"*",
"as",
"path",
"from",
"\"path\"",
";",
"import",
"fetch",
"from",
"\"node-fetch\"",
";",
"import",
"{",
"EXCALIDRAW_API",
",",
"EXCALIDRAW_GITHUB_PACKAGE_JSON_URL",
"}",
"from",
"\"../constants\"",
";",
"const",
"LOCAL_VERSION_PATH",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"\"client\"",
",",
"\"version.json\"",
")",
";",
"interface",
"CheckResponse",
"{",
"local",
":",
"string",
";",
"remote",
":",
"string",
";",
"appVersion",
":",
"string",
";",
"needsUpdate",
":",
"boolean",
";",
"}",
"const",
"_getLocalVersion",
"=",
"(",
")",
":",
"string",
"=>",
"{",
"const",
"raw",
"=",
"fs",
".",
"readFileSync",
"(",
"LOCAL_VERSION_PATH",
")",
".",
"toString",
"(",
")",
";",
"const",
"contents",
"=",
"JSON",
".",
"parse",
"(",
"raw",
")",
";",
"return",
"contents",
".",
"version",
";",
"}",
";",
"const",
"_getRemoteVersion",
"=",
"async",
"(",
")",
":",
"Promise",
"<",
"string",
">",
"=>",
"{",
"const",
"raw",
"=",
"await",
"fetch",
"(",
"EXCALIDRAW_API",
")",
";",
"const",
"contents",
"=",
"await",
"raw",
".",
"json",
"(",
")",
";",
"return",
"contents",
".",
"version",
";",
"}",
";",
"const",
"_getRemoteDesktopAppVersion",
"=",
"async",
"(",
")",
":",
"Promise",
"<",
"string",
">",
"=>",
"{",
"const",
"raw",
"=",
"await",
"fetch",
"(",
"EXCALIDRAW_GITHUB_PACKAGE_JSON_URL",
")",
";",
"const",
"contents",
"=",
"await",
"raw",
".",
"json",
"(",
")",
";",
"return",
"contents",
".",
"version",
";",
"}",
";",
"export",
"default",
"async",
"function",
"checkVersion",
"(",
")",
"{",
"const",
"localVersion",
"=",
"_getLocalVersion",
"(",
")",
";",
"const",
"remoteVersion",
"=",
"await",
"_getRemoteVersion",
"(",
")",
";",
"const",
"appVersion",
"=",
"await",
"_getRemoteDesktopAppVersion",
"(",
")",
";",
"return",
"{",
"local",
":",
"localVersion",
",",
"remote",
":",
"remoteVersion",
",",
"appVersion",
",",
"needsUpdate",
":",
"localVersion",
"<",
"remoteVersion",
"}",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
16,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
16,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
182 | [
"import",
"{",
"app",
",",
"BrowserWindow",
",",
"shell",
",",
"globalShortcut",
"}",
"from",
"\"electron\"",
";",
"import",
"*",
"as",
"minimist",
"from",
"\"minimist\"",
";",
"import",
"*",
"as",
"path",
"from",
"\"path\"",
";",
"import",
"*",
"as",
"url",
"from",
"\"url\"",
";",
"import",
"{",
"setupMenu",
"}",
"from",
"\"./menu\"",
";",
"import",
"checkVersion",
"from",
"\"./util/checkVersion\"",
";",
"import",
"{",
"setMetadata",
",",
"setAppName",
"}",
"from",
"\"./util/metadata\"",
";",
"import",
"{",
"APP_NAME",
"}",
"from",
"\"./constants\"",
";",
"let",
"mainWindow",
";",
"const",
"argv",
"=",
"minimist",
"(",
"process",
".",
"argv",
".",
"slice",
"(",
"1",
")",
")",
";",
"const",
"EXCALIDRAW_BUNDLE",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"\"client\"",
",",
"\"index.html\"",
")",
";",
"const",
"APP_ICON_PATH",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"\"client\"",
",",
"\"logo-180x180.png\"",
")",
";",
"function",
"createWindow",
"(",
")",
"{",
"mainWindow",
"=",
"new",
"BrowserWindow",
"(",
"{",
"show",
":",
"false",
",",
"height",
":",
"600",
",",
"width",
":",
"800",
",",
"webPreferences",
":",
"{",
"contextIsolation",
":",
"true",
",",
"preload",
":",
"`${",
"__dirname",
"}/preload.js`",
"}",
"}",
")",
";",
"if",
"(",
"argv",
".",
"devtools",
")",
"{",
"mainWindow",
".",
"webContents",
".",
"openDevTools",
"(",
"{",
"mode",
":",
"\"detach\"",
"}",
")",
";",
"}",
"mainWindow",
".",
"webContents",
".",
"on",
"(",
"\"will-navigate\"",
",",
"openExternalURLs",
")",
";",
"mainWindow",
".",
"webContents",
".",
"on",
"(",
"\"new-window\"",
",",
"openExternalURLs",
")",
";",
"mainWindow",
".",
"loadURL",
"(",
"url",
".",
"format",
"(",
"{",
"pathname",
":",
"EXCALIDRAW_BUNDLE",
",",
"protocol",
":",
"\"file\"",
",",
"slashes",
":",
"true",
"}",
")",
")",
";",
"mainWindow",
".",
"on",
"(",
"\"closed\"",
",",
"(",
")",
"=>",
"{",
"mainWindow",
"=",
"null",
";",
"}",
")",
";",
"if",
"(",
"process",
".",
"platform",
"===",
"\"darwin\"",
")",
"{",
"globalShortcut",
".",
"register",
"(",
"\"Command+Q\"",
",",
"(",
")",
"=>",
"{",
"app",
".",
"quit",
"(",
")",
";",
"}",
")",
";",
"}",
"mainWindow",
".",
"once",
"(",
"\"ready-to-show\"",
",",
"async",
"(",
")",
"=>",
"{",
"const",
"versions",
"=",
"await",
"checkVersion",
"(",
")",
";",
"console",
".",
"info",
"(",
"\"Current version\"",
",",
"versions",
".",
"local",
")",
";",
"console",
".",
"info",
"(",
"\"Needs update\"",
",",
"versions",
".",
"needsUpdate",
")",
";",
"setAppName",
"(",
"APP_NAME",
")",
";",
"setMetadata",
"(",
"\"versions\"",
",",
"versions",
")",
";",
"setMetadata",
"(",
"\"appIconPath\"",
",",
"APP_ICON_PATH",
")",
";",
"setupMenu",
"(",
"mainWindow",
")",
";",
"mainWindow",
".",
"show",
"(",
")",
";",
"}",
")",
";",
"}",
"function",
"openExternalURLs",
"(",
"event",
",",
"url",
")",
"{",
"if",
"(",
"url",
".",
"startsWith",
"(",
"\"http\"",
")",
")",
"{",
"event",
".",
"preventDefault",
"(",
")",
";",
"shell",
".",
"openExternal",
"(",
"url",
")",
";",
"}",
"}",
"app",
".",
"on",
"(",
"\"ready\"",
",",
"createWindow",
")",
";",
"app",
".",
"on",
"(",
"\"window-all-closed\"",
",",
"(",
")",
"=>",
"{",
"if",
"(",
"process",
".",
"platform",
"!==",
"\"darwin\"",
")",
"{",
"app",
".",
"quit",
"(",
")",
";",
"}",
"}",
")",
";",
"app",
".",
"on",
"(",
"\"activate\"",
",",
"(",
")",
"=>",
"{",
"if",
"(",
"mainWindow",
"===",
"null",
")",
"{",
"createWindow",
"(",
")",
";",
"}",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
3081,
null,
null,
3991,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
4309,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
183 | [
"import",
"{",
"ipcRenderer",
",",
"contextBridge",
",",
"remote",
"}",
"from",
"\"electron\"",
";",
"import",
"{",
"IpcListener",
"}",
"from",
"\"./types\"",
";",
"contextBridge",
".",
"exposeInMainWorld",
"(",
"\"ipcRenderer\"",
",",
"{",
"send",
":",
"(",
"channel",
",",
"data",
")",
"=>",
"{",
"ipcRenderer",
".",
"send",
"(",
"channel",
",",
"data",
")",
";",
"}",
",",
"receive",
":",
"(",
"channel",
",",
"func",
")",
"=>",
"{",
"ipcRenderer",
".",
"on",
"(",
"channel",
",",
"(",
"event",
",",
"...",
"args",
")",
"=>",
"func",
"(",
"event",
",",
"...",
"args",
")",
")",
";",
"}",
"}",
")",
";",
"contextBridge",
".",
"exposeInMainWorld",
"(",
"\"remote\"",
",",
"{",
"getVersion",
":",
"remote",
".",
"app",
".",
"getVersion",
"}",
")",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
1301,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
184 | [
"const",
"rendererWindow",
"=",
"window",
";",
"rendererWindow",
".",
"ipcRenderer",
".",
"receive",
"(",
"\"show-about-contents\"",
",",
"(",
"_",
",",
"options",
")",
"=>",
"{",
"const",
"{",
"appName",
",",
"versions",
",",
"iconPath",
"}",
"=",
"options",
";",
"document",
".",
"title",
"=",
"`About ${",
"appName",
"}`",
";",
"const",
"$titleElement",
"=",
"document",
".",
"querySelector",
"(",
"\".title\"",
")",
"as",
"HTMLHeadingElement",
";",
"$titleElement",
".",
"textContent",
"=",
"appName",
";",
"const",
"$iconElement",
"=",
"document",
".",
"getElementById",
"(",
"\"app-icon\"",
")",
"as",
"HTMLImageElement",
";",
"$iconElement",
".",
"src",
"=",
"iconPath",
";",
"const",
"$appVersionElement",
"=",
"document",
".",
"getElementById",
"(",
"\"app-version\"",
")",
"as",
"HTMLParagraphElement",
";",
"$appVersionElement",
".",
"textContent",
"=",
"`Version ${",
"versions",
".",
"app",
".",
"remote",
"}`",
";",
"const",
"$webVersionElement",
"=",
"document",
".",
"getElementById",
"(",
"\"web-version\"",
")",
"as",
"HTMLParagraphElement",
";",
"$webVersionElement",
".",
"textContent",
"=",
"`${",
"appName",
"} for Web Version ${",
"versions",
".",
"web",
".",
"remote",
"}`",
";",
"const",
"$copyRightElement",
"=",
"document",
".",
"querySelector",
"(",
"\".copyright\"",
")",
"as",
"HTMLParagraphElement",
";",
"$copyRightElement",
".",
"textContent",
"=",
"`Copyright (c) ${",
"new",
"Date",
"(",
")",
".",
"getFullYear",
"(",
")",
"} ${",
"appName",
"}`",
";",
"}",
")",
";"
] | [
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
1301,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
1732,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
227,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
1637,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
1637,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
1637,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
185 | [
"import",
"*",
"as",
"os",
"from",
"'os'",
";",
"import",
"{",
"join",
"}",
"from",
"'path'",
";",
"export",
"const",
"NODE_ENV",
"=",
"process",
".",
"env",
".",
"NODE_ENV",
"||",
"'dev'",
";",
"export",
"const",
"PORT",
"=",
"process",
".",
"env",
".",
"PORT",
"||",
"3000",
";",
"export",
"const",
"CHANNEL",
"=",
"process",
".",
"env",
".",
"CHANNEL",
"||",
"'ch1'",
";",
"export",
"const",
"CHAINCODE",
"=",
"process",
".",
"env",
".",
"CHAINCODE",
"||",
"'financial'",
";",
"export",
"const",
"COUCHDB_PROTOCOL",
"=",
"process",
".",
"env",
".",
"COUCHDB_PROTOCOL",
"||",
"'http'",
";",
"export",
"const",
"COUCHDB_HOST",
"=",
"process",
".",
"env",
".",
"COUCHDB_HOST",
"||",
"'localhost'",
";",
"export",
"const",
"COUCHDB_PORT",
"=",
"process",
".",
"env",
".",
"COUCHDB_PORT",
"||",
"'5084'",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
186 | [
"import",
"identitiesDev",
"from",
"'../config/identities.json'",
";",
"import",
"identitiesProd",
"from",
"'../config/identities.prod.json'",
";",
"import",
"{",
"NODE_ENV",
"}",
"from",
"'../utils/env'",
";",
"import",
"{",
"join",
",",
"resolve",
"}",
"from",
"'path'",
";",
"import",
"*",
"as",
"os",
"from",
"'os'",
";",
"const",
"homedir",
"=",
"os",
".",
"homedir",
"(",
")",
";",
"export",
"function",
"identity",
"(",
"user",
"?",
")",
"{",
"const",
"identities",
"=",
"NODE_ENV",
"===",
"'dev'",
"?",
"identitiesDev",
":",
"identitiesProd",
";",
"if",
"(",
"!",
"identities",
")",
"{",
"throw",
"new",
"Error",
"(",
"'No identities config .json found in path ./config'",
")",
";",
"}",
"let",
"res",
";",
"console",
".",
"log",
"(",
"`getting identity for ${",
"user",
"} in identities config json`",
")",
";",
"if",
"(",
"!",
"user",
")",
"{",
"res",
"=",
"identities",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"res",
"=",
"<",
"ServerIdentity",
">",
"identities",
".",
"find",
"(",
"identity",
"=>",
"identity",
".",
"uniqueId",
"===",
"user",
")",
";",
"}",
"res",
".",
"networkProfile",
"=",
"res",
".",
"networkProfile",
"?",
"resolve",
"(",
"__dirname",
",",
"res",
".",
"networkProfile",
")",
":",
"join",
"(",
"homedir",
",",
"`hyperledger-fabric-network/network-profiles/${",
"res",
".",
"org",
"}.network-profile.yaml`",
")",
";",
"res",
".",
"keyStore",
"=",
"res",
".",
"keyStore",
"?",
"resolve",
"(",
"__dirname",
",",
"res",
".",
"keyStore",
")",
":",
"join",
"(",
"homedir",
",",
"`hyperledger-fabric-network/.hfc-${",
"res",
".",
"org",
"}`",
")",
";",
"return",
"res",
";",
"}",
"export",
"class",
"ServerIdentity",
"{",
"uniqueId",
":",
"string",
";",
"user",
":",
"string",
";",
"org",
":",
"string",
";",
"networkProfile",
"?",
":",
"string",
";",
"keyStore",
"?",
":",
"string",
";",
"couch",
"?",
":",
"{",
"host",
":",
"string",
";",
"protocol",
":",
"string",
";",
"port",
":",
"string",
";",
"}",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
37596,
null,
2,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
37596,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
37596,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
187 | [
"import",
"{",
"BaseStorage",
"}",
"from",
"'@worldsibu/convector-core'",
";",
"import",
"{",
"CouchDBStorage",
"}",
"from",
"'@worldsibu/convector-storage-couchdb'",
";",
"import",
"{",
"Env",
"}",
"from",
"'./env'",
";",
"import",
"{",
"CHAINCODE",
",",
"COUCHDB_HOST",
",",
"COUCHDB_PROTOCOL",
",",
"COUCHDB_PORT",
",",
"CHANNEL",
",",
"identity",
"}",
"from",
"'../utils'",
";",
"/**\n * Route to the CouchDB\n */",
"BaseStorage",
".",
"current",
"=",
"new",
"CouchDBStorage",
"(",
"{",
"host",
":",
"COUCHDB_HOST",
",",
"protocol",
":",
"COUCHDB_PROTOCOL",
",",
"port",
":",
"COUCHDB_PORT",
"}",
",",
"`${",
"CHANNEL",
"}_${",
"CHAINCODE",
"}`",
")",
";",
"export",
"async",
"function",
"couchQueryAll",
"(",
"view",
",",
"type",
",",
"queryOptions",
"?",
",",
"col",
"?",
",",
"userId",
"?",
")",
"{",
"const",
"channel",
"=",
"CHANNEL",
";",
"const",
"cc",
"=",
"CHAINCODE",
";",
"const",
"dbName",
"=",
"`${",
"channel",
"}_${",
"cc",
"}${",
"col",
"?",
"`$$p${",
"col",
"}`",
":",
"''",
"}`",
";",
"const",
"viewUrl",
"=",
"`_design/${",
"cc",
"}/_view/${",
"view",
"}`",
";",
"const",
"identityToQuery",
"=",
"identity",
"(",
"userId",
")",
";",
"console",
".",
"log",
"(",
"`calling couch to ${",
"identityToQuery",
".",
"couch",
".",
"port",
"} in db ${",
"dbName",
"}`",
")",
";",
"BaseStorage",
".",
"current",
"=",
"new",
"CouchDBStorage",
"(",
"{",
"host",
":",
"identityToQuery",
".",
"couch",
".",
"host",
",",
"protocol",
":",
"identityToQuery",
".",
"couch",
".",
"protocol",
",",
"port",
":",
"identityToQuery",
".",
"couch",
".",
"port",
",",
"}",
")",
";",
"try",
"{",
"const",
"results",
"=",
"<",
"any",
"[",
"]",
">",
"(",
"await",
"type",
".",
"query",
"(",
"type",
",",
"dbName",
",",
"viewUrl",
",",
"queryOptions",
")",
")",
";",
"return",
"results",
".",
"map",
"(",
"result",
"=>",
"result",
".",
"toJSON",
"(",
")",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"console",
".",
"log",
"(",
"err",
")",
";",
"if",
"(",
"err",
".",
"code",
"===",
"'EDOCMISSING'",
")",
"{",
"return",
"[",
"]",
";",
"}",
"else",
"{",
"throw",
"err",
";",
"}",
"}",
"}",
"export",
"{",
"Patient",
",",
"CreateClaim",
",",
"AdjudicateClaim",
",",
"Organization",
",",
"FeeExtensionsConfig",
"}",
"from",
"'financial-cc'",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
2,
null,
null,
null,
6,
null,
null,
2,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
37596,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
188 | [
"/** Referenced from: https://github.com/ksachdeva/hyperledger-fabric-example/blob/c41fcaa352e78cbf3c7cfb210338ac0f20b8357e/src/client.ts */",
"import",
"*",
"as",
"fs",
"from",
"'fs'",
";",
"import",
"{",
"join",
"}",
"from",
"'path'",
";",
"import",
"Client",
"from",
"'fabric-client'",
";",
"import",
"{",
"IEnrollmentRequest",
",",
"IRegisterRequest",
"}",
"from",
"'fabric-ca-client'",
";",
"import",
"{",
"identity",
"}",
"from",
"'../utils/identity'",
";",
"export",
"type",
"UserParams",
"=",
"IRegisterRequest",
";",
"export",
"type",
"AdminParams",
"=",
"IEnrollmentRequest",
";",
"const",
"l",
"=",
"console",
".",
"log",
";",
"export",
"namespace",
"SelfGenContext",
"{",
"interface",
"IdentityFiles",
"{",
"privateKey",
":",
"string",
";",
"signedCert",
":",
"string",
";",
"}",
"export",
"async",
"function",
"getClient",
"(",
")",
"{",
"const",
"keyStore",
"=",
"identity",
"(",
")",
".",
"keyStore",
";",
"const",
"user",
"=",
"identity",
"(",
")",
".",
"user",
";",
"const",
"org",
"=",
"identity",
"(",
")",
".",
"org",
";",
"const",
"contextPath",
"=",
"join",
"(",
"keyStore",
"+",
"'/'",
"+",
"user",
")",
";",
"fs",
".",
"readFile",
"(",
"contextPath",
",",
"'utf8'",
",",
"async",
"function",
"(",
"err",
",",
"data",
")",
"{",
"if",
"(",
"err",
")",
"{",
"const",
"client",
"=",
"new",
"Client",
"(",
")",
";",
"l",
"(",
"'Setting up the cryptoSuite ..'",
")",
";",
"const",
"cryptoSuite",
"=",
"Client",
".",
"newCryptoSuite",
"(",
")",
";",
"cryptoSuite",
".",
"setCryptoKeyStore",
"(",
"Client",
".",
"newCryptoKeyStore",
"(",
"{",
"path",
":",
"keyStore",
"}",
")",
")",
";",
"client",
".",
"setCryptoSuite",
"(",
"cryptoSuite",
")",
";",
"l",
"(",
"'Setting up the keyvalue store ..'",
")",
";",
"const",
"store",
"=",
"await",
"Client",
".",
"newDefaultKeyValueStore",
"(",
"{",
"path",
":",
"keyStore",
"}",
")",
";",
"client",
".",
"setStateStore",
"(",
"store",
")",
";",
"l",
"(",
"'Creating the admin user context ..'",
")",
";",
"const",
"privateKeyFile",
"=",
"fs",
".",
"readdirSync",
"(",
"keyStore",
"+",
"'/keystore'",
")",
"[",
"0",
"]",
";",
"const",
"cryptoContentOrgAdmin",
"=",
"{",
"privateKey",
":",
"keyStore",
"+",
"'/keystore/'",
"+",
"privateKeyFile",
",",
"signedCert",
":",
"keyStore",
"+",
"'/signcerts/cert.pem'",
"}",
";",
"await",
"client",
".",
"createUser",
"(",
"{",
"username",
":",
"user",
",",
"mspid",
":",
"`${",
"org",
"}MSP`",
",",
"cryptoContent",
":",
"cryptoContentOrgAdmin",
",",
"skipPersistence",
":",
"false",
"}",
")",
";",
"return",
"client",
";",
"}",
"else",
"{",
"l",
"(",
"`Context exists in ${",
"contextPath",
"}`",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
4,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
243,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
82,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
189 | [
"/**\n * This file is in charge of building a controller (or set of controllers made up)\n * of the baseline logic you designed on your chaincode project, but replacing the logic\n * with your own for NodeJS. We inject here the `convector-adapter-fabric` which calls\n * the blockchain based on your own configuration.\n */",
"import",
"{",
"FabricControllerAdapter",
"}",
"from",
"'@worldsibu/convector-adapter-fabric'",
";",
"import",
"{",
"ClientFactory",
"}",
"from",
"'@worldsibu/convector-core'",
";",
"import",
"{",
"SelfGenContext",
"}",
"from",
"'./selfGenContext'",
";",
"import",
"{",
"CHANNEL",
",",
"CHAINCODE",
"}",
"from",
"'../utils'",
";",
"import",
"{",
"PatientController",
",",
"OrganizationController",
",",
"ClaimController",
",",
"ParticipantController",
",",
"FeeExtensionsController",
"}",
"from",
"'financial-cc'",
";",
"import",
"{",
"PaymentController",
"}",
"from",
"'financial-cc'",
";",
"import",
"{",
"identity",
"}",
"from",
"'../utils/identity'",
";",
"async",
"function",
"InitFabricAdapter",
"(",
"user",
"?",
")",
"{",
"await",
"SelfGenContext",
".",
"getClient",
"(",
")",
";",
"const",
"adapter",
"=",
"new",
"FabricControllerAdapter",
"(",
"{",
"txTimeout",
":",
"300000",
",",
"user",
":",
"identity",
"(",
"user",
")",
".",
"user",
",",
"channel",
":",
"CHANNEL",
",",
"chaincode",
":",
"CHAINCODE",
",",
"keyStore",
":",
"identity",
"(",
"user",
")",
".",
"keyStore",
",",
"networkProfile",
":",
"identity",
"(",
"user",
")",
".",
"networkProfile",
",",
"userMspPath",
":",
"identity",
"(",
"user",
")",
".",
"keyStore",
"}",
")",
";",
"await",
"adapter",
".",
"init",
"(",
")",
";",
"return",
"adapter",
";",
"}",
"/**\n * Building this adapter allows you to communicate with the\n * test env created by `hurley`.\n */",
"export",
"async",
"function",
"Init",
"(",
"user",
"?",
")",
"{",
"const",
"adapter",
"=",
"await",
"InitFabricAdapter",
"(",
"user",
")",
";",
"return",
"{",
"adapter",
",",
"patient",
":",
"ClientFactory",
"(",
"PatientController",
",",
"adapter",
")",
",",
"payment",
":",
"ClientFactory",
"(",
"PaymentController",
",",
"adapter",
")",
",",
"claim",
":",
"ClientFactory",
"(",
"ClaimController",
",",
"adapter",
")",
",",
"organization",
":",
"ClientFactory",
"(",
"OrganizationController",
",",
"adapter",
")",
",",
"participant",
":",
"ClientFactory",
"(",
"ParticipantController",
",",
"adapter",
")",
",",
"feeExtensions",
":",
"ClientFactory",
"(",
"FeeExtensionsController",
",",
"adapter",
")",
"}",
";",
"}",
"export",
"async",
"function",
"InitServerIdentity",
"(",
")",
"{",
"console",
".",
"log",
"(",
"'Need to register server identity'",
")",
";",
"console",
".",
"log",
"(",
"'Server identity registered'",
")",
";",
"console",
".",
"log",
"(",
"'Server identity found'",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
2,
null,
null,
null,
null,
0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
190 | [
"import",
"{",
"PrivateCollectionsRoutes",
"}",
"from",
"'financial-cc'",
";",
"import",
"organizations",
"from",
"'../config/organizations.json'",
";",
"export",
"async",
"function",
"collections",
"(",
")",
"{",
"const",
"collections",
"=",
"new",
"PrivateCollectionsRoutes",
"(",
"organizations",
"[",
"1",
"]",
",",
"organizations",
"[",
"2",
"]",
",",
"organizations",
"[",
"0",
"]",
")",
";",
"await",
"collections",
".",
"load",
"(",
")",
";",
"return",
"collections",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
191 | [
"import",
"{",
"Init",
",",
"CreateClaim",
",",
"AdjudicateClaim",
",",
"couchQueryAll",
"}",
"from",
"'../convectorUtils'",
";",
"import",
"{",
"Claim",
",",
"InvoiceLineItem",
",",
"TransientInvoiceLineItem",
"}",
"from",
"'financial-cc'",
";",
"import",
"{",
"collections",
"}",
"from",
"'../utils/collections'",
";",
"export",
"async",
"function",
"create",
"(",
"newClaim",
")",
"{",
"const",
"ctrls",
"=",
"await",
"Init",
"(",
")",
";",
"await",
"ctrls",
".",
"claim",
".",
"$config",
"(",
"{",
"transient",
":",
"{",
"data",
":",
"new",
"CreateClaim",
"(",
"newClaim",
")",
".",
"toJSON",
"(",
")",
"}",
"}",
")",
".",
"create",
"(",
")",
";",
"}",
"export",
"async",
"function",
"adjudicate",
"(",
"toAdjudicateClaim",
")",
"{",
"const",
"ctrls",
"=",
"await",
"Init",
"(",
")",
";",
"let",
"lines",
"=",
"await",
"ctrls",
".",
"claim",
".",
"$query",
"(",
")",
".",
"getInvoiceLineItems",
"(",
"toAdjudicateClaim",
".",
"claimUid",
")",
";",
"lines",
"=",
"lines",
".",
"map",
"(",
"item",
"=>",
"new",
"InvoiceLineItem",
"(",
"item",
")",
".",
"toJSON",
"(",
")",
"as",
"any",
")",
";",
"const",
"invoiceLines",
"=",
"new",
"TransientInvoiceLineItem",
"(",
")",
";",
"invoiceLines",
".",
"items",
"=",
"lines",
";",
"let",
"claim",
"=",
"await",
"ctrls",
".",
"claim",
".",
"$query",
"(",
")",
".",
"getOne",
"(",
"toAdjudicateClaim",
".",
"claimUid",
")",
";",
"await",
"ctrls",
".",
"claim",
".",
"$config",
"(",
"{",
"transient",
":",
"{",
"data",
":",
"new",
"AdjudicateClaim",
"(",
"toAdjudicateClaim",
")",
".",
"toJSON",
"(",
")",
",",
"invoices",
":",
"invoiceLines",
".",
"toJSON",
"(",
")",
",",
"claim",
":",
"new",
"Claim",
"(",
"claim",
")",
".",
"toJSON",
"(",
")",
",",
"}",
"}",
")",
".",
"adjudicate",
"(",
")",
";",
"}",
"export",
"async",
"function",
"getAll",
"(",
"user",
"?",
")",
"{",
"let",
"resCols",
"=",
"await",
"collections",
"(",
")",
";",
"console",
".",
"log",
"(",
"!",
"!",
"user",
")",
";",
"return",
"await",
"couchQueryAll",
"(",
"'claims_all'",
",",
"Claim",
",",
"null",
",",
"resCols",
".",
"claim",
",",
"user",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
0,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
0,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
2,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
192 | [
"import",
"{",
"Router",
",",
"Request",
",",
"Response",
"}",
"from",
"'express'",
";",
"import",
"{",
"create",
",",
"adjudicate",
",",
"getAll",
"}",
"from",
"'../services/claim.service'",
";",
"const",
"router",
"=",
"Router",
"(",
")",
";",
"router",
".",
"get",
"(",
"'/'",
",",
"async",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"try",
"{",
"const",
"{",
"user",
"}",
"=",
"req",
".",
"query",
";",
"let",
"results",
"=",
"await",
"getAll",
"(",
"user",
")",
";",
"res",
".",
"send",
"(",
"results",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"console",
".",
"log",
"(",
"ex",
")",
";",
"res",
".",
"status",
"(",
"500",
")",
".",
"send",
"(",
"ex",
")",
";",
"}",
"}",
")",
";",
"router",
".",
"post",
"(",
"'/'",
",",
"async",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"try",
"{",
"const",
"newClaim",
"=",
"req",
".",
"body",
";",
"await",
"create",
"(",
"newClaim",
")",
";",
"res",
".",
"send",
"(",
"201",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"console",
".",
"log",
"(",
"ex",
")",
";",
"res",
".",
"status",
"(",
"500",
")",
".",
"send",
"(",
"ex",
")",
";",
"}",
"}",
")",
";",
"router",
".",
"post",
"(",
"'/adjudicate'",
",",
"async",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"try",
"{",
"const",
"patient",
"=",
"req",
".",
"body",
";",
"await",
"adjudicate",
"(",
"patient",
")",
";",
"res",
".",
"send",
"(",
"200",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"console",
".",
"log",
"(",
"ex",
")",
";",
"res",
".",
"status",
"(",
"500",
")",
".",
"send",
"(",
"ex",
")",
";",
"}",
"}",
")",
";",
"export",
"const",
"ClaimCtrl",
"=",
"router",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
55,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
40,
null,
16,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
40,
null,
16,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
40,
null,
16,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
55,
null,
null,
null
] |
193 | [
"import",
"{",
"Init",
",",
"Organization",
",",
"couchQueryAll",
"}",
"from",
"'../convectorUtils'",
";",
"export",
"async",
"function",
"create",
"(",
"newOrganization",
",",
"fingerprint",
")",
"{",
"const",
"ctrls",
"=",
"await",
"Init",
"(",
")",
";",
"await",
"ctrls",
".",
"organization",
".",
"create",
"(",
"newOrganization",
",",
"fingerprint",
")",
";",
"}",
"export",
"async",
"function",
"getAll",
"(",
")",
"{",
"return",
"await",
"couchQueryAll",
"(",
"'organizations_all'",
",",
"Organization",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
969,
null,
2,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
194 | [
"import",
"{",
"Router",
",",
"Request",
",",
"Response",
"}",
"from",
"'express'",
";",
"import",
"{",
"create",
",",
"getAll",
"}",
"from",
"'../services/organization.service'",
";",
"const",
"router",
"=",
"Router",
"(",
")",
";",
"router",
".",
"get",
"(",
"'/'",
",",
"async",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"try",
"{",
"let",
"results",
"=",
"await",
"getAll",
"(",
")",
";",
"res",
".",
"send",
"(",
"results",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"console",
".",
"log",
"(",
"ex",
")",
";",
"res",
".",
"status",
"(",
"500",
")",
".",
"send",
"(",
"ex",
")",
";",
"}",
"}",
")",
";",
"router",
".",
"post",
"(",
"'/'",
",",
"async",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"try",
"{",
"const",
"{",
"organization",
",",
"fingerprint",
"}",
"=",
"req",
".",
"body",
";",
"await",
"create",
"(",
"organization",
",",
"fingerprint",
")",
";",
"res",
".",
"status",
"(",
"201",
")",
".",
"send",
"(",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"console",
".",
"log",
"(",
"ex",
")",
";",
"res",
".",
"status",
"(",
"500",
")",
".",
"send",
"(",
"ex",
")",
";",
"}",
"}",
")",
";",
"export",
"const",
"OrganizationCtrl",
"=",
"router",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
55,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
40,
null,
16,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
40,
null,
16,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
55,
null,
null,
null
] |
195 | [
"import",
"{",
"Init",
",",
"couchQueryAll",
"}",
"from",
"'../convectorUtils'",
";",
"import",
"{",
"ConsumerParticipant",
",",
"PayerParticipant",
",",
"ProviderParticipant",
",",
"ConsortiumAdminParticipant",
"}",
"from",
"'financial-cc'",
";",
"export",
"async",
"function",
"createConsumer",
"(",
"participant",
",",
"fingerprint",
")",
"{",
"const",
"ctrls",
"=",
"await",
"Init",
"(",
")",
";",
"await",
"ctrls",
".",
"participant",
".",
"createConsumer",
"(",
"participant",
",",
"fingerprint",
")",
";",
"}",
"export",
"async",
"function",
"createProvider",
"(",
"participant",
")",
"{",
"const",
"ctrls",
"=",
"await",
"Init",
"(",
")",
";",
"await",
"ctrls",
".",
"participant",
".",
"createProvider",
"(",
"participant",
")",
";",
"}",
"export",
"async",
"function",
"createPayer",
"(",
"participant",
")",
"{",
"const",
"ctrls",
"=",
"await",
"Init",
"(",
")",
";",
"await",
"ctrls",
".",
"participant",
".",
"createPayer",
"(",
"participant",
")",
";",
"}",
"export",
"async",
"function",
"createConsortiumAdmin",
"(",
"participant",
")",
"{",
"const",
"ctrls",
"=",
"await",
"Init",
"(",
")",
";",
"await",
"ctrls",
".",
"participant",
".",
"createConsortiumAdmin",
"(",
"participant",
")",
";",
"}",
"export",
"async",
"function",
"getAllConsumer",
"(",
")",
"{",
"return",
"await",
"couchQueryAll",
"(",
"'participantConsumers_all'",
",",
"ConsumerParticipant",
")",
";",
"}",
"export",
"async",
"function",
"getAllProvider",
"(",
")",
"{",
"return",
"await",
"couchQueryAll",
"(",
"'participantProviders_all'",
",",
"ProviderParticipant",
")",
";",
"}",
"export",
"async",
"function",
"getAllPayer",
"(",
")",
"{",
"return",
"await",
"couchQueryAll",
"(",
"'participantPayers_all'",
",",
"PayerParticipant",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
37597,
null,
2,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
0,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
0,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
0,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
196 | [
"import",
"{",
"Router",
",",
"Request",
",",
"Response",
"}",
"from",
"'express'",
";",
"import",
"{",
"createConsumer",
",",
"createProvider",
",",
"createPayer",
",",
"createConsortiumAdmin",
",",
"getAllConsumer",
",",
"getAllProvider",
",",
"getAllPayer",
"}",
"from",
"'../services/participant.service'",
";",
"const",
"router",
"=",
"Router",
"(",
")",
";",
"router",
".",
"get",
"(",
"'/consumer'",
",",
"async",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"try",
"{",
"let",
"results",
"=",
"await",
"getAllConsumer",
"(",
")",
";",
"res",
".",
"send",
"(",
"results",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"console",
".",
"log",
"(",
"ex",
")",
";",
"res",
".",
"status",
"(",
"500",
")",
".",
"send",
"(",
"ex",
")",
";",
"}",
"}",
")",
";",
"router",
".",
"get",
"(",
"'/provider'",
",",
"async",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"try",
"{",
"let",
"results",
"=",
"await",
"getAllProvider",
"(",
")",
";",
"res",
".",
"send",
"(",
"results",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"console",
".",
"log",
"(",
"ex",
")",
";",
"res",
".",
"status",
"(",
"500",
")",
".",
"send",
"(",
"ex",
")",
";",
"}",
"}",
")",
";",
"router",
".",
"get",
"(",
"'/payer'",
",",
"async",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"try",
"{",
"let",
"results",
"=",
"await",
"getAllPayer",
"(",
")",
";",
"res",
".",
"send",
"(",
"results",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"console",
".",
"log",
"(",
"ex",
")",
";",
"res",
".",
"status",
"(",
"500",
")",
".",
"send",
"(",
"ex",
")",
";",
"}",
"}",
")",
";",
"router",
".",
"post",
"(",
"'/consumer'",
",",
"async",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"try",
"{",
"const",
"{",
"participant",
",",
"fingerprint",
"}",
"=",
"req",
".",
"body",
";",
"await",
"createConsumer",
"(",
"participant",
",",
"fingerprint",
")",
";",
"res",
".",
"status",
"(",
"201",
")",
".",
"send",
"(",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"console",
".",
"log",
"(",
"ex",
")",
";",
"res",
".",
"status",
"(",
"500",
")",
".",
"send",
"(",
"ex",
")",
";",
"}",
"}",
")",
";",
"router",
".",
"post",
"(",
"'/provider'",
",",
"async",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"try",
"{",
"const",
"participant",
"=",
"req",
".",
"body",
";",
"await",
"createProvider",
"(",
"participant",
")",
";",
"res",
".",
"status",
"(",
"201",
")",
".",
"send",
"(",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"console",
".",
"log",
"(",
"ex",
")",
";",
"res",
".",
"status",
"(",
"500",
")",
".",
"send",
"(",
"ex",
")",
";",
"}",
"}",
")",
";",
"router",
".",
"post",
"(",
"'/payer'",
",",
"async",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"try",
"{",
"const",
"participant",
"=",
"req",
".",
"body",
";",
"await",
"createPayer",
"(",
"participant",
")",
";",
"res",
".",
"status",
"(",
"201",
")",
".",
"send",
"(",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"console",
".",
"log",
"(",
"ex",
")",
";",
"res",
".",
"status",
"(",
"500",
")",
".",
"send",
"(",
"ex",
")",
";",
"}",
"}",
")",
";",
"router",
".",
"post",
"(",
"'/consortiumAdmin'",
",",
"async",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"try",
"{",
"const",
"participant",
"=",
"req",
".",
"body",
";",
"await",
"createConsortiumAdmin",
"(",
"participant",
")",
";",
"res",
".",
"status",
"(",
"201",
")",
".",
"send",
"(",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"console",
".",
"log",
"(",
"ex",
")",
";",
"res",
".",
"status",
"(",
"500",
")",
".",
"send",
"(",
"ex",
")",
";",
"}",
"}",
")",
";",
"export",
"const",
"ParticipantCtrl",
"=",
"router",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
55,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
40,
null,
16,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
40,
null,
16,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
40,
null,
16,
null,
null,
null,
null,
null,
null,
5,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
40,
null,
16,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
40,
null,
16,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
40,
null,
16,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
40,
null,
16,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
55,
null,
null,
null
] |
197 | [
"import",
"{",
"Init",
",",
"Patient",
",",
"couchQueryAll",
"}",
"from",
"'../convectorUtils'",
";",
"export",
"async",
"function",
"create",
"(",
"patient",
")",
"{",
"const",
"ctrls",
"=",
"await",
"Init",
"(",
")",
";",
"await",
"ctrls",
".",
"patient",
".",
"create",
"(",
"patient",
")",
";",
"}",
"export",
"async",
"function",
"getAll",
"(",
")",
"{",
"return",
"await",
"couchQueryAll",
"(",
"'patients_all'",
",",
"Patient",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
25944,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
198 | [
"import",
"{",
"Init",
"}",
"from",
"'../convectorUtils'",
";",
"import",
"{",
"Invoice",
"}",
"from",
"'financial-cc'",
";",
"export",
"async",
"function",
"make",
"(",
"invoiceId",
",",
"user",
")",
"{",
"const",
"ctrls",
"=",
"await",
"Init",
"(",
"user",
")",
";",
"let",
"invoice",
"=",
"await",
"ctrls",
".",
"payment",
".",
"$query",
"(",
")",
".",
"getOneInvoice",
"(",
"invoiceId",
")",
";",
"console",
".",
"log",
"(",
"invoice",
")",
";",
"await",
"ctrls",
".",
"payment",
".",
"$config",
"(",
"{",
"transient",
":",
"{",
"invoice",
":",
"new",
"Invoice",
"(",
"invoice",
")",
".",
"toJSON",
"(",
")",
"}",
"}",
")",
".",
"make",
"(",
")",
";",
"}"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
7,
null,
2,
null,
2,
null,
null,
null,
6,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] |
199 | [
"import",
"{",
"Router",
",",
"Request",
",",
"Response",
"}",
"from",
"'express'",
";",
"import",
"{",
"make",
"as",
"paymentMake",
"}",
"from",
"'../services/payment.service'",
";",
"const",
"router",
"=",
"Router",
"(",
")",
";",
"router",
".",
"post",
"(",
"'/make'",
",",
"async",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"try",
"{",
"const",
"payment",
"=",
"req",
".",
"body",
".",
"payment",
";",
"const",
"{",
"user",
"}",
"=",
"req",
".",
"query",
";",
"await",
"paymentMake",
"(",
"payment",
",",
"user",
")",
";",
"res",
".",
"send",
"(",
"200",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"console",
".",
"log",
"(",
"ex",
")",
";",
"res",
".",
"status",
"(",
"500",
")",
".",
"send",
"(",
"ex",
")",
";",
"}",
"}",
")",
";",
"export",
"const",
"PaymentCtrl",
"=",
"router",
";"
] | [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
55,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
40,
null,
16,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
55,
null,
null,
null
] |