Coder Social home page Coder Social logo

binding is undefined sometimes about kataw HOT 6 CLOSED

kataw avatar kataw commented on June 18, 2024
binding is undefined sometimes

from kataw.

Comments (6)

KFlash avatar KFlash commented on June 18, 2024

can you do 'if x === undefined) x = null'

from kataw.

aladdin-add avatar aladdin-add commented on June 18, 2024

the answer is no. let's imagine an obj:

{binding: undefined} stringified to md => "{}" parsed to {}

as deepEqual({binding: undefined}, {}) returns false, the case is always failing.

from kataw.

KFlash avatar KFlash commented on June 18, 2024

so where actually does this 'undefined' come from? Can you give me a test case that trigger this? It seems to be "BindingElement" in the parser, and a bug

from kataw.

aladdin-add avatar aladdin-add commented on June 18, 2024

https://github.com/kataw/kataw/blob/main/test/__snapshot__/compiler/js/expressions/await/gen/with_strict_dirctive/var_asyncArrow_x003d_asyncx0028x002ex002ex002eawaitx0029_x003dx003e_x007bx007d_.md

from kataw.

KFlash avatar KFlash commented on June 18, 2024

Interesting. I can't find any undefined . This is the AST it output. No undefined to be found

{
  "kind": 196,
  "source": "'use strict'; var asyncArrow = async(...await) => {};",
  "filename": "",
  "scriptBody": {
      "kind": 197,
      "statements": [
          {
              "kind": 2097233,
              "expression": {
                  "kind": 4261583,
                  "text": "use strict",
                  "rawText": "use strict",
                  "flags": 16777216,
                  "intersects": false,
                  "transformFlags": 0,
                  "start": 0,
                  "end": 12
              },
              "flags": 0,
              "intersects": false,
              "transformFlags": 0,
              "start": 0,
              "end": 13
          },
          {
              "kind": 2097397,
              "declarationList": {
                  "kind": 244,
                  "declarations": [
                      {
                          "kind": 16627,
                          "binding": {
                              "kind": 131102,
                              "text": "asyncArrow",
                              "rawText": "asyncArrow",
                              "flags": 0,
                              "intersects": false,
                              "transformFlags": 1025,
                              "start": 17,
                              "end": 28
                          },
                          "exclamation": false,
                          "type": null,
                          "initializer": {
                              "kind": 81936,
                              "typeParameters": null,
                              "arrowParameters": {
                                  "kind": 81929,
                                  "elements": [
                                      {
                                          "kind": 16473,
                                          "ellipsis": false,
                                          "isOptional": false,
                                          "type": null,
                                          "initializer": null,
                                          "decorators": null,
                                          "accessModifier": null,
                                          "isReadOnly": false,
                                          "flags": 0,
                                          "intersects": false,
                                          "transformFlags": 1,
                                          "start": 37,
                                          "end": 46
                                      }
                                  ],
                                  "type": null,
                                  "accessModifier": null,
                                  "trailingComma": false,
                                  "flags": 0,
                                  "intersects": false,
                                  "transformFlags": 0,
                                  "start": 40,
                                  "end": 46
                              },
                              "contents": {
                                  "kind": 91,
                                  "functionStatementList": {
                                      "kind": 94,
                                      "statements": [],
                                      "multiline": false,
                                      "flags": 0,
                                      "intersects": false,
                                      "transformFlags": 0,
                                      "start": 51,
                                      "end": 51
                                  },
                                  "flags": 0,
                                  "intersects": false,
                                  "transformFlags": 0,
                                  "start": 49,
                                  "end": 52
                              },
                              "flags": 536870912,
                              "intersects": false,
                              "transformFlags": 0,
                              "start": 30,
                              "end": 52
                          },
                          "flags": 17,
                          "intersects": false,
                          "transformFlags": 0,
                          "start": 0,
                          "end": 52
                      }
                  ],
                  "flags": 0,
                  "intersects": false,
                  "transformFlags": 0,
                  "start": 17,
                  "end": 52
              },
              "flags": 0,
              "intersects": false,
              "transformFlags": 0,
              "start": 13,
              "end": 53
          }
      ],
      "transformFlags": 0,
      "flags": 0,
      "intersects": false,
      "start": 0,
      "end": 53
  },
  "jsx": false,
  "printable": true,
  "diagnostics": [],
  "incremental": false,
  "flags": 0,
  "intersects": false,
  "transformFlags": 0,
  "start": 0,
  "end": 53
}

from kataw.

aladdin-add avatar aladdin-add commented on June 18, 2024

as I mentioned above, undefined is not valid in JSON, so it will be ignored in the md file.

from kataw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.