|
First cut at extending native classes.
Subclasses of native classes have to be treated largely like native classes since they require interceptors.
The ugly part is collecting the set of subclasses of native classes without resolving all classes. Only plausible classes are resolved. Plausible classes have a superclass name that is native class (or subclass of native class). The name-keyed graph is collected and inverted to identify the true subclasses of native classes.
Things that are missing from this CL:
1. I discussed with Peter a better way of finding which classes are subclasses of native classes by resolving the superclass. Peter's proposal will still require the graph inversion step but should be more precise.
2. It would be a good idea to replace the 'defineNativeSubclass' calls with more declarative static data on the class and post-process the classes.
3. We need to make sure that fields of subclasses of native classes do not conflict with any (potentially undeclared) properties of the base native class.
4. The compiler should do additional checking
- The constructor must be a factory constructor.
- No fields can have initializers.
R=ahe@google.com
Committed: https://code.google.com/p/dart/source/detail?r=26208
Total comments: 6
Total comments: 33
Total comments: 6
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+569 lines, -41 lines) |
Patch |
|
M |
sdk/lib/_internal/compiler/implementation/elements/elements.dart
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+7 lines, -1 line |
0 comments
|
Download
|
|
M |
sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
|
View
|
1
2
3
4
5
6
7
|
6 chunks |
+14 lines, -4 lines |
0 comments
|
Download
|
|
M |
sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
|
View
|
1
2
3
4
5
6
7
8
|
7 chunks |
+56 lines, -8 lines |
0 comments
|
Download
|
|
M |
sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
|
View
|
1
2
3
4
5
6
7
|
13 chunks |
+90 lines, -14 lines |
0 comments
|
Download
|
|
M |
sdk/lib/_internal/compiler/implementation/native_handler.dart
|
View
|
1
2
3
4
5
6
7
|
4 chunks |
+127 lines, -0 lines |
0 comments
|
Download
|
|
M |
sdk/lib/_internal/compiler/implementation/ssa/builder.dart
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
sdk/lib/_internal/lib/foreign_helper.dart
|
View
|
1
2
3
4
5
6
7
|
1 chunk |
+16 lines, -0 lines |
0 comments
|
Download
|
|
M |
sdk/lib/_internal/lib/interceptors.dart
|
View
|
1
2
3
4
5
6
7
|
2 chunks |
+32 lines, -1 line |
0 comments
|
Download
|
|
M |
sdk/lib/_internal/lib/native_helper.dart
|
View
|
1
2
3
4
5
6
7
8
|
4 chunks |
+67 lines, -9 lines |
0 comments
|
Download
|
|
M |
tests/compiler/dart2js/mock_compiler.dart
|
View
|
1
2
3
4
5
6
7
8
9
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
A |
tests/compiler/dart2js_native/subclassing_1_test.dart
|
View
|
1
2
3
4
|
1 chunk |
+58 lines, -0 lines |
0 comments
|
Download
|
|
A |
tests/compiler/dart2js_native/subclassing_2_test.dart
|
View
|
1
2
3
4
|
1 chunk |
+45 lines, -0 lines |
0 comments
|
Download
|
|
A |
tests/compiler/dart2js_native/subclassing_3_test.dart
|
View
|
1
2
3
4
5
|
1 chunk |
+50 lines, -0 lines |
0 comments
|
Download
|
|
M |
tests/html/custom_elements_test.dart
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
|
M |
tests/utils/dummy_compiler_test.dart
|
View
|
1
2
3
4
5
6
7
8
9
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
Total messages: 10 (0 generated)
|