Comments (8)
I'm not sure if AS supports typeof
yet.
from assemblyscript.
I'm not sure if AS supports
typeof
yet.
yes. typeof
will return a string of object type
from assemblyscript.
I'm not sure if AS supports
typeof
yet.
The problem is not even that, the problem is an error in the parser. Unfortunately, I didn’t check the typeof, but I saw that this have checks in tests https://github.com/AssemblyScript/assemblyscript/blob/main/tests/compiler/typeof.ts
from assemblyscript.
I have token a look about this issue. It is because parser handle alignof< typeof 1 > ();
as Identifier LessThan Expression GreaterThan NotFinishedFunctionExpression
.
It is hard to distinguish generic and lessThan and greaterThan operator without semantic analysis. But unfortunately, we will not do any semantic analysis in parser stage.
from assemblyscript.
typeof x
when used as a type is parsed separately and differently from typeof x
when used as an expression. For instance, typeof x()
, typeof (x)
, typeof x[a ? b : c]
, and so on are parser errors in TS.
I suspect that typeof
for types hasn't been implemented yet.
from assemblyscript.
The error you reported indicates the parser expected code like this, which is seen as (y < typeof x) > ((): i32 => 0)
, without the extra parentheses.
Edit: @HerrCai0907 beat me to it by 6 minutes and I didn't notice.
from assemblyscript.
Interesting thing is TS also have similar problem.
true<false>(true);
is valid but let a=true;a<false>(true);
is invalid.
from assemblyscript.
It is hard to distinguish generic and lessThan and greaterThan operator without semantic analysis.
Semantic analysis isn't necessary. TypeScript eagerly parses generics (which makes sense; practically no one would write a < typeof b
, let alone a < typeof b > () => ...
or a < typeof b > (c)
)
Interesting thing is TS also have similar problem.
You actually brought up what I typed above as I was typing it. 😆
Calling it a problem is a bit of an exaggeration, and true
is probably treated specially as a keyword, thereby causing that case to be valid. It's not a major issue, since true < false > (true)
is a generally useless expression.
from assemblyscript.
Related Issues (20)
- Getting ERR_MODULE_NOT_FOUND after recent PR, basic AssemblyScript example fails HOT 3
- incorrect variable resolving for class default initializer
- asc crash when use same name in class and namespace HOT 1
- missing diagnose for interface with initialized field
- compiler crash HOT 1
- Hello HOT 1
- AS supports WASMGC? HOT 6
- Blazor Web App (Server) .NET8.0 call Web API with MVC HOT 1
- Compiler failing at optimization step with a big .ts file HOT 13
- The results of arithmetic operations with u8 are not truncated to 8 bits, when assigned to f64 HOT 1
- Stale Memory Reads HOT 17
- I look at the source code and find that there is code related to wasmGC, will wasmGC be supported soon? HOT 1
- npx asinit .
- Support type alias as syntactic sugar for class HOT 4
- Incorrect overriden function call HOT 2
- `env` module isn't imported, using `moduleImports` and `--importMemory` together
- I hope compiling to native binary was added for AssemblyScript. HOT 1
- Loop and variable bug HOT 2
- as crash when try to alloc large data HOT 2
- crash when shifting BigInt HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from assemblyscript.