Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

&& can't be calculated at compile time #2946

Copy link
Copy link
@maizi20

Description

@maizi20
Issue body actions

Bug description

&& can't be calculated at compile time, but ?: can.

Steps to reproduce

input assemblyscript:

class A{
  foo!:i32
  bar!:i32
}
export const compiletime=offsetof<A>('foo')==0?offsetof<A>('bar')==4:0
export const runtime=offsetof<A>('foo')==0&&offsetof<A>('bar')==4

output wat:

(module
 (type $0 (func))
 (global $example/compiletime i32 (i32.const 1))
 (global $example/runtime (mut i32) (i32.const 0))
 (memory $0 0)
 (table $0 1 1 funcref)
 (elem $0 (i32.const 1))
 (export "compiletime" (global $example/compiletime))
 (export "runtime" (global $example/runtime))
 (export "memory" (memory $0))
 (start $~start)
 (func $start:example
  (local $0 i32)
  i32.const 0
  i32.const 0
  i32.eq
  local.tee $0
  if (result i32)
   i32.const 4
   i32.const 4
   i32.eq
  else
   local.get $0
  end
  i32.const 0
  i32.ne
  global.set $example/runtime
 )
 (func $~start
  call $start:example
 )
)

AssemblyScript version

0.27.37

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.