How to use the assemblyscript.Node.createMethodDeclaration function in assemblyscript

To help you get started, we’ve selected a few assemblyscript examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github holochain / hdk-assemblyscript / transforms / decorator-deserializable.js View on Github external
entrySrc.statements.forEach(s => {
    if (
      s.kind === NodeKind.CLASSDECLARATION &&
      s.decorators &&
      s.decorators.length &&
      s.decorators.some(d => d.name.text === "deserializable")
    ) {
      const name = s.name.text
      const marshalCode = buildMarshal(name, deserializableClasses[name])
      console.log(marshalCode)
      const marshalStmt = parseStatements(entrySrc, marshalCode)[0]
      const method = Node.createMethodDeclaration(
        marshalStmt.name,
        null,
        marshalStmt.signature,
        marshalStmt.body,
        null,
        CommonFlags.STATIC,
        entrySrc.range  // TODO
      )
      // s.members.push(method)
      entrySrc.statements.push(marshalStmt)
    }
  })