Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/glue.dart

Issue 968843003: Implement type argument access and reification of runtime types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library code_generator_dependencies; 5 library code_generator_dependencies;
6 6
7 import '../js_backend.dart'; 7 import '../js_backend.dart';
8 import '../../dart2jslib.dart'; 8 import '../../dart2jslib.dart';
9 import '../../js_emitter/js_emitter.dart'; 9 import '../../js_emitter/js_emitter.dart';
10 import '../../js/js.dart' as js; 10 import '../../js/js.dart' as js;
11 import '../../constants/values.dart'; 11 import '../../constants/values.dart';
12 import '../../elements/elements.dart'; 12 import '../../elements/elements.dart';
13 import '../../constants/expressions.dart'; 13 import '../../constants/expressions.dart';
14 import '../../dart_types.dart';
14 15
15 /// Encapsulates the dependencies of the function-compiler to the compiler, 16 /// Encapsulates the dependencies of the function-compiler to the compiler,
16 /// backend and emitter. 17 /// backend and emitter.
17 // TODO(sigurdm): Should be refactored when we have a better feeling for the 18 // TODO(sigurdm): Should be refactored when we have a better feeling for the
18 // interface. 19 // interface.
19 class Glue { 20 class Glue {
20 final Compiler _compiler; 21 final Compiler _compiler;
21 22
22 JavaScriptBackend get _backend => _compiler.backend; 23 JavaScriptBackend get _backend => _compiler.backend;
23 24
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 String getInterceptorName(Set<ClassElement> interceptedClasses) { 111 String getInterceptorName(Set<ClassElement> interceptedClasses) {
111 return _backend.namer.getInterceptorName( 112 return _backend.namer.getInterceptorName(
112 getInterceptorMethod, 113 getInterceptorMethod,
113 interceptedClasses); 114 interceptedClasses);
114 } 115 }
115 116
116 js.Expression getInterceptorLibrary() { 117 js.Expression getInterceptorLibrary() {
117 return new js.VariableUse( 118 return new js.VariableUse(
118 _backend.namer.globalObjectFor(_backend.interceptorsLibrary)); 119 _backend.namer.globalObjectFor(_backend.interceptorsLibrary));
119 } 120 }
121
122 FunctionElement getCreateRuntimeType() {
123 return _backend.getCreateRuntimeType();
124 }
125
126 FunctionElement getRuntimeTypeToString() {
127 return _backend.getRuntimeTypeToString();
128 }
129
130 FunctionElement getTypeArgumentWithSubstitution() {
131 return _backend.getGetRuntimeTypeArgument();
132 }
133
134 FunctionElement getTypeArgumentByIndex() {
135 return _backend.getGetTypeArgumentByIndex();
136 }
137
138 js.Expression getSubstitutionName(ClassElement cls) {
139 return js.string(_namer.substitutionName(cls));
140 }
141
142 int getTypeVariableIndex(TypeVariableType variable) {
143 return RuntimeTypes.getTypeVariableIndex(variable.element);
144 }
145
146 bool needsSubstitutionForTypeVariableAccess(ClassElement cls) {
147 ClassWorld classWorld = _compiler.world;
148 if (classWorld.isUsedAsMixin(cls)) return true;
149
150 Iterable<ClassElement> subclasses = _compiler.world.strictSubclassesOf(cls);
151 return subclasses.any((ClassElement subclass) {
152 return !_backend.rti.isTrivialSubstitution(subclass, cls);
153 });
154 }
120 } 155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698