Skip to content

Conversation

@HerrCai0907
Copy link
Member

native code's internal path is ~lib/native.ts instead of ~lib.
However, it is more easier to check current source is same as static
_native field.

Fixes # .

Changes proposed in this pull request:


  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

native code's internal path is ~lib/native.ts instead of ~lib.
However, it is more easier to check current source is same as static
_native field.
Copy link
Member

@CountBleck CountBleck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source._native is lazily initialized. Maybe just fix the line to say LIBRARY_PREFIX + "native.ts" (what Source.native contains verbatim).

You could also do return this == Source.native but I think that defeats the purpose of both lazy-initializing and the optimization you were trying to make.

@HerrCai0907
Copy link
Member Author

Source._native is lazily initialized. Maybe just fix the line to say LIBRARY_PREFIX + "native.ts" (what Source.native contains verbatim).

lazy init is ok. When Source._native is null, it will always return false. which is also correct since native source is never created.

@CountBleck
Copy link
Member

Silly me

@HerrCai0907 HerrCai0907 merged commit 5a125c7 into AssemblyScript:main Dec 27, 2025
14 checks passed
@HerrCai0907 HerrCai0907 deleted the fix/native-check branch December 28, 2025 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants