Skip to content

Commit ca26ed2

Browse files
natebiggsCommit Bot
authored and
Commit Bot
committed
[dart2js] Prepare for locals.dart migration
`element_map_interfaces.dart` contains temporary interfaces that exist for the duration of the nnbd migration. `element_map_migrated.dart` contains 'real' code from `element_map.dart` that has been migrated. This will get re-combined with the `element_map.dart` once it is all migrated. Change-Id: I55cc414de471adbe2d63c0e226558d5b4773d409 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249744 Reviewed-by: Mayank Patke <[email protected]> Commit-Queue: Nate Biggs <[email protected]>
1 parent 2edfa30 commit ca26ed2

File tree

7 files changed

+407
-364
lines changed

7 files changed

+407
-364
lines changed

pkg/compiler/lib/src/closure.dart

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ import 'js_model/element_map.dart';
1212
import 'serialization/serialization_interfaces.dart';
1313

1414
export 'closure_migrated.dart'
15-
show BoxLocal, JSEntity, PrivatelyNamedJSEntity, ThisLocal;
15+
show
16+
BoxLocal,
17+
JSEntity,
18+
PrivatelyNamedJSEntity,
19+
ThisLocal,
20+
TypeVariableLocal;
1621

1722
/// Class that provides information for how closures are rewritten/represented
1823
/// to preserve Dart semantics when compiled to JavaScript. Given a particular
@@ -320,31 +325,3 @@ class ClosureRepresentationInfo extends ScopeInfo {
320325
// just confusing.
321326
bool get isClosure => false;
322327
}
323-
324-
/// A type variable as a local variable.
325-
class TypeVariableLocal implements Local {
326-
final TypeVariableEntity typeVariable;
327-
328-
TypeVariableLocal(this.typeVariable);
329-
330-
@override
331-
String get name => typeVariable.name;
332-
333-
@override
334-
int get hashCode => typeVariable.hashCode;
335-
336-
@override
337-
bool operator ==(other) {
338-
if (other is! TypeVariableLocal) return false;
339-
return typeVariable == other.typeVariable;
340-
}
341-
342-
@override
343-
String toString() {
344-
StringBuffer sb = StringBuffer();
345-
sb.write('type_variable_local(');
346-
sb.write(typeVariable);
347-
sb.write(')');
348-
return sb.toString();
349-
}
350-
}

pkg/compiler/lib/src/closure_migrated.dart

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,34 @@
44

55
import 'elements/entities.dart';
66

7+
/// A type variable as a local variable.
8+
class TypeVariableLocal implements Local {
9+
final TypeVariableEntity typeVariable;
10+
11+
TypeVariableLocal(this.typeVariable);
12+
13+
@override
14+
String? get name => typeVariable.name;
15+
16+
@override
17+
int get hashCode => typeVariable.hashCode;
18+
19+
@override
20+
bool operator ==(other) {
21+
if (other is! TypeVariableLocal) return false;
22+
return typeVariable == other.typeVariable;
23+
}
24+
25+
@override
26+
String toString() {
27+
StringBuffer sb = StringBuffer();
28+
sb.write('type_variable_local(');
29+
sb.write(typeVariable);
30+
sb.write(')');
31+
return sb.toString();
32+
}
33+
}
34+
735
/// A local variable used encode the direct (uncaptured) references to [this].
836
class ThisLocal extends Local {
937
final ClassEntity enclosingClass;

0 commit comments

Comments
 (0)