mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
Change getters/setters to native for nnbd
NNBD fields that were non-nullable or final were transformed to getters so that they were compilable. They need to be transformed to natives now for performance. Change-Id: Ice0082f9468c542098a6d12083a826438d15eba4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135860 Reviewed-by: Stephen Adams <sra@google.com>
This commit is contained in:
parent
e797a066dc
commit
3ec6ec2a2d
File diff suppressed because it is too large
Load diff
|
@ -244,19 +244,19 @@ class Cursor extends Interceptor {
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
String get direction => JS("String", "#.direction", this);
|
||||
String get direction native;
|
||||
|
||||
@_annotation_Creates_IDBKey
|
||||
@_annotation_Returns_IDBKey
|
||||
Object? get key => JS("Object", "#.key", this);
|
||||
Object? get key native;
|
||||
|
||||
@_annotation_Creates_IDBKey
|
||||
@_annotation_Returns_IDBKey
|
||||
Object? get primaryKey => JS("Object", "#.primaryKey", this);
|
||||
Object? get primaryKey native;
|
||||
|
||||
@Creates('Null')
|
||||
@Returns('ObjectStore|Index|Null')
|
||||
Object? get source => JS("Object", "#.source", this);
|
||||
Object? get source native;
|
||||
|
||||
void advance(int count) native;
|
||||
|
||||
|
@ -289,7 +289,7 @@ class CursorWithValue extends Cursor {
|
|||
@JSName('value')
|
||||
@annotation_Creates_SerializedScriptValue
|
||||
@annotation_Returns_SerializedScriptValue
|
||||
dynamic get _get_value => JS("", "#.value", this);
|
||||
dynamic get _get_value native;
|
||||
}
|
||||
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -400,16 +400,15 @@ class Database extends EventTarget {
|
|||
static const EventStreamProvider<VersionChangeEvent> versionChangeEvent =
|
||||
const EventStreamProvider<VersionChangeEvent>('versionchange');
|
||||
|
||||
String get name => JS("String", "#.name", this);
|
||||
String get name native;
|
||||
|
||||
@Returns('DomStringList')
|
||||
@Creates('DomStringList')
|
||||
List<String> get objectStoreNames =>
|
||||
JS("DomStringList", "#.objectStoreNames", this);
|
||||
List<String> get objectStoreNames native;
|
||||
|
||||
@Creates('int|String|Null')
|
||||
@Returns('int|String|Null')
|
||||
int get version => JS("int", "#.version", this);
|
||||
int get version native;
|
||||
|
||||
void close() native;
|
||||
|
||||
|
@ -655,19 +654,17 @@ class Index extends Interceptor {
|
|||
}
|
||||
|
||||
@annotation_Creates_SerializedScriptValue
|
||||
Object? get keyPath => JS("Object", "#.keyPath", this);
|
||||
Object? get keyPath native;
|
||||
|
||||
bool get multiEntry => JS("bool", "#.multiEntry", this);
|
||||
bool get multiEntry native;
|
||||
|
||||
String get name => JS("String", "#.name", this);
|
||||
String get name native;
|
||||
|
||||
set name(String value) {
|
||||
JS("void", "#.name = #", this, value);
|
||||
}
|
||||
set name(String value) native;
|
||||
|
||||
ObjectStore get objectStore => JS("ObjectStore", "#.objectStore", this);
|
||||
ObjectStore get objectStore native;
|
||||
|
||||
bool get unique => JS("bool", "#.unique", this);
|
||||
bool get unique native;
|
||||
|
||||
@JSName('count')
|
||||
Request _count(Object? key) native;
|
||||
|
@ -728,14 +725,14 @@ class KeyRange extends Interceptor {
|
|||
}
|
||||
|
||||
@annotation_Creates_SerializedScriptValue
|
||||
Object? get lower => JS("Object", "#.lower", this);
|
||||
Object? get lower native;
|
||||
|
||||
bool get lowerOpen => JS("bool", "#.lowerOpen", this);
|
||||
bool get lowerOpen native;
|
||||
|
||||
@annotation_Creates_SerializedScriptValue
|
||||
Object? get upper => JS("Object", "#.upper", this);
|
||||
Object? get upper native;
|
||||
|
||||
bool get upperOpen => JS("bool", "#.upperOpen", this);
|
||||
bool get upperOpen native;
|
||||
|
||||
@JSName('bound')
|
||||
static KeyRange bound_(Object lower, Object upper,
|
||||
|
@ -882,22 +879,20 @@ class ObjectStore extends Interceptor {
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
bool get autoIncrement => JS("bool", "#.autoIncrement", this);
|
||||
bool get autoIncrement native;
|
||||
|
||||
@Returns('DomStringList')
|
||||
@Creates('DomStringList')
|
||||
List<String> get indexNames => JS("DomStringList", "#.indexNames", this);
|
||||
List<String> get indexNames native;
|
||||
|
||||
@annotation_Creates_SerializedScriptValue
|
||||
Object? get keyPath => JS("Object", "#.keyPath", this);
|
||||
Object? get keyPath native;
|
||||
|
||||
String get name => JS("String", "#.name", this);
|
||||
String get name native;
|
||||
|
||||
set name(String value) {
|
||||
JS("void", "#.name = #", this, value);
|
||||
}
|
||||
set name(String value) native;
|
||||
|
||||
Transaction get transaction => JS("Transaction", "#.transaction", this);
|
||||
Transaction get transaction native;
|
||||
|
||||
@Returns('Request')
|
||||
@Creates('Request')
|
||||
|
@ -1031,11 +1026,11 @@ class Observation extends Interceptor {
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
Object? get key => JS("Object", "#.key", this);
|
||||
Object? get key native;
|
||||
|
||||
String get type => JS("String", "#.type", this);
|
||||
String get type native;
|
||||
|
||||
Object? get value => JS("Object", "#.value", this);
|
||||
Object? get value native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -1077,11 +1072,11 @@ class ObserverChanges extends Interceptor {
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
Database get database => JS("Database", "#.database", this);
|
||||
Database get database native;
|
||||
|
||||
Object? get records => JS("Object", "#.records", this);
|
||||
Object? get records native;
|
||||
|
||||
Transaction get transaction => JS("Transaction", "#.transaction", this);
|
||||
Transaction get transaction native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -1150,19 +1145,19 @@ class Request extends EventTarget {
|
|||
static const EventStreamProvider<Event> successEvent =
|
||||
const EventStreamProvider<Event>('success');
|
||||
|
||||
DomException get error => JS("DomException", "#.error", this);
|
||||
DomException get error native;
|
||||
|
||||
String get readyState => JS("String", "#.readyState", this);
|
||||
String get readyState native;
|
||||
|
||||
dynamic get result => _convertNativeToDart_IDBAny(this._get_result);
|
||||
@JSName('result')
|
||||
@Creates('Null')
|
||||
dynamic get _get_result => JS("", "#.result", this);
|
||||
dynamic get _get_result native;
|
||||
|
||||
@Creates('Null')
|
||||
Object? get source => JS("Object", "#.source", this);
|
||||
Object? get source native;
|
||||
|
||||
Transaction get transaction => JS("Transaction", "#.transaction", this);
|
||||
Transaction get transaction native;
|
||||
|
||||
/// Stream of `error` events handled by this [Request].
|
||||
Stream<Event> get onError => errorEvent.forTarget(this);
|
||||
|
@ -1237,16 +1232,15 @@ class Transaction extends EventTarget {
|
|||
static const EventStreamProvider<Event> errorEvent =
|
||||
const EventStreamProvider<Event>('error');
|
||||
|
||||
Database get db => JS("Database", "#.db", this);
|
||||
Database get db native;
|
||||
|
||||
DomException get error => JS("DomException", "#.error", this);
|
||||
DomException get error native;
|
||||
|
||||
String get mode => JS("String", "#.mode", this);
|
||||
String get mode native;
|
||||
|
||||
@Returns('DomStringList')
|
||||
@Creates('DomStringList')
|
||||
List<String> get objectStoreNames =>
|
||||
JS("DomStringList", "#.objectStoreNames", this);
|
||||
List<String> get objectStoreNames native;
|
||||
|
||||
void abort() native;
|
||||
|
||||
|
@ -1288,17 +1282,17 @@ class VersionChangeEvent extends Event {
|
|||
static VersionChangeEvent _create_2(type) =>
|
||||
JS('VersionChangeEvent', 'new IDBVersionChangeEvent(#)', type);
|
||||
|
||||
String get dataLoss => JS("String", "#.dataLoss", this);
|
||||
String get dataLoss native;
|
||||
|
||||
String get dataLossMessage => JS("String", "#.dataLossMessage", this);
|
||||
String get dataLossMessage native;
|
||||
|
||||
@Creates('int|String|Null')
|
||||
@Returns('int|String|Null')
|
||||
int? get newVersion => JS("int", "#.newVersion", this);
|
||||
int? get newVersion native;
|
||||
|
||||
@Creates('int|String|Null')
|
||||
@Returns('int|String|Null')
|
||||
int get oldVersion => JS("int", "#.oldVersion", this);
|
||||
int get oldVersion native;
|
||||
|
||||
@JSName('target')
|
||||
final OpenDBRequest target;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -50,31 +50,23 @@ class AnalyserNode extends AudioNode {
|
|||
static AnalyserNode _create_2(context) =>
|
||||
JS('AnalyserNode', 'new AnalyserNode(#)', context);
|
||||
|
||||
int get fftSize => JS("int", "#.fftSize", this);
|
||||
int get fftSize native;
|
||||
|
||||
set fftSize(int value) {
|
||||
JS("void", "#.fftSize = #", this, value);
|
||||
}
|
||||
set fftSize(int value) native;
|
||||
|
||||
int get frequencyBinCount => JS("int", "#.frequencyBinCount", this);
|
||||
int get frequencyBinCount native;
|
||||
|
||||
num get maxDecibels => JS("num", "#.maxDecibels", this);
|
||||
num get maxDecibels native;
|
||||
|
||||
set maxDecibels(num value) {
|
||||
JS("void", "#.maxDecibels = #", this, value);
|
||||
}
|
||||
set maxDecibels(num value) native;
|
||||
|
||||
num get minDecibels => JS("num", "#.minDecibels", this);
|
||||
num get minDecibels native;
|
||||
|
||||
set minDecibels(num value) {
|
||||
JS("void", "#.minDecibels = #", this, value);
|
||||
}
|
||||
set minDecibels(num value) native;
|
||||
|
||||
num get smoothingTimeConstant => JS("num", "#.smoothingTimeConstant", this);
|
||||
num get smoothingTimeConstant native;
|
||||
|
||||
set smoothingTimeConstant(num value) {
|
||||
JS("void", "#.smoothingTimeConstant = #", this, value);
|
||||
}
|
||||
set smoothingTimeConstant(num value) native;
|
||||
|
||||
void getByteFrequencyData(Uint8List array) native;
|
||||
|
||||
|
@ -102,13 +94,13 @@ class AudioBuffer extends Interceptor {
|
|||
static AudioBuffer _create_1(options) =>
|
||||
JS('AudioBuffer', 'new AudioBuffer(#)', options);
|
||||
|
||||
num get duration => JS("num", "#.duration", this);
|
||||
num get duration native;
|
||||
|
||||
int get length => JS("int", "#.length", this);
|
||||
int get length native;
|
||||
|
||||
int get numberOfChannels => JS("int", "#.numberOfChannels", this);
|
||||
int get numberOfChannels native;
|
||||
|
||||
num get sampleRate => JS("num", "#.sampleRate", this);
|
||||
num get sampleRate native;
|
||||
|
||||
void copyFromChannel(Float32List destination, int channelNumber,
|
||||
[int? startInChannel]) native;
|
||||
|
@ -148,27 +140,21 @@ class AudioBufferSourceNode extends AudioScheduledSourceNode {
|
|||
|
||||
AudioBuffer? buffer;
|
||||
|
||||
AudioParam get detune => JS("AudioParam", "#.detune", this);
|
||||
AudioParam get detune native;
|
||||
|
||||
bool get loop => JS("bool", "#.loop", this);
|
||||
bool get loop native;
|
||||
|
||||
set loop(bool value) {
|
||||
JS("void", "#.loop = #", this, value);
|
||||
}
|
||||
set loop(bool value) native;
|
||||
|
||||
num get loopEnd => JS("num", "#.loopEnd", this);
|
||||
num get loopEnd native;
|
||||
|
||||
set loopEnd(num value) {
|
||||
JS("void", "#.loopEnd = #", this, value);
|
||||
}
|
||||
set loopEnd(num value) native;
|
||||
|
||||
num get loopStart => JS("num", "#.loopStart", this);
|
||||
num get loopStart native;
|
||||
|
||||
set loopStart(num value) {
|
||||
JS("void", "#.loopStart = #", this, value);
|
||||
}
|
||||
set loopStart(num value) native;
|
||||
|
||||
AudioParam get playbackRate => JS("AudioParam", "#.playbackRate", this);
|
||||
AudioParam get playbackRate native;
|
||||
|
||||
void start([num? when, num? grainOffset, num? grainDuration]) native;
|
||||
}
|
||||
|
@ -189,7 +175,7 @@ class AudioContext extends BaseAudioContext {
|
|||
static bool get supported =>
|
||||
JS('bool', '!!(window.AudioContext || window.webkitAudioContext)');
|
||||
|
||||
num get baseLatency => JS("num", "#.baseLatency", this);
|
||||
num get baseLatency native;
|
||||
|
||||
Future close() => promiseToFuture(JS("", "#.close()", this));
|
||||
|
||||
|
@ -273,7 +259,7 @@ class AudioDestinationNode extends AudioNode {
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
int get maxChannelCount => JS("int", "#.maxChannelCount", this);
|
||||
int get maxChannelCount native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -286,23 +272,23 @@ class AudioListener extends Interceptor {
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
AudioParam get forwardX => JS("AudioParam", "#.forwardX", this);
|
||||
AudioParam get forwardX native;
|
||||
|
||||
AudioParam get forwardY => JS("AudioParam", "#.forwardY", this);
|
||||
AudioParam get forwardY native;
|
||||
|
||||
AudioParam get forwardZ => JS("AudioParam", "#.forwardZ", this);
|
||||
AudioParam get forwardZ native;
|
||||
|
||||
AudioParam get positionX => JS("AudioParam", "#.positionX", this);
|
||||
AudioParam get positionX native;
|
||||
|
||||
AudioParam get positionY => JS("AudioParam", "#.positionY", this);
|
||||
AudioParam get positionY native;
|
||||
|
||||
AudioParam get positionZ => JS("AudioParam", "#.positionZ", this);
|
||||
AudioParam get positionZ native;
|
||||
|
||||
AudioParam get upX => JS("AudioParam", "#.upX", this);
|
||||
AudioParam get upX native;
|
||||
|
||||
AudioParam get upY => JS("AudioParam", "#.upY", this);
|
||||
AudioParam get upY native;
|
||||
|
||||
AudioParam get upZ => JS("AudioParam", "#.upZ", this);
|
||||
AudioParam get upZ native;
|
||||
|
||||
void setOrientation(num x, num y, num z, num xUp, num yUp, num zUp) native;
|
||||
|
||||
|
@ -319,30 +305,23 @@ class AudioNode extends EventTarget {
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
int get channelCount => JS("int", "#.channelCount", this);
|
||||
int get channelCount native;
|
||||
|
||||
set channelCount(int value) {
|
||||
JS("void", "#.channelCount = #", this, value);
|
||||
}
|
||||
set channelCount(int value) native;
|
||||
|
||||
String get channelCountMode => JS("String", "#.channelCountMode", this);
|
||||
String get channelCountMode native;
|
||||
|
||||
set channelCountMode(String value) {
|
||||
JS("void", "#.channelCountMode = #", this, value);
|
||||
}
|
||||
set channelCountMode(String value) native;
|
||||
|
||||
String get channelInterpretation =>
|
||||
JS("String", "#.channelInterpretation", this);
|
||||
String get channelInterpretation native;
|
||||
|
||||
set channelInterpretation(String value) {
|
||||
JS("void", "#.channelInterpretation = #", this, value);
|
||||
}
|
||||
set channelInterpretation(String value) native;
|
||||
|
||||
BaseAudioContext get context => JS("BaseAudioContext", "#.context", this);
|
||||
BaseAudioContext get context native;
|
||||
|
||||
int get numberOfInputs => JS("int", "#.numberOfInputs", this);
|
||||
int get numberOfInputs native;
|
||||
|
||||
int get numberOfOutputs => JS("int", "#.numberOfOutputs", this);
|
||||
int get numberOfOutputs native;
|
||||
|
||||
@JSName('connect')
|
||||
AudioNode _connect(destination, [int? output, int? input]) native;
|
||||
|
@ -368,17 +347,15 @@ class AudioParam extends Interceptor {
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
num get defaultValue => JS("num", "#.defaultValue", this);
|
||||
num get defaultValue native;
|
||||
|
||||
num get maxValue => JS("num", "#.maxValue", this);
|
||||
num get maxValue native;
|
||||
|
||||
num get minValue => JS("num", "#.minValue", this);
|
||||
num get minValue native;
|
||||
|
||||
num get value => JS("num", "#.value", this);
|
||||
num get value native;
|
||||
|
||||
set value(num value) {
|
||||
JS("void", "#.value = #", this, value);
|
||||
}
|
||||
set value(num value) native;
|
||||
|
||||
AudioParam cancelAndHoldAtTime(num startTime) native;
|
||||
|
||||
|
@ -484,11 +461,11 @@ class AudioProcessingEvent extends Event {
|
|||
type,
|
||||
eventInitDict);
|
||||
|
||||
AudioBuffer get inputBuffer => JS("AudioBuffer", "#.inputBuffer", this);
|
||||
AudioBuffer get inputBuffer native;
|
||||
|
||||
AudioBuffer get outputBuffer => JS("AudioBuffer", "#.outputBuffer", this);
|
||||
AudioBuffer get outputBuffer native;
|
||||
|
||||
num get playbackTime => JS("num", "#.playbackTime", this);
|
||||
num get playbackTime native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -522,21 +499,19 @@ class AudioTrack extends Interceptor {
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
bool get enabled => JS("bool", "#.enabled", this);
|
||||
bool get enabled native;
|
||||
|
||||
set enabled(bool value) {
|
||||
JS("void", "#.enabled = #", this, value);
|
||||
}
|
||||
set enabled(bool value) native;
|
||||
|
||||
String get id => JS("String", "#.id", this);
|
||||
String get id native;
|
||||
|
||||
String get kind => JS("String", "#.kind", this);
|
||||
String get kind native;
|
||||
|
||||
String get label => JS("String", "#.label", this);
|
||||
String get label native;
|
||||
|
||||
String get language => JS("String", "#.language", this);
|
||||
String get language native;
|
||||
|
||||
SourceBuffer? get sourceBuffer => JS("SourceBuffer", "#.sourceBuffer", this);
|
||||
SourceBuffer? get sourceBuffer native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -552,7 +527,7 @@ class AudioTrackList extends EventTarget {
|
|||
static const EventStreamProvider<Event> changeEvent =
|
||||
const EventStreamProvider<Event>('change');
|
||||
|
||||
int get length => JS("int", "#.length", this);
|
||||
int get length native;
|
||||
|
||||
AudioTrack __getter__(int index) native;
|
||||
|
||||
|
@ -571,9 +546,9 @@ class AudioWorkletGlobalScope extends WorkletGlobalScope {
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
num get currentTime => JS("num", "#.currentTime", this);
|
||||
num get currentTime native;
|
||||
|
||||
num get sampleRate => JS("num", "#.sampleRate", this);
|
||||
num get sampleRate native;
|
||||
|
||||
void registerProcessor(String name, Object processorConstructor) native;
|
||||
}
|
||||
|
@ -605,7 +580,7 @@ class AudioWorkletNode extends AudioNode {
|
|||
static AudioWorkletNode _create_2(context, name) =>
|
||||
JS('AudioWorkletNode', 'new AudioWorkletNode(#,#)', context, name);
|
||||
|
||||
AudioParamMap get parameters => JS("AudioParamMap", "#.parameters", this);
|
||||
AudioParamMap get parameters native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -629,16 +604,15 @@ class BaseAudioContext extends EventTarget {
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
num get currentTime => JS("num", "#.currentTime", this);
|
||||
num get currentTime native;
|
||||
|
||||
AudioDestinationNode get destination =>
|
||||
JS("AudioDestinationNode", "#.destination", this);
|
||||
AudioDestinationNode get destination native;
|
||||
|
||||
AudioListener get listener => JS("AudioListener", "#.listener", this);
|
||||
AudioListener get listener native;
|
||||
|
||||
num get sampleRate => JS("num", "#.sampleRate", this);
|
||||
num get sampleRate native;
|
||||
|
||||
String get state => JS("String", "#.state", this);
|
||||
String get state native;
|
||||
|
||||
AnalyserNode createAnalyser() native;
|
||||
|
||||
|
@ -734,19 +708,17 @@ class BiquadFilterNode extends AudioNode {
|
|||
static BiquadFilterNode _create_2(context) =>
|
||||
JS('BiquadFilterNode', 'new BiquadFilterNode(#)', context);
|
||||
|
||||
AudioParam get Q => JS("AudioParam", "#.Q", this);
|
||||
AudioParam get Q native;
|
||||
|
||||
AudioParam get detune => JS("AudioParam", "#.detune", this);
|
||||
AudioParam get detune native;
|
||||
|
||||
AudioParam get frequency => JS("AudioParam", "#.frequency", this);
|
||||
AudioParam get frequency native;
|
||||
|
||||
AudioParam get gain => JS("AudioParam", "#.gain", this);
|
||||
AudioParam get gain native;
|
||||
|
||||
String get type => JS("String", "#.type", this);
|
||||
String get type native;
|
||||
|
||||
set type(String value) {
|
||||
JS("void", "#.type = #", this, value);
|
||||
}
|
||||
set type(String value) native;
|
||||
|
||||
void getFrequencyResponse(Float32List frequencyHz, Float32List magResponse,
|
||||
Float32List phaseResponse) native;
|
||||
|
@ -820,7 +792,7 @@ class ConstantSourceNode extends AudioScheduledSourceNode {
|
|||
static ConstantSourceNode _create_2(context) =>
|
||||
JS('ConstantSourceNode', 'new ConstantSourceNode(#)', context);
|
||||
|
||||
AudioParam get offset => JS("AudioParam", "#.offset", this);
|
||||
AudioParam get offset native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -847,11 +819,9 @@ class ConvolverNode extends AudioNode {
|
|||
|
||||
AudioBuffer? buffer;
|
||||
|
||||
bool get normalize => JS("bool", "#.normalize", this);
|
||||
bool get normalize native;
|
||||
|
||||
set normalize(bool value) {
|
||||
JS("void", "#.normalize = #", this, value);
|
||||
}
|
||||
set normalize(bool value) native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -876,7 +846,7 @@ class DelayNode extends AudioNode {
|
|||
static DelayNode _create_2(context) =>
|
||||
JS('DelayNode', 'new DelayNode(#)', context);
|
||||
|
||||
AudioParam get delayTime => JS("AudioParam", "#.delayTime", this);
|
||||
AudioParam get delayTime native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -904,17 +874,17 @@ class DynamicsCompressorNode extends AudioNode {
|
|||
static DynamicsCompressorNode _create_2(context) =>
|
||||
JS('DynamicsCompressorNode', 'new DynamicsCompressorNode(#)', context);
|
||||
|
||||
AudioParam get attack => JS("AudioParam", "#.attack", this);
|
||||
AudioParam get attack native;
|
||||
|
||||
AudioParam get knee => JS("AudioParam", "#.knee", this);
|
||||
AudioParam get knee native;
|
||||
|
||||
AudioParam get ratio => JS("AudioParam", "#.ratio", this);
|
||||
AudioParam get ratio native;
|
||||
|
||||
num get reduction => JS("num", "#.reduction", this);
|
||||
num get reduction native;
|
||||
|
||||
AudioParam get release => JS("AudioParam", "#.release", this);
|
||||
AudioParam get release native;
|
||||
|
||||
AudioParam get threshold => JS("AudioParam", "#.threshold", this);
|
||||
AudioParam get threshold native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -939,7 +909,7 @@ class GainNode extends AudioNode {
|
|||
static GainNode _create_2(context) =>
|
||||
JS('GainNode', 'new GainNode(#)', context);
|
||||
|
||||
AudioParam get gain => JS("AudioParam", "#.gain", this);
|
||||
AudioParam get gain native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -983,7 +953,7 @@ class MediaElementAudioSourceNode extends AudioNode {
|
|||
context,
|
||||
options);
|
||||
|
||||
MediaElement get mediaElement => JS("MediaElement", "#.mediaElement", this);
|
||||
MediaElement get mediaElement native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -1014,7 +984,7 @@ class MediaStreamAudioDestinationNode extends AudioNode {
|
|||
'new MediaStreamAudioDestinationNode(#)',
|
||||
context);
|
||||
|
||||
MediaStream get stream => JS("MediaStream", "#.stream", this);
|
||||
MediaStream get stream native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -1037,7 +1007,7 @@ class MediaStreamAudioSourceNode extends AudioNode {
|
|||
context,
|
||||
options);
|
||||
|
||||
MediaStream get mediaStream => JS("MediaStream", "#.mediaStream", this);
|
||||
MediaStream get mediaStream native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -1060,7 +1030,7 @@ class OfflineAudioCompletionEvent extends Event {
|
|||
type,
|
||||
eventInitDict);
|
||||
|
||||
AudioBuffer get renderedBuffer => JS("AudioBuffer", "#.renderedBuffer", this);
|
||||
AudioBuffer get renderedBuffer native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -1099,7 +1069,7 @@ class OfflineAudioContext extends BaseAudioContext {
|
|||
'new OfflineAudioContext(#)',
|
||||
numberOfChannels_OR_options);
|
||||
|
||||
int get length => JS("int", "#.length", this);
|
||||
int get length native;
|
||||
|
||||
Future<AudioBuffer> startRendering() =>
|
||||
promiseToFuture<AudioBuffer>(JS("", "#.startRendering()", this));
|
||||
|
@ -1131,15 +1101,13 @@ class OscillatorNode extends AudioScheduledSourceNode {
|
|||
static OscillatorNode _create_2(context) =>
|
||||
JS('OscillatorNode', 'new OscillatorNode(#)', context);
|
||||
|
||||
AudioParam get detune => JS("AudioParam", "#.detune", this);
|
||||
AudioParam get detune native;
|
||||
|
||||
AudioParam get frequency => JS("AudioParam", "#.frequency", this);
|
||||
AudioParam get frequency native;
|
||||
|
||||
String get type => JS("String", "#.type", this);
|
||||
String get type native;
|
||||
|
||||
set type(String value) {
|
||||
JS("void", "#.type = #", this, value);
|
||||
}
|
||||
set type(String value) native;
|
||||
|
||||
void setPeriodicWave(PeriodicWave periodicWave) native;
|
||||
}
|
||||
|
@ -1166,65 +1134,49 @@ class PannerNode extends AudioNode {
|
|||
static PannerNode _create_2(context) =>
|
||||
JS('PannerNode', 'new PannerNode(#)', context);
|
||||
|
||||
num get coneInnerAngle => JS("num", "#.coneInnerAngle", this);
|
||||
num get coneInnerAngle native;
|
||||
|
||||
set coneInnerAngle(num value) {
|
||||
JS("void", "#.coneInnerAngle = #", this, value);
|
||||
}
|
||||
set coneInnerAngle(num value) native;
|
||||
|
||||
num get coneOuterAngle => JS("num", "#.coneOuterAngle", this);
|
||||
num get coneOuterAngle native;
|
||||
|
||||
set coneOuterAngle(num value) {
|
||||
JS("void", "#.coneOuterAngle = #", this, value);
|
||||
}
|
||||
set coneOuterAngle(num value) native;
|
||||
|
||||
num get coneOuterGain => JS("num", "#.coneOuterGain", this);
|
||||
num get coneOuterGain native;
|
||||
|
||||
set coneOuterGain(num value) {
|
||||
JS("void", "#.coneOuterGain = #", this, value);
|
||||
}
|
||||
set coneOuterGain(num value) native;
|
||||
|
||||
String get distanceModel => JS("String", "#.distanceModel", this);
|
||||
String get distanceModel native;
|
||||
|
||||
set distanceModel(String value) {
|
||||
JS("void", "#.distanceModel = #", this, value);
|
||||
}
|
||||
set distanceModel(String value) native;
|
||||
|
||||
num get maxDistance => JS("num", "#.maxDistance", this);
|
||||
num get maxDistance native;
|
||||
|
||||
set maxDistance(num value) {
|
||||
JS("void", "#.maxDistance = #", this, value);
|
||||
}
|
||||
set maxDistance(num value) native;
|
||||
|
||||
AudioParam get orientationX => JS("AudioParam", "#.orientationX", this);
|
||||
AudioParam get orientationX native;
|
||||
|
||||
AudioParam get orientationY => JS("AudioParam", "#.orientationY", this);
|
||||
AudioParam get orientationY native;
|
||||
|
||||
AudioParam get orientationZ => JS("AudioParam", "#.orientationZ", this);
|
||||
AudioParam get orientationZ native;
|
||||
|
||||
String get panningModel => JS("String", "#.panningModel", this);
|
||||
String get panningModel native;
|
||||
|
||||
set panningModel(String value) {
|
||||
JS("void", "#.panningModel = #", this, value);
|
||||
}
|
||||
set panningModel(String value) native;
|
||||
|
||||
AudioParam get positionX => JS("AudioParam", "#.positionX", this);
|
||||
AudioParam get positionX native;
|
||||
|
||||
AudioParam get positionY => JS("AudioParam", "#.positionY", this);
|
||||
AudioParam get positionY native;
|
||||
|
||||
AudioParam get positionZ => JS("AudioParam", "#.positionZ", this);
|
||||
AudioParam get positionZ native;
|
||||
|
||||
num get refDistance => JS("num", "#.refDistance", this);
|
||||
num get refDistance native;
|
||||
|
||||
set refDistance(num value) {
|
||||
JS("void", "#.refDistance = #", this, value);
|
||||
}
|
||||
set refDistance(num value) native;
|
||||
|
||||
num get rolloffFactor => JS("num", "#.rolloffFactor", this);
|
||||
num get rolloffFactor native;
|
||||
|
||||
set rolloffFactor(num value) {
|
||||
JS("void", "#.rolloffFactor = #", this, value);
|
||||
}
|
||||
set rolloffFactor(num value) native;
|
||||
|
||||
void setOrientation(num x, num y, num z) native;
|
||||
|
||||
|
@ -1273,7 +1225,7 @@ class ScriptProcessorNode extends AudioNode {
|
|||
static const EventStreamProvider<AudioProcessingEvent> audioProcessEvent =
|
||||
const EventStreamProvider<AudioProcessingEvent>('audioprocess');
|
||||
|
||||
int get bufferSize => JS("int", "#.bufferSize", this);
|
||||
int get bufferSize native;
|
||||
|
||||
void setEventListener(EventListener eventListener) native;
|
||||
|
||||
|
@ -1311,7 +1263,7 @@ class StereoPannerNode extends AudioNode {
|
|||
static StereoPannerNode _create_2(context) =>
|
||||
JS('StereoPannerNode', 'new StereoPannerNode(#)', context);
|
||||
|
||||
AudioParam get pan => JS("AudioParam", "#.pan", this);
|
||||
AudioParam get pan native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -1338,9 +1290,7 @@ class WaveShaperNode extends AudioNode {
|
|||
|
||||
Float32List? curve;
|
||||
|
||||
String get oversample => JS("String", "#.oversample", this);
|
||||
String get oversample native;
|
||||
|
||||
set oversample(String value) {
|
||||
JS("void", "#.oversample = #", this, value);
|
||||
}
|
||||
set oversample(String value) native;
|
||||
}
|
||||
|
|
|
@ -32,11 +32,11 @@ class ActiveInfo extends Interceptor {
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
String get name => JS("String", "#.name", this);
|
||||
String get name native;
|
||||
|
||||
int get size => JS("int", "#.size", this);
|
||||
int get size native;
|
||||
|
||||
int get type => JS("int", "#.type", this);
|
||||
int get type native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -312,7 +312,7 @@ class ContextEvent extends Event {
|
|||
static ContextEvent _create_2(type) =>
|
||||
JS('ContextEvent', 'new WebGLContextEvent(#)', type);
|
||||
|
||||
String get statusMessage => JS("String", "#.statusMessage", this);
|
||||
String get statusMessage native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -723,13 +723,13 @@ class RenderingContext extends Interceptor implements CanvasRenderingContext {
|
|||
/// Checks if this type is supported on the current platform.
|
||||
static bool get supported => JS('bool', '!!(window.WebGLRenderingContext)');
|
||||
|
||||
CanvasElement get canvas => JS("CanvasElement", "#.canvas", this);
|
||||
CanvasElement get canvas native;
|
||||
|
||||
// From WebGLRenderingContextBase
|
||||
|
||||
int get drawingBufferHeight => JS("int", "#.drawingBufferHeight", this);
|
||||
int get drawingBufferHeight native;
|
||||
|
||||
int get drawingBufferWidth => JS("int", "#.drawingBufferWidth", this);
|
||||
int get drawingBufferWidth native;
|
||||
|
||||
void activeTexture(int texture) native;
|
||||
|
||||
|
@ -1363,7 +1363,7 @@ class RenderingContext2 extends Interceptor
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
Canvas get canvas => JS("Canvas", "#.canvas", this);
|
||||
Canvas get canvas native;
|
||||
|
||||
// From WebGL2RenderingContextBase
|
||||
|
||||
|
@ -2304,9 +2304,9 @@ class RenderingContext2 extends Interceptor
|
|||
|
||||
// From WebGLRenderingContextBase
|
||||
|
||||
int get drawingBufferHeight => JS("int", "#.drawingBufferHeight", this);
|
||||
int get drawingBufferHeight native;
|
||||
|
||||
int get drawingBufferWidth => JS("int", "#.drawingBufferWidth", this);
|
||||
int get drawingBufferWidth native;
|
||||
|
||||
void activeTexture(int texture) native;
|
||||
|
||||
|
@ -2862,11 +2862,11 @@ class ShaderPrecisionFormat extends Interceptor {
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
int get precision => JS("int", "#.precision", this);
|
||||
int get precision native;
|
||||
|
||||
int get rangeMax => JS("int", "#.rangeMax", this);
|
||||
int get rangeMax native;
|
||||
|
||||
int get rangeMin => JS("int", "#.rangeMin", this);
|
||||
int get rangeMin native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -2890,16 +2890,13 @@ class Texture extends Interceptor {
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
bool get lastUploadedVideoFrameWasSkipped =>
|
||||
JS("bool", "#.lastUploadedVideoFrameWasSkipped", this);
|
||||
bool get lastUploadedVideoFrameWasSkipped native;
|
||||
|
||||
int get lastUploadedVideoHeight =>
|
||||
JS("int", "#.lastUploadedVideoHeight", this);
|
||||
int get lastUploadedVideoHeight native;
|
||||
|
||||
num get lastUploadedVideoTimestamp =>
|
||||
JS("num", "#.lastUploadedVideoTimestamp", this);
|
||||
num get lastUploadedVideoTimestamp native;
|
||||
|
||||
int get lastUploadedVideoWidth => JS("int", "#.lastUploadedVideoWidth", this);
|
||||
int get lastUploadedVideoWidth native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
|
|
@ -79,7 +79,7 @@ class SqlDatabase extends Interceptor {
|
|||
/// Checks if this type is supported on the current platform.
|
||||
static bool get supported => JS('bool', '!!(window.openDatabase)');
|
||||
|
||||
String get version => JS("String", "#.version", this);
|
||||
String get version native;
|
||||
|
||||
@JSName('changeVersion')
|
||||
/**
|
||||
|
@ -185,9 +185,9 @@ class SqlError extends Interceptor {
|
|||
|
||||
static const int VERSION_ERR = 2;
|
||||
|
||||
int get code => JS("int", "#.code", this);
|
||||
int get code native;
|
||||
|
||||
String get message => JS("String", "#.message", this);
|
||||
String get message native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -200,11 +200,11 @@ class SqlResultSet extends Interceptor {
|
|||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
int get insertId => JS("int", "#.insertId", this);
|
||||
int get insertId native;
|
||||
|
||||
SqlResultSetRowList get rows => JS("SqlResultSetRowList", "#.rows", this);
|
||||
SqlResultSetRowList get rows native;
|
||||
|
||||
int get rowsAffected => JS("int", "#.rowsAffected", this);
|
||||
int get rowsAffected native;
|
||||
}
|
||||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
|
|
|
@ -1469,7 +1469,8 @@ class Dart2JSBackend(HtmlDartGenerator):
|
|||
if not read_only:
|
||||
if self._nnbd and not attribute.type.nullable:
|
||||
self._AddAttributeUsingProperties(attribute, html_name, read_only,
|
||||
rename, metadata)
|
||||
rename, metadata,
|
||||
use_native=True)
|
||||
return
|
||||
if attribute.type.id == 'Promise':
|
||||
_logger.warn('R/W member is a Promise: %s.%s' %
|
||||
|
@ -1531,7 +1532,7 @@ class Dart2JSBackend(HtmlDartGenerator):
|
|||
elif self._nnbd:
|
||||
# Finals need to be transformed to getters/setters.
|
||||
self._AddAttributeUsingProperties(attribute, html_name,
|
||||
read_only, rename, metadata)
|
||||
read_only, rename, metadata, use_native=True)
|
||||
return
|
||||
self._members_emitter.Emit(
|
||||
template,
|
||||
|
@ -1543,15 +1544,18 @@ class Dart2JSBackend(HtmlDartGenerator):
|
|||
if output_type == 'double' else output_type)
|
||||
|
||||
def _AddAttributeUsingProperties(self, attribute, html_name, read_only,
|
||||
rename=None, metadata=None):
|
||||
self._AddRenamingGetter(attribute, html_name, rename, metadata)
|
||||
rename=None, metadata=None,
|
||||
use_native=False):
|
||||
self._AddRenamingGetter(attribute, html_name, rename, metadata,
|
||||
use_native)
|
||||
if not read_only:
|
||||
# No metadata for setters.
|
||||
self._AddRenamingSetter(attribute, html_name, rename)
|
||||
self._AddRenamingSetter(attribute, html_name, rename, use_native)
|
||||
|
||||
def _AddInterfaceAttribute(self, attribute, html_name, read_only):
|
||||
if read_only and self._nnbd:
|
||||
self._AddAttributeUsingProperties(attribute, html_name, read_only)
|
||||
self._AddAttributeUsingProperties(attribute, html_name, read_only,
|
||||
use_native=True)
|
||||
else:
|
||||
self._members_emitter.Emit(
|
||||
'\n $QUALIFIER$TYPE $NAME;'
|
||||
|
@ -1561,18 +1565,22 @@ class Dart2JSBackend(HtmlDartGenerator):
|
|||
TYPE=self.SecureOutputType(attribute.type.id,
|
||||
nullable=attribute.type.nullable))
|
||||
|
||||
def _AddRenamingGetter(self, attr, html_name, rename, metadata):
|
||||
def _AddRenamingGetter(self, attr, html_name, rename, metadata, use_native):
|
||||
conversion = self._OutputConversion(attr.type.id, attr.id)
|
||||
if conversion:
|
||||
return self._AddConvertingGetter(attr, html_name, conversion)
|
||||
return self._AddConvertingGetter(attr, html_name, conversion,
|
||||
use_native)
|
||||
return_type = self.SecureOutputType(attr.type.id,
|
||||
nullable=attr.type.nullable)
|
||||
native_type = self._NarrowToImplementationType(attr.type.id)
|
||||
if use_native:
|
||||
getter = '\n $TYPE get $HTML_NAME native;'
|
||||
else:
|
||||
getter = '\n $TYPE get $HTML_NAME => JS("$NATIVE_TYPE", "#.$NAME", this);'
|
||||
self._members_emitter.Emit(
|
||||
# TODO(sra): Use metadata to provide native name.
|
||||
'\n $RENAME'
|
||||
'\n $METADATA'
|
||||
'\n $TYPE get $HTML_NAME => JS("$NATIVE_TYPE", "#.$NAME", this);'
|
||||
'\n $METADATA' +
|
||||
getter +
|
||||
'\n',
|
||||
RENAME=rename if rename else '',
|
||||
METADATA=metadata if metadata else '',
|
||||
|
@ -1581,10 +1589,11 @@ class Dart2JSBackend(HtmlDartGenerator):
|
|||
TYPE=return_type,
|
||||
NATIVE_TYPE=native_type)
|
||||
|
||||
def _AddRenamingSetter(self, attr, html_name, rename):
|
||||
def _AddRenamingSetter(self, attr, html_name, rename, use_native):
|
||||
conversion = self._InputConversion(attr.type.id, attr.id)
|
||||
if conversion:
|
||||
return self._AddConvertingSetter(attr, html_name, conversion)
|
||||
return self._AddConvertingSetter(attr, html_name, conversion,
|
||||
use_native)
|
||||
nullable_type = attr.type.nullable
|
||||
# If this attr has an output conversion, it is possible that there is a
|
||||
# converting getter. We need to make sure the setter type matches the
|
||||
|
@ -1592,24 +1601,27 @@ class Dart2JSBackend(HtmlDartGenerator):
|
|||
conversion = self._OutputConversion(attr.type.id, attr.id)
|
||||
if conversion and conversion.nullable_output:
|
||||
nullable_type = True
|
||||
if use_native:
|
||||
setter = '\n set $HTML_NAME($TYPE value) native;'
|
||||
else:
|
||||
setter = '\n set $HTML_NAME($TYPE value) {' \
|
||||
'\n JS("void", "#.$NAME = #", this, value);' \
|
||||
'\n }'
|
||||
self._members_emitter.Emit(
|
||||
# TODO(sra): Use metadata to provide native name.
|
||||
'\n $RENAME'
|
||||
'\n set $HTML_NAME($TYPE value) {'
|
||||
'\n JS("void", "#.$NAME = #", this, value);'
|
||||
'\n }'
|
||||
'\n $RENAME' +
|
||||
setter +
|
||||
'\n',
|
||||
RENAME=rename if rename else '',
|
||||
HTML_NAME=html_name,
|
||||
NAME=attr.id,
|
||||
TYPE=self.SecureOutputType(attr.type.id, nullable=nullable_type))
|
||||
|
||||
def _AddConvertingGetter(self, attr, html_name, conversion):
|
||||
getter = '\n $(JS_METADATA)final $NATIVE_TYPE _get_$HTML_NAME;'
|
||||
if self._nnbd:
|
||||
# TODO(srujzs): Should the inline call have the value type or should
|
||||
# it be inferred?
|
||||
getter = '\n $(JS_METADATA)$NATIVE_TYPE$NULLABLE_IN get _get_$HTML_NAME => JS("", "#.$NAME", this);'
|
||||
def _AddConvertingGetter(self, attr, html_name, conversion, use_native):
|
||||
# If using nnbd, we can't use finals, so opt for natives.
|
||||
if use_native or self._nnbd:
|
||||
getter = '\n $(JS_METADATA)$NATIVE_TYPE$NULLABLE_IN get _get_$HTML_NAME native;'
|
||||
else:
|
||||
getter = '\n $(JS_METADATA)final $NATIVE_TYPE _get_$HTML_NAME;'
|
||||
nullable_out = conversion.nullable_output and \
|
||||
not conversion.output_type == 'dynamic'
|
||||
# If the attribute is nullable, the getter should be nullable.
|
||||
|
@ -1636,20 +1648,23 @@ class Dart2JSBackend(HtmlDartGenerator):
|
|||
NULLASSERT='!' if nullable_in and \
|
||||
not conversion.nullable_input and self._nnbd else '')
|
||||
|
||||
def _AddConvertingSetter(self, attr, html_name, conversion):
|
||||
def _AddConvertingSetter(self, attr, html_name, conversion, use_native):
|
||||
# If the attribute is nullable, the setter should be nullable.
|
||||
nullable_in = attr.type.nullable and \
|
||||
not conversion.input_type == 'dynamic'
|
||||
nullable_out = conversion.nullable_output and \
|
||||
not conversion.output_type == 'dynamic'
|
||||
if use_native:
|
||||
setter = '\n set _set_$HTML_NAME(/*$NATIVE_TYPE$NULLABLE_OUT*/ value) native;'
|
||||
else:
|
||||
setter = '\n set _set_$HTML_NAME(/*$NATIVE_TYPE$NULLABLE_OUT*/ value) {' \
|
||||
'\n JS("void", "#.$NAME = #", this, value);' \
|
||||
'\n }'
|
||||
self._members_emitter.Emit(
|
||||
# TODO(sra): Use metadata to provide native name.
|
||||
'\n set $HTML_NAME($INPUT_TYPE$NULLABLE_IN value) {'
|
||||
'\n this._set_$HTML_NAME = $CONVERT(value$NULLASSERT);'
|
||||
'\n }'
|
||||
'\n set _set_$HTML_NAME(/*$NATIVE_TYPE$NULLABLE_OUT*/ value) {'
|
||||
'\n JS("void", "#.$NAME = #", this, value);'
|
||||
'\n }'
|
||||
'\n }' +
|
||||
setter +
|
||||
'\n',
|
||||
CONVERT=conversion.function_name,
|
||||
HTML_NAME=html_name,
|
||||
|
|
Loading…
Reference in a new issue