jass 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +47 -0
- data/README.md +45 -0
- data/lib/jass.rb +55 -0
- data/lib/jass/base.rb +141 -0
- data/lib/jass/bundle_processor.rb +28 -0
- data/lib/jass/compiler.rb +112 -0
- data/lib/jass/dependency.rb +14 -0
- data/lib/jass/errors.rb +29 -0
- data/lib/jass/es6_processor.rb +17 -0
- data/lib/jass/function.rb +13 -0
- data/lib/jass/global_directive_processor.rb +12 -0
- data/lib/jass/plugin.rb +13 -0
- data/lib/jass/railtie.rb +12 -0
- data/lib/jass/version.rb +3 -0
- data/vendor/node_modules/@types/acorn/index.d.ts +256 -0
- data/vendor/node_modules/@types/acorn/package.json +29 -0
- data/vendor/node_modules/@types/estree/index.d.ts +546 -0
- data/vendor/node_modules/@types/estree/package.json +22 -0
- data/vendor/node_modules/acorn-dynamic-import/lib/index.js +17 -0
- data/vendor/node_modules/acorn-dynamic-import/lib/inject.js +72 -0
- data/vendor/node_modules/acorn-dynamic-import/lib/walk.js +22 -0
- data/vendor/node_modules/acorn-dynamic-import/package.json +45 -0
- data/vendor/node_modules/acorn-dynamic-import/src/index.js +4 -0
- data/vendor/node_modules/acorn-dynamic-import/src/inject.js +52 -0
- data/vendor/node_modules/acorn-dynamic-import/src/walk.js +12 -0
- data/vendor/node_modules/acorn-es7-plugin/acorn-es7-plugin.js +17 -0
- data/vendor/node_modules/acorn-es7-plugin/acorn-v3.js +333 -0
- data/vendor/node_modules/acorn-es7-plugin/acorn-v4.js +194 -0
- data/vendor/node_modules/acorn-es7-plugin/package.json +29 -0
- data/vendor/node_modules/acorn-jsx/index.js +3 -0
- data/vendor/node_modules/acorn-jsx/inject.js +449 -0
- data/vendor/node_modules/acorn-jsx/package.json +28 -0
- data/vendor/node_modules/acorn-jsx/xhtml.js +255 -0
- data/vendor/node_modules/acorn/bin/_acorn.js +69 -0
- data/vendor/node_modules/acorn/bin/acorn +4 -0
- data/vendor/node_modules/acorn/bin/run_test262.js +22 -0
- data/vendor/node_modules/acorn/bin/test262.whitelist +409 -0
- data/vendor/node_modules/acorn/dist/acorn.es.js +5305 -0
- data/vendor/node_modules/acorn/dist/acorn.js +5336 -0
- data/vendor/node_modules/acorn/dist/acorn_loose.es.js +1412 -0
- data/vendor/node_modules/acorn/dist/acorn_loose.js +1422 -0
- data/vendor/node_modules/acorn/dist/walk.es.js +419 -0
- data/vendor/node_modules/acorn/dist/walk.js +439 -0
- data/vendor/node_modules/acorn/package.json +56 -0
- data/vendor/node_modules/ansi-styles/index.js +165 -0
- data/vendor/node_modules/ansi-styles/package.json +56 -0
- data/vendor/node_modules/arr-diff/index.js +58 -0
- data/vendor/node_modules/arr-diff/package.json +49 -0
- data/vendor/node_modules/arr-flatten/index.js +22 -0
- data/vendor/node_modules/arr-flatten/package.json +76 -0
- data/vendor/node_modules/array-unique/index.js +28 -0
- data/vendor/node_modules/array-unique/package.json +37 -0
- data/vendor/node_modules/braces/index.js +399 -0
- data/vendor/node_modules/braces/package.json +83 -0
- data/vendor/node_modules/buble/bin/buble +24 -0
- data/vendor/node_modules/buble/bin/handleError.js +58 -0
- data/vendor/node_modules/buble/bin/runBuble.js +150 -0
- data/vendor/node_modules/buble/bin/showHelp.js +16 -0
- data/vendor/node_modules/buble/dist/buble-browser-deps.umd.js +14857 -0
- data/vendor/node_modules/buble/dist/buble-browser.cjs.js +9941 -0
- data/vendor/node_modules/buble/dist/buble-browser.es.js +9933 -0
- data/vendor/node_modules/buble/dist/buble.cjs.js +9433 -0
- data/vendor/node_modules/buble/dist/buble.es.js +9425 -0
- data/vendor/node_modules/buble/package.json +74 -0
- data/vendor/node_modules/buble/register.js +90 -0
- data/vendor/node_modules/buble/src/index.js +98 -0
- data/vendor/node_modules/buble/src/program/BlockStatement.js +373 -0
- data/vendor/node_modules/buble/src/program/Node.js +112 -0
- data/vendor/node_modules/buble/src/program/Program.js +74 -0
- data/vendor/node_modules/buble/src/program/Scope.js +116 -0
- data/vendor/node_modules/buble/src/program/extractNames.js +35 -0
- data/vendor/node_modules/buble/src/program/keys.js +4 -0
- data/vendor/node_modules/buble/src/program/types/ArrayExpression.js +70 -0
- data/vendor/node_modules/buble/src/program/types/ArrowFunctionExpression.js +52 -0
- data/vendor/node_modules/buble/src/program/types/AssignmentExpression.js +185 -0
- data/vendor/node_modules/buble/src/program/types/BinaryExpression.js +12 -0
- data/vendor/node_modules/buble/src/program/types/BreakStatement.js +26 -0
- data/vendor/node_modules/buble/src/program/types/CallExpression.js +104 -0
- data/vendor/node_modules/buble/src/program/types/ClassBody.js +237 -0
- data/vendor/node_modules/buble/src/program/types/ClassDeclaration.js +79 -0
- data/vendor/node_modules/buble/src/program/types/ClassExpression.js +51 -0
- data/vendor/node_modules/buble/src/program/types/ContinueStatement.js +17 -0
- data/vendor/node_modules/buble/src/program/types/ExportDefaultDeclaration.js +10 -0
- data/vendor/node_modules/buble/src/program/types/ExportNamedDeclaration.js +10 -0
- data/vendor/node_modules/buble/src/program/types/ForInStatement.js +76 -0
- data/vendor/node_modules/buble/src/program/types/ForOfStatement.js +89 -0
- data/vendor/node_modules/buble/src/program/types/ForStatement.js +54 -0
- data/vendor/node_modules/buble/src/program/types/FunctionDeclaration.js +25 -0
- data/vendor/node_modules/buble/src/program/types/FunctionExpression.js +74 -0
- data/vendor/node_modules/buble/src/program/types/Identifier.js +54 -0
- data/vendor/node_modules/buble/src/program/types/IfStatement.js +29 -0
- data/vendor/node_modules/buble/src/program/types/ImportDeclaration.js +10 -0
- data/vendor/node_modules/buble/src/program/types/ImportDefaultSpecifier.js +8 -0
- data/vendor/node_modules/buble/src/program/types/ImportSpecifier.js +8 -0
- data/vendor/node_modules/buble/src/program/types/JSXAttribute.js +20 -0
- data/vendor/node_modules/buble/src/program/types/JSXClosingElement.js +27 -0
- data/vendor/node_modules/buble/src/program/types/JSXClosingFragment.js +22 -0
- data/vendor/node_modules/buble/src/program/types/JSXElement.js +57 -0
- data/vendor/node_modules/buble/src/program/types/JSXExpressionContainer.js +10 -0
- data/vendor/node_modules/buble/src/program/types/JSXFragment.js +4 -0
- data/vendor/node_modules/buble/src/program/types/JSXOpeningElement.js +93 -0
- data/vendor/node_modules/buble/src/program/types/JSXOpeningFragment.js +7 -0
- data/vendor/node_modules/buble/src/program/types/JSXSpreadAttribute.js +10 -0
- data/vendor/node_modules/buble/src/program/types/Literal.js +43 -0
- data/vendor/node_modules/buble/src/program/types/MemberExpression.js +13 -0
- data/vendor/node_modules/buble/src/program/types/NewExpression.js +55 -0
- data/vendor/node_modules/buble/src/program/types/ObjectExpression.js +250 -0
- data/vendor/node_modules/buble/src/program/types/Property.js +52 -0
- data/vendor/node_modules/buble/src/program/types/ReturnStatement.js +32 -0
- data/vendor/node_modules/buble/src/program/types/SpreadElement.js +12 -0
- data/vendor/node_modules/buble/src/program/types/Super.js +88 -0
- data/vendor/node_modules/buble/src/program/types/TaggedTemplateExpression.js +63 -0
- data/vendor/node_modules/buble/src/program/types/TemplateElement.js +7 -0
- data/vendor/node_modules/buble/src/program/types/TemplateLiteral.js +80 -0
- data/vendor/node_modules/buble/src/program/types/ThisExpression.js +31 -0
- data/vendor/node_modules/buble/src/program/types/UpdateExpression.js +32 -0
- data/vendor/node_modules/buble/src/program/types/VariableDeclaration.js +101 -0
- data/vendor/node_modules/buble/src/program/types/VariableDeclarator.js +43 -0
- data/vendor/node_modules/buble/src/program/types/index.js +98 -0
- data/vendor/node_modules/buble/src/program/types/shared/LoopStatement.js +105 -0
- data/vendor/node_modules/buble/src/program/types/shared/ModuleDeclaration.js +10 -0
- data/vendor/node_modules/buble/src/program/wrap.js +68 -0
- data/vendor/node_modules/buble/src/support.js +97 -0
- data/vendor/node_modules/buble/src/utils/CompileError.js +30 -0
- data/vendor/node_modules/buble/src/utils/array.js +11 -0
- data/vendor/node_modules/buble/src/utils/checkConst.js +8 -0
- data/vendor/node_modules/buble/src/utils/deindent.js +30 -0
- data/vendor/node_modules/buble/src/utils/destructure.js +377 -0
- data/vendor/node_modules/buble/src/utils/getSnippet.js +30 -0
- data/vendor/node_modules/buble/src/utils/isReference.js +41 -0
- data/vendor/node_modules/buble/src/utils/locate.js +20 -0
- data/vendor/node_modules/buble/src/utils/patterns.js +1 -0
- data/vendor/node_modules/buble/src/utils/removeTrailingComma.js +13 -0
- data/vendor/node_modules/buble/src/utils/reserved.js +6 -0
- data/vendor/node_modules/buble/src/utils/spread.js +70 -0
- data/vendor/node_modules/builtin-modules/builtin-modules.json +39 -0
- data/vendor/node_modules/builtin-modules/index.js +10 -0
- data/vendor/node_modules/builtin-modules/package.json +40 -0
- data/vendor/node_modules/builtin-modules/static.js +2 -0
- data/vendor/node_modules/chalk/index.js +228 -0
- data/vendor/node_modules/chalk/package.json +66 -0
- data/vendor/node_modules/chalk/templates.js +128 -0
- data/vendor/node_modules/chalk/types/index.d.ts +97 -0
- data/vendor/node_modules/color-convert/conversions.js +861 -0
- data/vendor/node_modules/color-convert/index.js +78 -0
- data/vendor/node_modules/color-convert/package.json +46 -0
- data/vendor/node_modules/color-convert/route.js +97 -0
- data/vendor/node_modules/color-name/index.js +152 -0
- data/vendor/node_modules/color-name/package.json +25 -0
- data/vendor/node_modules/color-name/test.js +7 -0
- data/vendor/node_modules/date-time/index.js +33 -0
- data/vendor/node_modules/date-time/package.json +39 -0
- data/vendor/node_modules/escape-string-regexp/index.js +11 -0
- data/vendor/node_modules/escape-string-regexp/package.json +41 -0
- data/vendor/node_modules/estree-walker/dist/estree-walker.es.js +57 -0
- data/vendor/node_modules/estree-walker/dist/estree-walker.umd.js +68 -0
- data/vendor/node_modules/estree-walker/package.json +34 -0
- data/vendor/node_modules/estree-walker/src/estree-walker.js +51 -0
- data/vendor/node_modules/expand-brackets/index.js +163 -0
- data/vendor/node_modules/expand-brackets/package.json +62 -0
- data/vendor/node_modules/expand-range/index.js +43 -0
- data/vendor/node_modules/expand-range/package.json +73 -0
- data/vendor/node_modules/extglob/index.js +178 -0
- data/vendor/node_modules/extglob/package.json +60 -0
- data/vendor/node_modules/filename-regex/index.js +10 -0
- data/vendor/node_modules/filename-regex/package.json +50 -0
- data/vendor/node_modules/fill-range/index.js +408 -0
- data/vendor/node_modules/fill-range/package.json +61 -0
- data/vendor/node_modules/for-in/index.js +16 -0
- data/vendor/node_modules/for-in/package.json +68 -0
- data/vendor/node_modules/for-own/index.js +19 -0
- data/vendor/node_modules/for-own/package.json +70 -0
- data/vendor/node_modules/glob-base/index.js +51 -0
- data/vendor/node_modules/glob-base/package.json +52 -0
- data/vendor/node_modules/glob-parent/index.js +10 -0
- data/vendor/node_modules/glob-parent/package.json +35 -0
- data/vendor/node_modules/glob-parent/test.js +28 -0
- data/vendor/node_modules/has-flag/index.js +8 -0
- data/vendor/node_modules/has-flag/package.json +44 -0
- data/vendor/node_modules/irregular-plurals/irregular-plurals.json +146 -0
- data/vendor/node_modules/irregular-plurals/package.json +39 -0
- data/vendor/node_modules/is-buffer/index.js +21 -0
- data/vendor/node_modules/is-buffer/package.json +51 -0
- data/vendor/node_modules/is-dotfile/index.js +14 -0
- data/vendor/node_modules/is-dotfile/package.json +69 -0
- data/vendor/node_modules/is-equal-shallow/index.js +27 -0
- data/vendor/node_modules/is-equal-shallow/package.json +54 -0
- data/vendor/node_modules/is-extendable/index.js +13 -0
- data/vendor/node_modules/is-extendable/package.json +51 -0
- data/vendor/node_modules/is-extglob/index.js +11 -0
- data/vendor/node_modules/is-extglob/package.json +48 -0
- data/vendor/node_modules/is-glob/index.js +14 -0
- data/vendor/node_modules/is-glob/package.json +60 -0
- data/vendor/node_modules/is-module/index.js +11 -0
- data/vendor/node_modules/is-module/package.json +20 -0
- data/vendor/node_modules/is-number/index.js +19 -0
- data/vendor/node_modules/is-number/package.json +59 -0
- data/vendor/node_modules/is-posix-bracket/index.js +10 -0
- data/vendor/node_modules/is-posix-bracket/package.json +64 -0
- data/vendor/node_modules/is-primitive/index.js +13 -0
- data/vendor/node_modules/is-primitive/package.json +46 -0
- data/vendor/node_modules/is-reference/dist/is-reference.es.js +26 -0
- data/vendor/node_modules/is-reference/dist/is-reference.js +34 -0
- data/vendor/node_modules/is-reference/dist/types/index.d.ts +2 -0
- data/vendor/node_modules/is-reference/package.json +47 -0
- data/vendor/node_modules/isarray/index.js +5 -0
- data/vendor/node_modules/isarray/package.json +45 -0
- data/vendor/node_modules/isarray/test.js +20 -0
- data/vendor/node_modules/isobject/index.js +14 -0
- data/vendor/node_modules/isobject/package.json +67 -0
- data/vendor/node_modules/kind-of/index.js +116 -0
- data/vendor/node_modules/kind-of/package.json +90 -0
- data/vendor/node_modules/locate-character/dist/locate-character.es.js +43 -0
- data/vendor/node_modules/locate-character/dist/locate-character.umd.js +54 -0
- data/vendor/node_modules/locate-character/dist/types/index.d.ts +17 -0
- data/vendor/node_modules/locate-character/package.json +41 -0
- data/vendor/node_modules/magic-string/dist/magic-string.cjs.js +1300 -0
- data/vendor/node_modules/magic-string/dist/magic-string.es.js +1296 -0
- data/vendor/node_modules/magic-string/dist/magic-string.umd.js +1352 -0
- data/vendor/node_modules/magic-string/index.d.ts +83 -0
- data/vendor/node_modules/magic-string/node_modules/vlq/dist/vlq.js +91 -0
- data/vendor/node_modules/magic-string/node_modules/vlq/package.json +27 -0
- data/vendor/node_modules/magic-string/node_modules/vlq/src/vlq.js +78 -0
- data/vendor/node_modules/magic-string/package.json +55 -0
- data/vendor/node_modules/micromatch/index.js +431 -0
- data/vendor/node_modules/micromatch/lib/chars.js +67 -0
- data/vendor/node_modules/micromatch/lib/expand.js +304 -0
- data/vendor/node_modules/micromatch/lib/glob.js +193 -0
- data/vendor/node_modules/micromatch/lib/utils.js +149 -0
- data/vendor/node_modules/micromatch/package.json +114 -0
- data/vendor/node_modules/minimist/index.js +236 -0
- data/vendor/node_modules/minimist/package.json +45 -0
- data/vendor/node_modules/nodent-compiler/compiler.js +171 -0
- data/vendor/node_modules/nodent-compiler/lib/arboriculture.js +2694 -0
- data/vendor/node_modules/nodent-compiler/lib/output.js +934 -0
- data/vendor/node_modules/nodent-compiler/lib/parser.js +291 -0
- data/vendor/node_modules/nodent-compiler/package.json +37 -0
- data/vendor/node_modules/normalize-path/index.js +19 -0
- data/vendor/node_modules/normalize-path/package.json +78 -0
- data/vendor/node_modules/object.omit/index.js +40 -0
- data/vendor/node_modules/object.omit/package.json +67 -0
- data/vendor/node_modules/os-homedir/index.js +24 -0
- data/vendor/node_modules/os-homedir/package.json +41 -0
- data/vendor/node_modules/parse-glob/index.js +156 -0
- data/vendor/node_modules/parse-glob/package.json +62 -0
- data/vendor/node_modules/parse-ms/index.js +16 -0
- data/vendor/node_modules/parse-ms/package.json +34 -0
- data/vendor/node_modules/path-parse/index.js +93 -0
- data/vendor/node_modules/path-parse/index.min.js +1 -0
- data/vendor/node_modules/path-parse/package.json +33 -0
- data/vendor/node_modules/path-parse/test.js +77 -0
- data/vendor/node_modules/path-parse/test.min.js +1 -0
- data/vendor/node_modules/plur/index.js +20 -0
- data/vendor/node_modules/plur/package.json +42 -0
- data/vendor/node_modules/preserve/index.js +54 -0
- data/vendor/node_modules/preserve/package.json +48 -0
- data/vendor/node_modules/preserve/test.js +48 -0
- data/vendor/node_modules/pretty-ms/index.js +48 -0
- data/vendor/node_modules/pretty-ms/package.json +48 -0
- data/vendor/node_modules/randomatic/index.js +82 -0
- data/vendor/node_modules/randomatic/node_modules/is-number/index.js +22 -0
- data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/index.js +116 -0
- data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/package.json +90 -0
- data/vendor/node_modules/randomatic/node_modules/is-number/package.json +83 -0
- data/vendor/node_modules/randomatic/node_modules/kind-of/index.js +119 -0
- data/vendor/node_modules/randomatic/node_modules/kind-of/package.json +90 -0
- data/vendor/node_modules/randomatic/package.json +78 -0
- data/vendor/node_modules/regex-cache/index.js +68 -0
- data/vendor/node_modules/regex-cache/package.json +64 -0
- data/vendor/node_modules/remove-trailing-separator/index.js +17 -0
- data/vendor/node_modules/remove-trailing-separator/package.json +37 -0
- data/vendor/node_modules/repeat-element/index.js +18 -0
- data/vendor/node_modules/repeat-element/package.json +44 -0
- data/vendor/node_modules/repeat-string/index.js +70 -0
- data/vendor/node_modules/repeat-string/package.json +77 -0
- data/vendor/node_modules/require-relative/index.js +33 -0
- data/vendor/node_modules/require-relative/package.json +22 -0
- data/vendor/node_modules/resolve/index.js +8 -0
- data/vendor/node_modules/resolve/lib/async.js +203 -0
- data/vendor/node_modules/resolve/lib/caller.js +8 -0
- data/vendor/node_modules/resolve/lib/core.js +53 -0
- data/vendor/node_modules/resolve/lib/core.json +69 -0
- data/vendor/node_modules/resolve/lib/node-modules-paths.js +45 -0
- data/vendor/node_modules/resolve/lib/sync.js +93 -0
- data/vendor/node_modules/resolve/package.json +40 -0
- data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js +804 -0
- data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.es.js +800 -0
- data/vendor/node_modules/rollup-plugin-commonjs/package.json +52 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/ast-utils.js +104 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/defaultResolver.js +39 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/helpers.js +19 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/index.js +198 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/transform.js +431 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/utils.js +13 -0
- data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.cjs.js +218 -0
- data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.es.js +214 -0
- data/vendor/node_modules/rollup-plugin-node-resolve/package.json +51 -0
- data/vendor/node_modules/rollup-plugin-node-resolve/src/empty.js +1 -0
- data/vendor/node_modules/rollup-plugin-node-resolve/src/index.js +205 -0
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js +223 -0
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es.js +214 -0
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es6.js +217 -0
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es.js +55 -0
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es6.js +59 -0
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js +65 -0
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/package.json +33 -0
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/src/estree-walker.js +49 -0
- data/vendor/node_modules/rollup-pluginutils/package.json +40 -0
- data/vendor/node_modules/rollup-pluginutils/src/addExtension.js +6 -0
- data/vendor/node_modules/rollup-pluginutils/src/attachScopes.js +147 -0
- data/vendor/node_modules/rollup-pluginutils/src/createFilter.js +33 -0
- data/vendor/node_modules/rollup-pluginutils/src/index.js +4 -0
- data/vendor/node_modules/rollup-pluginutils/src/makeLegalIdentifier.js +15 -0
- data/vendor/node_modules/rollup-pluginutils/src/utils/ensureArray.js +5 -0
- data/vendor/node_modules/rollup/bin/rollup +4085 -0
- data/vendor/node_modules/rollup/dist/rollup.browser.js +19829 -0
- data/vendor/node_modules/rollup/dist/rollup.es.js +23586 -0
- data/vendor/node_modules/rollup/dist/rollup.js +23597 -0
- data/vendor/node_modules/rollup/dist/typings/Chunk.d.ts +85 -0
- data/vendor/node_modules/rollup/dist/typings/ExternalModule.d.ts +30 -0
- data/vendor/node_modules/rollup/dist/typings/Graph.d.ts +47 -0
- data/vendor/node_modules/rollup/dist/typings/Module.d.ts +130 -0
- data/vendor/node_modules/rollup/dist/typings/ast/CallOptions.d.ts +20 -0
- data/vendor/node_modules/rollup/dist/typings/ast/Entity.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/ExecutionPathOptions.d.ts +57 -0
- data/vendor/node_modules/rollup/dist/typings/ast/clone.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/ast/enhance.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/ast/keys.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ArrayExpression.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ArrayPattern.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ArrowFunctionExpression.d.ts +25 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/AssignmentExpression.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/AssignmentPattern.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/AssignmentProperty.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/AwaitExpression.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/BinaryExpression.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/BlockStatement.d.ts +19 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/BreakStatement.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/CallExpression.d.ts +22 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/CatchClause.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ClassBody.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ClassDeclaration.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ClassExpression.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ConditionalExpression.d.ts +28 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/DoWhileStatement.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/EmptyStatement.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportAllDeclaration.d.ts +12 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportDefaultDeclaration.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportNamedDeclaration.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportSpecifier.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExpressionStatement.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ForInStatement.d.ts +20 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ForOfStatement.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ForStatement.d.ts +19 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/FunctionDeclaration.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/FunctionExpression.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/Identifier.d.ts +29 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/IfStatement.d.ts +17 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/Import.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportDeclaration.d.ts +17 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportDefaultSpecifier.d.ts +7 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportNamespaceSpecifier.d.ts +7 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportSpecifier.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/LabeledStatement.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/Literal.d.ts +22 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/LogicalExpression.d.ts +23 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/MemberExpression.d.ts +34 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/MethodDefinition.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/NewExpression.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/NodeType.d.ts +64 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ObjectExpression.d.ts +22 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ObjectPattern.d.ts +15 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/Program.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/Property.d.ts +30 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/RestElement.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ReturnStatement.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/SequenceExpression.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/SpreadElement.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/SwitchCase.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/SwitchStatement.d.ts +12 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/TaggedTemplateExpression.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/TemplateElement.d.ts +12 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/TemplateLiteral.d.ts +12 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ThisExpression.d.ts +17 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ThrowStatement.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/UnaryExpression.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/UnknownNode.d.ts +5 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/UpdateExpression.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/VariableDeclaration.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/VariableDeclarator.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/WhileStatement.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/YieldExpression.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/index.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/ClassNode.d.ts +17 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/Expression.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/FunctionNode.d.ts +25 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/Node.d.ts +133 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/Pattern.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/pureFunctions.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/BlockScope.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/CatchScope.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/FunctionScope.d.ts +20 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/GlobalScope.d.ts +7 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/ModuleScope.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/ParameterScope.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/ReturnValueScope.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/Scope.d.ts +42 -0
- data/vendor/node_modules/rollup/dist/typings/ast/utils/extractNames.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/ast/values.d.ts +31 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ArgumentsVariable.d.ts +15 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ExportDefaultVariable.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ExternalVariable.d.ts +12 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/GlobalVariable.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/LocalVariable.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/NamespaceVariable.d.ts +20 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ParameterVariable.d.ts +5 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ReplaceableInitializationVariable.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ThisVariable.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/Variable.d.ts +43 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/VariableReassignmentTracker.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/amd.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/cjs.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/es.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/iife.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/index.d.ts +15 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/esModuleExport.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/getExportBlock.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/getGlobalNameMaker.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/getInteropBlock.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/sanitize.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/setupNamespace.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/trimEmptyImports.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/warnOnBuiltins.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/system.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/umd.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/node-entry.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/rollup/index.d.ts +167 -0
- data/vendor/node_modules/rollup/dist/typings/utils/callIfFunction.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/collapseSourcemaps.d.ts +5 -0
- data/vendor/node_modules/rollup/dist/typings/utils/commondir.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/defaults.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/utils/deprecateOptions.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/utils/ensureArray.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/utils/entryHashing.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/utils/error.d.ts +18 -0
- data/vendor/node_modules/rollup/dist/typings/utils/first-sync.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/first.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/flushTime.d.ts +5 -0
- data/vendor/node_modules/rollup/dist/typings/utils/fs.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/utils/getCodeFrame.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/getExportMode.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/utils/getIndentString.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/utils/identifierHelpers.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/utils/mergeOptions.d.ts +19 -0
- data/vendor/node_modules/rollup/dist/typings/utils/object.d.ts +7 -0
- data/vendor/node_modules/rollup/dist/typings/utils/path.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/utils/promise.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/utils/relativeId.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/renderHelpers.d.ts +26 -0
- data/vendor/node_modules/rollup/dist/typings/utils/sourceMappingURL.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/utils/timers.d.ts +7 -0
- data/vendor/node_modules/rollup/dist/typings/utils/transform.d.ts +25 -0
- data/vendor/node_modules/rollup/dist/typings/utils/transformBundle.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/watch/chokidar.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/watch/fileWatchers.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/watch/index.d.ts +47 -0
- data/vendor/node_modules/rollup/package.json +122 -0
- data/vendor/node_modules/rollup/typings/package.json.d.ts +3 -0
- data/vendor/node_modules/signal-exit/index.js +157 -0
- data/vendor/node_modules/signal-exit/package.json +38 -0
- data/vendor/node_modules/signal-exit/signals.js +53 -0
- data/vendor/node_modules/source-map/dist/source-map.debug.js +3091 -0
- data/vendor/node_modules/source-map/dist/source-map.js +3090 -0
- data/vendor/node_modules/source-map/dist/source-map.min.js +2 -0
- data/vendor/node_modules/source-map/lib/array-set.js +121 -0
- data/vendor/node_modules/source-map/lib/base64-vlq.js +140 -0
- data/vendor/node_modules/source-map/lib/base64.js +67 -0
- data/vendor/node_modules/source-map/lib/binary-search.js +111 -0
- data/vendor/node_modules/source-map/lib/mapping-list.js +79 -0
- data/vendor/node_modules/source-map/lib/quick-sort.js +114 -0
- data/vendor/node_modules/source-map/lib/source-map-consumer.js +1082 -0
- data/vendor/node_modules/source-map/lib/source-map-generator.js +416 -0
- data/vendor/node_modules/source-map/lib/source-node.js +413 -0
- data/vendor/node_modules/source-map/lib/util.js +417 -0
- data/vendor/node_modules/source-map/package.json +72 -0
- data/vendor/node_modules/source-map/source-map.js +8 -0
- data/vendor/node_modules/sourcemap-codec/dist/sourcemap-codec.es.js +129 -0
- data/vendor/node_modules/sourcemap-codec/dist/sourcemap-codec.umd.js +140 -0
- data/vendor/node_modules/sourcemap-codec/dist/types/sourcemap-codec.d.ts +5 -0
- data/vendor/node_modules/sourcemap-codec/package.json +52 -0
- data/vendor/node_modules/supports-color/browser.js +5 -0
- data/vendor/node_modules/supports-color/index.js +135 -0
- data/vendor/node_modules/supports-color/package.json +53 -0
- data/vendor/node_modules/time-zone/index.js +10 -0
- data/vendor/node_modules/time-zone/package.json +35 -0
- data/vendor/node_modules/vlq/dist/types/vlq.d.ts +2 -0
- data/vendor/node_modules/vlq/dist/vlq.es.js +64 -0
- data/vendor/node_modules/vlq/dist/vlq.js +75 -0
- data/vendor/node_modules/vlq/package.json +30 -0
- data/vendor/package.json +15 -0
- data/vendor/yarn.lock +453 -0
- metadata +641 -0
@@ -0,0 +1,419 @@
|
|
1
|
+
// AST walker module for Mozilla Parser API compatible trees
|
2
|
+
|
3
|
+
// A simple walk is one where you simply specify callbacks to be
|
4
|
+
// called on specific nodes. The last two arguments are optional. A
|
5
|
+
// simple use would be
|
6
|
+
//
|
7
|
+
// walk.simple(myTree, {
|
8
|
+
// Expression: function(node) { ... }
|
9
|
+
// });
|
10
|
+
//
|
11
|
+
// to do something with all expressions. All Parser API node types
|
12
|
+
// can be used to identify node types, as well as Expression,
|
13
|
+
// Statement, and ScopeBody, which denote categories of nodes.
|
14
|
+
//
|
15
|
+
// The base argument can be used to pass a custom (recursive)
|
16
|
+
// walker, and state can be used to give this walked an initial
|
17
|
+
// state.
|
18
|
+
|
19
|
+
function simple(node, visitors, base, state, override) {
|
20
|
+
if (!base) { base = exports.base
|
21
|
+
; }(function c(node, st, override) {
|
22
|
+
var type = override || node.type, found = visitors[type];
|
23
|
+
base[type](node, st, c);
|
24
|
+
if (found) { found(node, st); }
|
25
|
+
})(node, state, override);
|
26
|
+
}
|
27
|
+
|
28
|
+
// An ancestor walk keeps an array of ancestor nodes (including the
|
29
|
+
// current node) and passes them to the callback as third parameter
|
30
|
+
// (and also as state parameter when no other state is present).
|
31
|
+
function ancestor(node, visitors, base, state) {
|
32
|
+
if (!base) { base = exports.base; }
|
33
|
+
var ancestors = [];(function c(node, st, override) {
|
34
|
+
var type = override || node.type, found = visitors[type];
|
35
|
+
var isNew = node != ancestors[ancestors.length - 1];
|
36
|
+
if (isNew) { ancestors.push(node); }
|
37
|
+
base[type](node, st, c);
|
38
|
+
if (found) { found(node, st || ancestors, ancestors); }
|
39
|
+
if (isNew) { ancestors.pop(); }
|
40
|
+
})(node, state);
|
41
|
+
}
|
42
|
+
|
43
|
+
// A recursive walk is one where your functions override the default
|
44
|
+
// walkers. They can modify and replace the state parameter that's
|
45
|
+
// threaded through the walk, and can opt how and whether to walk
|
46
|
+
// their child nodes (by calling their third argument on these
|
47
|
+
// nodes).
|
48
|
+
function recursive(node, state, funcs, base, override) {
|
49
|
+
var visitor = funcs ? exports.make(funcs, base) : base;(function c(node, st, override) {
|
50
|
+
visitor[override || node.type](node, st, c);
|
51
|
+
})(node, state, override);
|
52
|
+
}
|
53
|
+
|
54
|
+
function makeTest(test) {
|
55
|
+
if (typeof test == "string")
|
56
|
+
{ return function (type) { return type == test; } }
|
57
|
+
else if (!test)
|
58
|
+
{ return function () { return true; } }
|
59
|
+
else
|
60
|
+
{ return test }
|
61
|
+
}
|
62
|
+
|
63
|
+
var Found = function Found(node, state) { this.node = node; this.state = state; };
|
64
|
+
|
65
|
+
// A full walk triggers the callback on each node
|
66
|
+
function full(node, callback, base, state, override) {
|
67
|
+
if (!base) { base = exports.base
|
68
|
+
; }(function c(node, st, override) {
|
69
|
+
var type = override || node.type;
|
70
|
+
base[type](node, st, c);
|
71
|
+
if (!override) { callback(node, st, type); }
|
72
|
+
})(node, state, override);
|
73
|
+
}
|
74
|
+
|
75
|
+
// An fullAncestor walk is like an ancestor walk, but triggers
|
76
|
+
// the callback on each node
|
77
|
+
function fullAncestor(node, callback, base, state) {
|
78
|
+
if (!base) { base = exports.base; }
|
79
|
+
var ancestors = [];(function c(node, st, override) {
|
80
|
+
var type = override || node.type;
|
81
|
+
var isNew = node != ancestors[ancestors.length - 1];
|
82
|
+
if (isNew) { ancestors.push(node); }
|
83
|
+
base[type](node, st, c);
|
84
|
+
if (!override) { callback(node, st || ancestors, ancestors, type); }
|
85
|
+
if (isNew) { ancestors.pop(); }
|
86
|
+
})(node, state);
|
87
|
+
}
|
88
|
+
|
89
|
+
// Find a node with a given start, end, and type (all are optional,
|
90
|
+
// null can be used as wildcard). Returns a {node, state} object, or
|
91
|
+
// undefined when it doesn't find a matching node.
|
92
|
+
function findNodeAt(node, start, end, test, base, state) {
|
93
|
+
test = makeTest(test);
|
94
|
+
if (!base) { base = exports.base; }
|
95
|
+
try {
|
96
|
+
(function c(node, st, override) {
|
97
|
+
var type = override || node.type;
|
98
|
+
if ((start == null || node.start <= start) &&
|
99
|
+
(end == null || node.end >= end))
|
100
|
+
{ base[type](node, st, c); }
|
101
|
+
if ((start == null || node.start == start) &&
|
102
|
+
(end == null || node.end == end) &&
|
103
|
+
test(type, node))
|
104
|
+
{ throw new Found(node, st) }
|
105
|
+
})(node, state);
|
106
|
+
} catch (e) {
|
107
|
+
if (e instanceof Found) { return e }
|
108
|
+
throw e
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
// Find the innermost node of a given type that contains the given
|
113
|
+
// position. Interface similar to findNodeAt.
|
114
|
+
function findNodeAround(node, pos, test, base, state) {
|
115
|
+
test = makeTest(test);
|
116
|
+
if (!base) { base = exports.base; }
|
117
|
+
try {
|
118
|
+
(function c(node, st, override) {
|
119
|
+
var type = override || node.type;
|
120
|
+
if (node.start > pos || node.end < pos) { return }
|
121
|
+
base[type](node, st, c);
|
122
|
+
if (test(type, node)) { throw new Found(node, st) }
|
123
|
+
})(node, state);
|
124
|
+
} catch (e) {
|
125
|
+
if (e instanceof Found) { return e }
|
126
|
+
throw e
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
// Find the outermost matching node after a given position.
|
131
|
+
function findNodeAfter(node, pos, test, base, state) {
|
132
|
+
test = makeTest(test);
|
133
|
+
if (!base) { base = exports.base; }
|
134
|
+
try {
|
135
|
+
(function c(node, st, override) {
|
136
|
+
if (node.end < pos) { return }
|
137
|
+
var type = override || node.type;
|
138
|
+
if (node.start >= pos && test(type, node)) { throw new Found(node, st) }
|
139
|
+
base[type](node, st, c);
|
140
|
+
})(node, state);
|
141
|
+
} catch (e) {
|
142
|
+
if (e instanceof Found) { return e }
|
143
|
+
throw e
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
// Find the outermost matching node before a given position.
|
148
|
+
function findNodeBefore(node, pos, test, base, state) {
|
149
|
+
test = makeTest(test);
|
150
|
+
if (!base) { base = exports.base; }
|
151
|
+
var max;(function c(node, st, override) {
|
152
|
+
if (node.start > pos) { return }
|
153
|
+
var type = override || node.type;
|
154
|
+
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
|
155
|
+
{ max = new Found(node, st); }
|
156
|
+
base[type](node, st, c);
|
157
|
+
})(node, state);
|
158
|
+
return max
|
159
|
+
}
|
160
|
+
|
161
|
+
// Fallback to an Object.create polyfill for older environments.
|
162
|
+
var create = Object.create || function(proto) {
|
163
|
+
function Ctor() {}
|
164
|
+
Ctor.prototype = proto;
|
165
|
+
return new Ctor
|
166
|
+
};
|
167
|
+
|
168
|
+
// Used to create a custom walker. Will fill in all missing node
|
169
|
+
// type properties with the defaults.
|
170
|
+
function make(funcs, base) {
|
171
|
+
if (!base) { base = exports.base; }
|
172
|
+
var visitor = create(base);
|
173
|
+
for (var type in funcs) { visitor[type] = funcs[type]; }
|
174
|
+
return visitor
|
175
|
+
}
|
176
|
+
|
177
|
+
function skipThrough(node, st, c) { c(node, st); }
|
178
|
+
function ignore(_node, _st, _c) {}
|
179
|
+
|
180
|
+
// Node walkers.
|
181
|
+
|
182
|
+
var base = {};
|
183
|
+
|
184
|
+
base.Program = base.BlockStatement = function (node, st, c) {
|
185
|
+
for (var i = 0, list = node.body; i < list.length; i += 1)
|
186
|
+
{
|
187
|
+
var stmt = list[i];
|
188
|
+
|
189
|
+
c(stmt, st, "Statement");
|
190
|
+
}
|
191
|
+
};
|
192
|
+
base.Statement = skipThrough;
|
193
|
+
base.EmptyStatement = ignore;
|
194
|
+
base.ExpressionStatement = base.ParenthesizedExpression =
|
195
|
+
function (node, st, c) { return c(node.expression, st, "Expression"); };
|
196
|
+
base.IfStatement = function (node, st, c) {
|
197
|
+
c(node.test, st, "Expression");
|
198
|
+
c(node.consequent, st, "Statement");
|
199
|
+
if (node.alternate) { c(node.alternate, st, "Statement"); }
|
200
|
+
};
|
201
|
+
base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
|
202
|
+
base.BreakStatement = base.ContinueStatement = ignore;
|
203
|
+
base.WithStatement = function (node, st, c) {
|
204
|
+
c(node.object, st, "Expression");
|
205
|
+
c(node.body, st, "Statement");
|
206
|
+
};
|
207
|
+
base.SwitchStatement = function (node, st, c) {
|
208
|
+
c(node.discriminant, st, "Expression");
|
209
|
+
for (var i = 0, list = node.cases; i < list.length; i += 1) {
|
210
|
+
var cs = list[i];
|
211
|
+
|
212
|
+
if (cs.test) { c(cs.test, st, "Expression"); }
|
213
|
+
for (var i$1 = 0, list$1 = cs.consequent; i$1 < list$1.length; i$1 += 1)
|
214
|
+
{
|
215
|
+
var cons = list$1[i$1];
|
216
|
+
|
217
|
+
c(cons, st, "Statement");
|
218
|
+
}
|
219
|
+
}
|
220
|
+
};
|
221
|
+
base.SwitchCase = function (node, st, c) {
|
222
|
+
if (node.test) { c(node.test, st, "Expression"); }
|
223
|
+
for (var i = 0, list = node.consequent; i < list.length; i += 1)
|
224
|
+
{
|
225
|
+
var cons = list[i];
|
226
|
+
|
227
|
+
c(cons, st, "Statement");
|
228
|
+
}
|
229
|
+
};
|
230
|
+
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
|
231
|
+
if (node.argument) { c(node.argument, st, "Expression"); }
|
232
|
+
};
|
233
|
+
base.ThrowStatement = base.SpreadElement =
|
234
|
+
function (node, st, c) { return c(node.argument, st, "Expression"); };
|
235
|
+
base.TryStatement = function (node, st, c) {
|
236
|
+
c(node.block, st, "Statement");
|
237
|
+
if (node.handler) { c(node.handler, st); }
|
238
|
+
if (node.finalizer) { c(node.finalizer, st, "Statement"); }
|
239
|
+
};
|
240
|
+
base.CatchClause = function (node, st, c) {
|
241
|
+
c(node.param, st, "Pattern");
|
242
|
+
c(node.body, st, "ScopeBody");
|
243
|
+
};
|
244
|
+
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
|
245
|
+
c(node.test, st, "Expression");
|
246
|
+
c(node.body, st, "Statement");
|
247
|
+
};
|
248
|
+
base.ForStatement = function (node, st, c) {
|
249
|
+
if (node.init) { c(node.init, st, "ForInit"); }
|
250
|
+
if (node.test) { c(node.test, st, "Expression"); }
|
251
|
+
if (node.update) { c(node.update, st, "Expression"); }
|
252
|
+
c(node.body, st, "Statement");
|
253
|
+
};
|
254
|
+
base.ForInStatement = base.ForOfStatement = function (node, st, c) {
|
255
|
+
c(node.left, st, "ForInit");
|
256
|
+
c(node.right, st, "Expression");
|
257
|
+
c(node.body, st, "Statement");
|
258
|
+
};
|
259
|
+
base.ForInit = function (node, st, c) {
|
260
|
+
if (node.type == "VariableDeclaration") { c(node, st); }
|
261
|
+
else { c(node, st, "Expression"); }
|
262
|
+
};
|
263
|
+
base.DebuggerStatement = ignore;
|
264
|
+
|
265
|
+
base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
|
266
|
+
base.VariableDeclaration = function (node, st, c) {
|
267
|
+
for (var i = 0, list = node.declarations; i < list.length; i += 1)
|
268
|
+
{
|
269
|
+
var decl = list[i];
|
270
|
+
|
271
|
+
c(decl, st);
|
272
|
+
}
|
273
|
+
};
|
274
|
+
base.VariableDeclarator = function (node, st, c) {
|
275
|
+
c(node.id, st, "Pattern");
|
276
|
+
if (node.init) { c(node.init, st, "Expression"); }
|
277
|
+
};
|
278
|
+
|
279
|
+
base.Function = function (node, st, c) {
|
280
|
+
if (node.id) { c(node.id, st, "Pattern"); }
|
281
|
+
for (var i = 0, list = node.params; i < list.length; i += 1)
|
282
|
+
{
|
283
|
+
var param = list[i];
|
284
|
+
|
285
|
+
c(param, st, "Pattern");
|
286
|
+
}
|
287
|
+
c(node.body, st, node.expression ? "ScopeExpression" : "ScopeBody");
|
288
|
+
};
|
289
|
+
// FIXME drop these node types in next major version
|
290
|
+
// (They are awkward, and in ES6 every block can be a scope.)
|
291
|
+
base.ScopeBody = function (node, st, c) { return c(node, st, "Statement"); };
|
292
|
+
base.ScopeExpression = function (node, st, c) { return c(node, st, "Expression"); };
|
293
|
+
|
294
|
+
base.Pattern = function (node, st, c) {
|
295
|
+
if (node.type == "Identifier")
|
296
|
+
{ c(node, st, "VariablePattern"); }
|
297
|
+
else if (node.type == "MemberExpression")
|
298
|
+
{ c(node, st, "MemberPattern"); }
|
299
|
+
else
|
300
|
+
{ c(node, st); }
|
301
|
+
};
|
302
|
+
base.VariablePattern = ignore;
|
303
|
+
base.MemberPattern = skipThrough;
|
304
|
+
base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
|
305
|
+
base.ArrayPattern = function (node, st, c) {
|
306
|
+
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
307
|
+
var elt = list[i];
|
308
|
+
|
309
|
+
if (elt) { c(elt, st, "Pattern"); }
|
310
|
+
}
|
311
|
+
};
|
312
|
+
base.ObjectPattern = function (node, st, c) {
|
313
|
+
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
314
|
+
var prop = list[i];
|
315
|
+
|
316
|
+
if (prop.computed) { c(prop.key, st, "Expression"); }
|
317
|
+
c(prop.value, st, "Pattern");
|
318
|
+
}
|
319
|
+
};
|
320
|
+
|
321
|
+
base.Expression = skipThrough;
|
322
|
+
base.ThisExpression = base.Super = base.MetaProperty = ignore;
|
323
|
+
base.ArrayExpression = function (node, st, c) {
|
324
|
+
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
325
|
+
var elt = list[i];
|
326
|
+
|
327
|
+
if (elt) { c(elt, st, "Expression"); }
|
328
|
+
}
|
329
|
+
};
|
330
|
+
base.ObjectExpression = function (node, st, c) {
|
331
|
+
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
332
|
+
{
|
333
|
+
var prop = list[i];
|
334
|
+
|
335
|
+
c(prop, st);
|
336
|
+
}
|
337
|
+
};
|
338
|
+
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
|
339
|
+
base.SequenceExpression = base.TemplateLiteral = function (node, st, c) {
|
340
|
+
for (var i = 0, list = node.expressions; i < list.length; i += 1)
|
341
|
+
{
|
342
|
+
var expr = list[i];
|
343
|
+
|
344
|
+
c(expr, st, "Expression");
|
345
|
+
}
|
346
|
+
};
|
347
|
+
base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
|
348
|
+
c(node.argument, st, "Expression");
|
349
|
+
};
|
350
|
+
base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
|
351
|
+
c(node.left, st, "Expression");
|
352
|
+
c(node.right, st, "Expression");
|
353
|
+
};
|
354
|
+
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
|
355
|
+
c(node.left, st, "Pattern");
|
356
|
+
c(node.right, st, "Expression");
|
357
|
+
};
|
358
|
+
base.ConditionalExpression = function (node, st, c) {
|
359
|
+
c(node.test, st, "Expression");
|
360
|
+
c(node.consequent, st, "Expression");
|
361
|
+
c(node.alternate, st, "Expression");
|
362
|
+
};
|
363
|
+
base.NewExpression = base.CallExpression = function (node, st, c) {
|
364
|
+
c(node.callee, st, "Expression");
|
365
|
+
if (node.arguments)
|
366
|
+
{ for (var i = 0, list = node.arguments; i < list.length; i += 1)
|
367
|
+
{
|
368
|
+
var arg = list[i];
|
369
|
+
|
370
|
+
c(arg, st, "Expression");
|
371
|
+
} }
|
372
|
+
};
|
373
|
+
base.MemberExpression = function (node, st, c) {
|
374
|
+
c(node.object, st, "Expression");
|
375
|
+
if (node.computed) { c(node.property, st, "Expression"); }
|
376
|
+
};
|
377
|
+
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
|
378
|
+
if (node.declaration)
|
379
|
+
{ c(node.declaration, st, node.type == "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
|
380
|
+
if (node.source) { c(node.source, st, "Expression"); }
|
381
|
+
};
|
382
|
+
base.ExportAllDeclaration = function (node, st, c) {
|
383
|
+
c(node.source, st, "Expression");
|
384
|
+
};
|
385
|
+
base.ImportDeclaration = function (node, st, c) {
|
386
|
+
for (var i = 0, list = node.specifiers; i < list.length; i += 1)
|
387
|
+
{
|
388
|
+
var spec = list[i];
|
389
|
+
|
390
|
+
c(spec, st);
|
391
|
+
}
|
392
|
+
c(node.source, st, "Expression");
|
393
|
+
};
|
394
|
+
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
|
395
|
+
|
396
|
+
base.TaggedTemplateExpression = function (node, st, c) {
|
397
|
+
c(node.tag, st, "Expression");
|
398
|
+
c(node.quasi, st, "Expression");
|
399
|
+
};
|
400
|
+
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
|
401
|
+
base.Class = function (node, st, c) {
|
402
|
+
if (node.id) { c(node.id, st, "Pattern"); }
|
403
|
+
if (node.superClass) { c(node.superClass, st, "Expression"); }
|
404
|
+
c(node.body, st);
|
405
|
+
};
|
406
|
+
base.ClassBody = function (node, st, c) {
|
407
|
+
for (var i = 0, list = node.body; i < list.length; i += 1)
|
408
|
+
{
|
409
|
+
var elt = list[i];
|
410
|
+
|
411
|
+
c(elt, st);
|
412
|
+
}
|
413
|
+
};
|
414
|
+
base.MethodDefinition = base.Property = function (node, st, c) {
|
415
|
+
if (node.computed) { c(node.key, st, "Expression"); }
|
416
|
+
c(node.value, st, "Expression");
|
417
|
+
};
|
418
|
+
|
419
|
+
export { simple, ancestor, recursive, full, fullAncestor, findNodeAt, findNodeAround, findNodeAfter, findNodeBefore, make, base };
|
@@ -0,0 +1,439 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
4
|
+
(factory((global.acorn = global.acorn || {}, global.acorn.walk = {})));
|
5
|
+
}(this, (function (exports) { 'use strict';
|
6
|
+
|
7
|
+
// AST walker module for Mozilla Parser API compatible trees
|
8
|
+
|
9
|
+
// A simple walk is one where you simply specify callbacks to be
|
10
|
+
// called on specific nodes. The last two arguments are optional. A
|
11
|
+
// simple use would be
|
12
|
+
//
|
13
|
+
// walk.simple(myTree, {
|
14
|
+
// Expression: function(node) { ... }
|
15
|
+
// });
|
16
|
+
//
|
17
|
+
// to do something with all expressions. All Parser API node types
|
18
|
+
// can be used to identify node types, as well as Expression,
|
19
|
+
// Statement, and ScopeBody, which denote categories of nodes.
|
20
|
+
//
|
21
|
+
// The base argument can be used to pass a custom (recursive)
|
22
|
+
// walker, and state can be used to give this walked an initial
|
23
|
+
// state.
|
24
|
+
|
25
|
+
function simple(node, visitors, base, state, override) {
|
26
|
+
if (!base) { base = exports.base
|
27
|
+
; }(function c(node, st, override) {
|
28
|
+
var type = override || node.type, found = visitors[type];
|
29
|
+
base[type](node, st, c);
|
30
|
+
if (found) { found(node, st); }
|
31
|
+
})(node, state, override);
|
32
|
+
}
|
33
|
+
|
34
|
+
// An ancestor walk keeps an array of ancestor nodes (including the
|
35
|
+
// current node) and passes them to the callback as third parameter
|
36
|
+
// (and also as state parameter when no other state is present).
|
37
|
+
function ancestor(node, visitors, base, state) {
|
38
|
+
if (!base) { base = exports.base; }
|
39
|
+
var ancestors = [];(function c(node, st, override) {
|
40
|
+
var type = override || node.type, found = visitors[type];
|
41
|
+
var isNew = node != ancestors[ancestors.length - 1];
|
42
|
+
if (isNew) { ancestors.push(node); }
|
43
|
+
base[type](node, st, c);
|
44
|
+
if (found) { found(node, st || ancestors, ancestors); }
|
45
|
+
if (isNew) { ancestors.pop(); }
|
46
|
+
})(node, state);
|
47
|
+
}
|
48
|
+
|
49
|
+
// A recursive walk is one where your functions override the default
|
50
|
+
// walkers. They can modify and replace the state parameter that's
|
51
|
+
// threaded through the walk, and can opt how and whether to walk
|
52
|
+
// their child nodes (by calling their third argument on these
|
53
|
+
// nodes).
|
54
|
+
function recursive(node, state, funcs, base, override) {
|
55
|
+
var visitor = funcs ? exports.make(funcs, base) : base;(function c(node, st, override) {
|
56
|
+
visitor[override || node.type](node, st, c);
|
57
|
+
})(node, state, override);
|
58
|
+
}
|
59
|
+
|
60
|
+
function makeTest(test) {
|
61
|
+
if (typeof test == "string")
|
62
|
+
{ return function (type) { return type == test; } }
|
63
|
+
else if (!test)
|
64
|
+
{ return function () { return true; } }
|
65
|
+
else
|
66
|
+
{ return test }
|
67
|
+
}
|
68
|
+
|
69
|
+
var Found = function Found(node, state) { this.node = node; this.state = state; };
|
70
|
+
|
71
|
+
// A full walk triggers the callback on each node
|
72
|
+
function full(node, callback, base, state, override) {
|
73
|
+
if (!base) { base = exports.base
|
74
|
+
; }(function c(node, st, override) {
|
75
|
+
var type = override || node.type;
|
76
|
+
base[type](node, st, c);
|
77
|
+
if (!override) { callback(node, st, type); }
|
78
|
+
})(node, state, override);
|
79
|
+
}
|
80
|
+
|
81
|
+
// An fullAncestor walk is like an ancestor walk, but triggers
|
82
|
+
// the callback on each node
|
83
|
+
function fullAncestor(node, callback, base, state) {
|
84
|
+
if (!base) { base = exports.base; }
|
85
|
+
var ancestors = [];(function c(node, st, override) {
|
86
|
+
var type = override || node.type;
|
87
|
+
var isNew = node != ancestors[ancestors.length - 1];
|
88
|
+
if (isNew) { ancestors.push(node); }
|
89
|
+
base[type](node, st, c);
|
90
|
+
if (!override) { callback(node, st || ancestors, ancestors, type); }
|
91
|
+
if (isNew) { ancestors.pop(); }
|
92
|
+
})(node, state);
|
93
|
+
}
|
94
|
+
|
95
|
+
// Find a node with a given start, end, and type (all are optional,
|
96
|
+
// null can be used as wildcard). Returns a {node, state} object, or
|
97
|
+
// undefined when it doesn't find a matching node.
|
98
|
+
function findNodeAt(node, start, end, test, base, state) {
|
99
|
+
test = makeTest(test);
|
100
|
+
if (!base) { base = exports.base; }
|
101
|
+
try {
|
102
|
+
(function c(node, st, override) {
|
103
|
+
var type = override || node.type;
|
104
|
+
if ((start == null || node.start <= start) &&
|
105
|
+
(end == null || node.end >= end))
|
106
|
+
{ base[type](node, st, c); }
|
107
|
+
if ((start == null || node.start == start) &&
|
108
|
+
(end == null || node.end == end) &&
|
109
|
+
test(type, node))
|
110
|
+
{ throw new Found(node, st) }
|
111
|
+
})(node, state);
|
112
|
+
} catch (e) {
|
113
|
+
if (e instanceof Found) { return e }
|
114
|
+
throw e
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
// Find the innermost node of a given type that contains the given
|
119
|
+
// position. Interface similar to findNodeAt.
|
120
|
+
function findNodeAround(node, pos, test, base, state) {
|
121
|
+
test = makeTest(test);
|
122
|
+
if (!base) { base = exports.base; }
|
123
|
+
try {
|
124
|
+
(function c(node, st, override) {
|
125
|
+
var type = override || node.type;
|
126
|
+
if (node.start > pos || node.end < pos) { return }
|
127
|
+
base[type](node, st, c);
|
128
|
+
if (test(type, node)) { throw new Found(node, st) }
|
129
|
+
})(node, state);
|
130
|
+
} catch (e) {
|
131
|
+
if (e instanceof Found) { return e }
|
132
|
+
throw e
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
// Find the outermost matching node after a given position.
|
137
|
+
function findNodeAfter(node, pos, test, base, state) {
|
138
|
+
test = makeTest(test);
|
139
|
+
if (!base) { base = exports.base; }
|
140
|
+
try {
|
141
|
+
(function c(node, st, override) {
|
142
|
+
if (node.end < pos) { return }
|
143
|
+
var type = override || node.type;
|
144
|
+
if (node.start >= pos && test(type, node)) { throw new Found(node, st) }
|
145
|
+
base[type](node, st, c);
|
146
|
+
})(node, state);
|
147
|
+
} catch (e) {
|
148
|
+
if (e instanceof Found) { return e }
|
149
|
+
throw e
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
// Find the outermost matching node before a given position.
|
154
|
+
function findNodeBefore(node, pos, test, base, state) {
|
155
|
+
test = makeTest(test);
|
156
|
+
if (!base) { base = exports.base; }
|
157
|
+
var max;(function c(node, st, override) {
|
158
|
+
if (node.start > pos) { return }
|
159
|
+
var type = override || node.type;
|
160
|
+
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
|
161
|
+
{ max = new Found(node, st); }
|
162
|
+
base[type](node, st, c);
|
163
|
+
})(node, state);
|
164
|
+
return max
|
165
|
+
}
|
166
|
+
|
167
|
+
// Fallback to an Object.create polyfill for older environments.
|
168
|
+
var create = Object.create || function(proto) {
|
169
|
+
function Ctor() {}
|
170
|
+
Ctor.prototype = proto;
|
171
|
+
return new Ctor
|
172
|
+
};
|
173
|
+
|
174
|
+
// Used to create a custom walker. Will fill in all missing node
|
175
|
+
// type properties with the defaults.
|
176
|
+
function make(funcs, base) {
|
177
|
+
if (!base) { base = exports.base; }
|
178
|
+
var visitor = create(base);
|
179
|
+
for (var type in funcs) { visitor[type] = funcs[type]; }
|
180
|
+
return visitor
|
181
|
+
}
|
182
|
+
|
183
|
+
function skipThrough(node, st, c) { c(node, st); }
|
184
|
+
function ignore(_node, _st, _c) {}
|
185
|
+
|
186
|
+
// Node walkers.
|
187
|
+
|
188
|
+
var base = {};
|
189
|
+
|
190
|
+
base.Program = base.BlockStatement = function (node, st, c) {
|
191
|
+
for (var i = 0, list = node.body; i < list.length; i += 1)
|
192
|
+
{
|
193
|
+
var stmt = list[i];
|
194
|
+
|
195
|
+
c(stmt, st, "Statement");
|
196
|
+
}
|
197
|
+
};
|
198
|
+
base.Statement = skipThrough;
|
199
|
+
base.EmptyStatement = ignore;
|
200
|
+
base.ExpressionStatement = base.ParenthesizedExpression =
|
201
|
+
function (node, st, c) { return c(node.expression, st, "Expression"); };
|
202
|
+
base.IfStatement = function (node, st, c) {
|
203
|
+
c(node.test, st, "Expression");
|
204
|
+
c(node.consequent, st, "Statement");
|
205
|
+
if (node.alternate) { c(node.alternate, st, "Statement"); }
|
206
|
+
};
|
207
|
+
base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
|
208
|
+
base.BreakStatement = base.ContinueStatement = ignore;
|
209
|
+
base.WithStatement = function (node, st, c) {
|
210
|
+
c(node.object, st, "Expression");
|
211
|
+
c(node.body, st, "Statement");
|
212
|
+
};
|
213
|
+
base.SwitchStatement = function (node, st, c) {
|
214
|
+
c(node.discriminant, st, "Expression");
|
215
|
+
for (var i = 0, list = node.cases; i < list.length; i += 1) {
|
216
|
+
var cs = list[i];
|
217
|
+
|
218
|
+
if (cs.test) { c(cs.test, st, "Expression"); }
|
219
|
+
for (var i$1 = 0, list$1 = cs.consequent; i$1 < list$1.length; i$1 += 1)
|
220
|
+
{
|
221
|
+
var cons = list$1[i$1];
|
222
|
+
|
223
|
+
c(cons, st, "Statement");
|
224
|
+
}
|
225
|
+
}
|
226
|
+
};
|
227
|
+
base.SwitchCase = function (node, st, c) {
|
228
|
+
if (node.test) { c(node.test, st, "Expression"); }
|
229
|
+
for (var i = 0, list = node.consequent; i < list.length; i += 1)
|
230
|
+
{
|
231
|
+
var cons = list[i];
|
232
|
+
|
233
|
+
c(cons, st, "Statement");
|
234
|
+
}
|
235
|
+
};
|
236
|
+
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
|
237
|
+
if (node.argument) { c(node.argument, st, "Expression"); }
|
238
|
+
};
|
239
|
+
base.ThrowStatement = base.SpreadElement =
|
240
|
+
function (node, st, c) { return c(node.argument, st, "Expression"); };
|
241
|
+
base.TryStatement = function (node, st, c) {
|
242
|
+
c(node.block, st, "Statement");
|
243
|
+
if (node.handler) { c(node.handler, st); }
|
244
|
+
if (node.finalizer) { c(node.finalizer, st, "Statement"); }
|
245
|
+
};
|
246
|
+
base.CatchClause = function (node, st, c) {
|
247
|
+
c(node.param, st, "Pattern");
|
248
|
+
c(node.body, st, "ScopeBody");
|
249
|
+
};
|
250
|
+
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
|
251
|
+
c(node.test, st, "Expression");
|
252
|
+
c(node.body, st, "Statement");
|
253
|
+
};
|
254
|
+
base.ForStatement = function (node, st, c) {
|
255
|
+
if (node.init) { c(node.init, st, "ForInit"); }
|
256
|
+
if (node.test) { c(node.test, st, "Expression"); }
|
257
|
+
if (node.update) { c(node.update, st, "Expression"); }
|
258
|
+
c(node.body, st, "Statement");
|
259
|
+
};
|
260
|
+
base.ForInStatement = base.ForOfStatement = function (node, st, c) {
|
261
|
+
c(node.left, st, "ForInit");
|
262
|
+
c(node.right, st, "Expression");
|
263
|
+
c(node.body, st, "Statement");
|
264
|
+
};
|
265
|
+
base.ForInit = function (node, st, c) {
|
266
|
+
if (node.type == "VariableDeclaration") { c(node, st); }
|
267
|
+
else { c(node, st, "Expression"); }
|
268
|
+
};
|
269
|
+
base.DebuggerStatement = ignore;
|
270
|
+
|
271
|
+
base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
|
272
|
+
base.VariableDeclaration = function (node, st, c) {
|
273
|
+
for (var i = 0, list = node.declarations; i < list.length; i += 1)
|
274
|
+
{
|
275
|
+
var decl = list[i];
|
276
|
+
|
277
|
+
c(decl, st);
|
278
|
+
}
|
279
|
+
};
|
280
|
+
base.VariableDeclarator = function (node, st, c) {
|
281
|
+
c(node.id, st, "Pattern");
|
282
|
+
if (node.init) { c(node.init, st, "Expression"); }
|
283
|
+
};
|
284
|
+
|
285
|
+
base.Function = function (node, st, c) {
|
286
|
+
if (node.id) { c(node.id, st, "Pattern"); }
|
287
|
+
for (var i = 0, list = node.params; i < list.length; i += 1)
|
288
|
+
{
|
289
|
+
var param = list[i];
|
290
|
+
|
291
|
+
c(param, st, "Pattern");
|
292
|
+
}
|
293
|
+
c(node.body, st, node.expression ? "ScopeExpression" : "ScopeBody");
|
294
|
+
};
|
295
|
+
// FIXME drop these node types in next major version
|
296
|
+
// (They are awkward, and in ES6 every block can be a scope.)
|
297
|
+
base.ScopeBody = function (node, st, c) { return c(node, st, "Statement"); };
|
298
|
+
base.ScopeExpression = function (node, st, c) { return c(node, st, "Expression"); };
|
299
|
+
|
300
|
+
base.Pattern = function (node, st, c) {
|
301
|
+
if (node.type == "Identifier")
|
302
|
+
{ c(node, st, "VariablePattern"); }
|
303
|
+
else if (node.type == "MemberExpression")
|
304
|
+
{ c(node, st, "MemberPattern"); }
|
305
|
+
else
|
306
|
+
{ c(node, st); }
|
307
|
+
};
|
308
|
+
base.VariablePattern = ignore;
|
309
|
+
base.MemberPattern = skipThrough;
|
310
|
+
base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
|
311
|
+
base.ArrayPattern = function (node, st, c) {
|
312
|
+
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
313
|
+
var elt = list[i];
|
314
|
+
|
315
|
+
if (elt) { c(elt, st, "Pattern"); }
|
316
|
+
}
|
317
|
+
};
|
318
|
+
base.ObjectPattern = function (node, st, c) {
|
319
|
+
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
320
|
+
var prop = list[i];
|
321
|
+
|
322
|
+
if (prop.computed) { c(prop.key, st, "Expression"); }
|
323
|
+
c(prop.value, st, "Pattern");
|
324
|
+
}
|
325
|
+
};
|
326
|
+
|
327
|
+
base.Expression = skipThrough;
|
328
|
+
base.ThisExpression = base.Super = base.MetaProperty = ignore;
|
329
|
+
base.ArrayExpression = function (node, st, c) {
|
330
|
+
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
331
|
+
var elt = list[i];
|
332
|
+
|
333
|
+
if (elt) { c(elt, st, "Expression"); }
|
334
|
+
}
|
335
|
+
};
|
336
|
+
base.ObjectExpression = function (node, st, c) {
|
337
|
+
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
338
|
+
{
|
339
|
+
var prop = list[i];
|
340
|
+
|
341
|
+
c(prop, st);
|
342
|
+
}
|
343
|
+
};
|
344
|
+
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
|
345
|
+
base.SequenceExpression = base.TemplateLiteral = function (node, st, c) {
|
346
|
+
for (var i = 0, list = node.expressions; i < list.length; i += 1)
|
347
|
+
{
|
348
|
+
var expr = list[i];
|
349
|
+
|
350
|
+
c(expr, st, "Expression");
|
351
|
+
}
|
352
|
+
};
|
353
|
+
base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
|
354
|
+
c(node.argument, st, "Expression");
|
355
|
+
};
|
356
|
+
base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
|
357
|
+
c(node.left, st, "Expression");
|
358
|
+
c(node.right, st, "Expression");
|
359
|
+
};
|
360
|
+
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
|
361
|
+
c(node.left, st, "Pattern");
|
362
|
+
c(node.right, st, "Expression");
|
363
|
+
};
|
364
|
+
base.ConditionalExpression = function (node, st, c) {
|
365
|
+
c(node.test, st, "Expression");
|
366
|
+
c(node.consequent, st, "Expression");
|
367
|
+
c(node.alternate, st, "Expression");
|
368
|
+
};
|
369
|
+
base.NewExpression = base.CallExpression = function (node, st, c) {
|
370
|
+
c(node.callee, st, "Expression");
|
371
|
+
if (node.arguments)
|
372
|
+
{ for (var i = 0, list = node.arguments; i < list.length; i += 1)
|
373
|
+
{
|
374
|
+
var arg = list[i];
|
375
|
+
|
376
|
+
c(arg, st, "Expression");
|
377
|
+
} }
|
378
|
+
};
|
379
|
+
base.MemberExpression = function (node, st, c) {
|
380
|
+
c(node.object, st, "Expression");
|
381
|
+
if (node.computed) { c(node.property, st, "Expression"); }
|
382
|
+
};
|
383
|
+
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
|
384
|
+
if (node.declaration)
|
385
|
+
{ c(node.declaration, st, node.type == "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
|
386
|
+
if (node.source) { c(node.source, st, "Expression"); }
|
387
|
+
};
|
388
|
+
base.ExportAllDeclaration = function (node, st, c) {
|
389
|
+
c(node.source, st, "Expression");
|
390
|
+
};
|
391
|
+
base.ImportDeclaration = function (node, st, c) {
|
392
|
+
for (var i = 0, list = node.specifiers; i < list.length; i += 1)
|
393
|
+
{
|
394
|
+
var spec = list[i];
|
395
|
+
|
396
|
+
c(spec, st);
|
397
|
+
}
|
398
|
+
c(node.source, st, "Expression");
|
399
|
+
};
|
400
|
+
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
|
401
|
+
|
402
|
+
base.TaggedTemplateExpression = function (node, st, c) {
|
403
|
+
c(node.tag, st, "Expression");
|
404
|
+
c(node.quasi, st, "Expression");
|
405
|
+
};
|
406
|
+
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
|
407
|
+
base.Class = function (node, st, c) {
|
408
|
+
if (node.id) { c(node.id, st, "Pattern"); }
|
409
|
+
if (node.superClass) { c(node.superClass, st, "Expression"); }
|
410
|
+
c(node.body, st);
|
411
|
+
};
|
412
|
+
base.ClassBody = function (node, st, c) {
|
413
|
+
for (var i = 0, list = node.body; i < list.length; i += 1)
|
414
|
+
{
|
415
|
+
var elt = list[i];
|
416
|
+
|
417
|
+
c(elt, st);
|
418
|
+
}
|
419
|
+
};
|
420
|
+
base.MethodDefinition = base.Property = function (node, st, c) {
|
421
|
+
if (node.computed) { c(node.key, st, "Expression"); }
|
422
|
+
c(node.value, st, "Expression");
|
423
|
+
};
|
424
|
+
|
425
|
+
exports.simple = simple;
|
426
|
+
exports.ancestor = ancestor;
|
427
|
+
exports.recursive = recursive;
|
428
|
+
exports.full = full;
|
429
|
+
exports.fullAncestor = fullAncestor;
|
430
|
+
exports.findNodeAt = findNodeAt;
|
431
|
+
exports.findNodeAround = findNodeAround;
|
432
|
+
exports.findNodeAfter = findNodeAfter;
|
433
|
+
exports.findNodeBefore = findNodeBefore;
|
434
|
+
exports.make = make;
|
435
|
+
exports.base = base;
|
436
|
+
|
437
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
438
|
+
|
439
|
+
})));
|