Comments (7)
Actually, it looks like https://github.com/dart-lang/vm_service_drivers already has a parser for the markdown file, and we could likely just add serialization logic to that generator and use that package instead of maintaining our own yaml file.
from webdev.
Example yaml file for all the models up to and including the Event
type:
classes:
BoundField:
fields:
decl:
type: '@Field'
value:
type: '@Instance|Sentinel'
BoundVariable:
fields:
name:
type: string
value:
type: '@Instance|@TypeArguments|Sentinel'
declarationTokenPos:
type: int
scopeStartTokenPos:
type: int
scopeEndTokenPos:
type: int
Breakpoint:
extends: Object
fields:
breakpointNumber:
type: int
resolved:
type: bool
isSyntheticAsyncContinuation:
type: bool
optional: true
location:
type: SourceLocation|UnresolvedSourceLocation
'@Class':
extends: '@Object'
fields:
name:
type: string
Class:
extends: Object
fields:
name:
type: string
error:
type: '@Error'
optional: true
abstract:
type: bool
const:
type: bool
library:
type: '@Library'
location:
type: SourceLocation
optional: true
super:
type: '@Class'
optional: true
superType:
type: '@Instance'
optional: true
interfaces:
type: '@Instance[]'
mixin:
type: '@Instance'
optional: true
fields:
type: '@Field[]'
functions:
type: '@Function[]'
subclasses:
type: '@Class[]'
ClassList:
extends: Response
fields:
classes: '@Class[]'
'@Code':
extends: '@Object'
fields:
name:
type: string
kind:
type: CodeKind
Code:
extends: '@Object'
fields:
name:
type: string
kind:
type: CodeKind
'@Context':
extends: '@Object'
fields:
length:
type: int
Context:
extends: Object
fields:
length:
type: int
parent:
type: Context
optional: true
variables:
type: 'ContextElement[]'
ContextElement:
fields:
value:
type: '@Instance|Sentinel'
'@Error':
extends: '@Object'
fields:
kind:
type: ErrorKind
message:
type: string
Error:
extends: Object
fields:
kind:
type: ErrorKind
message:
type: string
exception:
type: '@Instance'
optional: true
stacktrace:
type: '@Instance'
optional: true
Event:
extends: Response
fields:
kind:
type: EventKind
isolate:
type: '@Isolate'
optional: true
vm:
type: '@VM'
optional: true
timestamp:
type: int
breakpoint:
type: Breakpoint
optional: true
pauseBreakpoints:
type: Breakpoint[]
optional: true
topFrame:
type: Frame
optional: true
exception:
type: '@Instance'
optional: true
bytes:
type: string
optional: true
inspectee:
type: '@Instance'
optional: true
extensionRPC:
type: string
optional: true
extensionKind:
type: string
optional: true
extensionData:
type: ExtensionData
optional: true
timelineEvents:
type: TimelineEvent[]
optional: true
atAsyncSuspension:
type: bool
optional: true
status:
type: String
optional: true
enums:
CodeKind:
- Dart
- Native
- Stub
- Tag
- Collected
ErrorKind:
- UnhandledException
- LanguageError
- InternalError
- TerminationError
from webdev.
When we say "extends" here does that translate to an extends
in the generated Dart code? That precludes generating correct equals
implementations if subclasses add fields...
from webdev.
When we say "extends" here does that translate to an
extends
in the generated Dart code?
Yes
That precludes generating correct
equals
implementations if subclasses add fields...
how so? also i don't think this is a requirement for us in any case (I wasn't planning on implementing equals or hashCode)
from webdev.
fwiw, it seems like you can do:
bool operator==(other) => other is ThisType && other.someField == someField && super == other;
a bit bizarre, but it appears to work
from webdev.
how so?
In Dart (as in many other OO languages) you cannot use extends
with an instantiable super class and implement operator==
on both that follows the contract and the Liskov Substitution Principle.
The docs say that the operator must be symmetric.
If the implementation of SuperType.operator==
checks other is SuperType
, and the SubType.operator==
checks other is SubType
, then this property is not held.
var a = SuperType();
var b = SubType();
a == b; // true, b is SuperType holds
b == a; // false, a is SubType does not hold
If you try to get around this problem by using other.runtimeType == SuperType
then you can fix the symmetry, but fail Liskov Substitution because an instance of SubType
is no longer indistinguishable from a SuperType
when used as such.
I think you can get around the problem if you ignore the extra fields in SubType
when it comes to equality, but that ends up being a pretty lame implementation.
You can also get around the problem if only the leaf classes are instantiable and the super types are abstract
.
from webdev.
Ah ya good point, we can just ignore equals for now.
from webdev.
Related Issues (20)
- Support running the `reload_test` with the `FrontendServer`
- Exceptions in Dart web apps pause with "PauseInterrupted" instead of "PauseException"
- Pause on Exceptions in Dart web apps jumps to the wrong location
- When debugging a webdev app from VS Code, hitting a breakpoint opens copy of actual file HOT 2
- Problems debugging `static` members
- [dwds] ext.flutter.debugDumpApp: (-32603) Unexpected DWDS error for callServiceExtension: Unexpected error from chrome devtools
- after upgrading to flutter 3.19.3 , I am getting the error below when I try to build and run on web. HOT 2
- Messaging has changed if pubspec yaml file not found by pub
- Test checking for DEBUGGER_READY and DEVTOOLS_LOAD events failing
- Breakpoints fail to work in Flutter web when macro experiment is enabled HOT 5
- `yieldControlToDDS` should disconnect non-DDS clients
- `dart:developer` `log` messages still get truncated in the middle HOT 1
- `webdev` integration test has begun failing with `pub` error
- Prevent stack trace calculation from being halted if any of the frames throws an error
- `.callServiceExtension` test failing for WebDev HOT 1
- Flutter Web Application UI Components Not Rendering in Chrome. HOT 3
- Vite proxied `flutter run -d chrome` does not respond with RunRequest HOT 1
- Remove unsound null safety options
- [documentation] documentation on how to compile dart to js for a non-web target with webdev build HOT 1
- Can't load debug build over https (upgrade websocket to secure) 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 webdev.