-
Notifications
You must be signed in to change notification settings - Fork 34
[interop] Add Support for Anonymous Declarations #434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
1c76d12
d79c2cf
38b3aab
cb90943
37e0d1a
0b943e7
e7535a4
c49ce6c
f1a9e1c
7f0a2e0
f57165c
49aa015
574250f
283ab5d
4a9bca6
78a535f
5421359
f92ffc9
9944b7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,19 +22,14 @@ class BuiltinType extends Type { | |
final bool fromDartJSInterop; | ||
|
||
@override | ||
nikeokoronkwo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
bool get isNullable => _isNullable ?? false; | ||
|
||
final bool? _isNullable; | ||
|
||
@override | ||
set isNullable(bool isNullable) {} | ||
bool isNullable; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we not make this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can, but it isn't guaranteed to be set. It is only set if /// isNullable can be null
Type _transformType(TSTypeNode type,
{bool parameter = false, bool typeArg = false, bool? isNullable}) {
// code
} |
||
|
||
BuiltinType( | ||
{required this.name, | ||
this.typeParams = const [], | ||
this.fromDartJSInterop = false, | ||
bool? isNullable}) | ||
: _isNullable = isNullable; | ||
: isNullable = isNullable ?? false; | ||
|
||
@override | ||
ID get id => ID(type: 'type', name: name); | ||
|
@@ -51,7 +46,7 @@ class BuiltinType extends Type { | |
.where((p) => typeParams.length != 1 || p != $voidType) | ||
.map((p) => p.emit(options))) | ||
..url = fromDartJSInterop ? 'dart:js_interop' : null | ||
..isNullable = _isNullable ?? options?.nullable); | ||
..isNullable = isNullable || (options?.nullable ?? false)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In theory, |
||
} | ||
|
||
static final BuiltinType $voidType = BuiltinType(name: 'void'); | ||
|
@@ -141,12 +136,7 @@ class PackageWebType extends Type { | |
final List<Type> typeParams; | ||
|
||
@override | ||
bool get isNullable => _isNullable ?? false; | ||
|
||
final bool? _isNullable; | ||
|
||
@override | ||
set isNullable(bool isNullable) {} | ||
bool isNullable; | ||
|
||
@override | ||
ID get id => ID(type: 'type', name: name); | ||
|
@@ -155,8 +145,9 @@ class PackageWebType extends Type { | |
String? get dartName => null; | ||
|
||
PackageWebType._( | ||
{required this.name, this.typeParams = const [], bool? isNullable}) | ||
: _isNullable = isNullable; | ||
{required this.name, | ||
this.typeParams = const [], | ||
this.isNullable = false}); | ||
|
||
@override | ||
Reference emit([TypeOptions? options]) { | ||
|
@@ -169,14 +160,14 @@ class PackageWebType extends Type { | |
.where((p) => typeParams.length != 1 || p != BuiltinType.$voidType) | ||
.map((p) => p.emit(options))) | ||
..url = 'package:web/web.dart' | ||
..isNullable = _isNullable ?? options?.nullable); | ||
..isNullable = isNullable || (options?.nullable ?? false)); | ||
} | ||
|
||
static PackageWebType parse(String name, | ||
{bool? isNullable, List<Type> typeParams = const []}) { | ||
return PackageWebType._( | ||
name: renameMap.containsKey(name) ? renameMap[name]! : name, | ||
isNullable: isNullable, | ||
isNullable: isNullable ?? false, | ||
typeParams: typeParams); | ||
} | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.