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

Side by Side Diff: tool/input_sdk/private/ddc_runtime/classes.dart

Issue 1930323004: instantiate generic tear-offs, fixes #525 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: format Created 4 years, 7 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// This library defines the operations that define and manipulate Dart 5 /// This library defines the operations that define and manipulate Dart
6 /// classes. Included in this are: 6 /// classes. Included in this are:
7 /// - Generics 7 /// - Generics
8 /// - Class metadata 8 /// - Class metadata
9 /// - Extension methods 9 /// - Extension methods
10 /// 10 ///
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 if ($f === void 0) $f = $obj[$name]; 163 if ($f === void 0) $f = $obj[$name];
164 $f = $f.bind($obj); 164 $f = $f.bind($obj);
165 // TODO(jmesserly): track the function's signature on the function, instead 165 // TODO(jmesserly): track the function's signature on the function, instead
166 // of having to go back to the class? 166 // of having to go back to the class?
167 let sig = $getMethodType($obj, $name); 167 let sig = $getMethodType($obj, $name);
168 $assert_(sig); 168 $assert_(sig);
169 $tag($f, sig); 169 $tag($f, sig);
170 return $f; 170 return $f;
171 })()'''); 171 })()''');
172 172
173 /// Instantiate a generic method.
174 ///
175 /// We need to apply the type arguments both to the function, as well as its
176 /// associated function type.
177 gbind(f, @rest typeArgs) {
178 var result = JS('', '#(...#)', f, typeArgs);
179 var sig = JS('', '#(...#)', _getRuntimeType(f), typeArgs);
180 tag(result, sig);
181 return result;
182 }
183
173 // Set up the method signature field on the constructor 184 // Set up the method signature field on the constructor
174 _setMethodSignature(f, sigF) => JS('', '''(() => { 185 _setMethodSignature(f, sigF) => JS('', '''(() => {
175 $defineMemoizedGetter($f, $_methodSig, () => { 186 $defineMemoizedGetter($f, $_methodSig, () => {
176 let sigObj = $sigF(); 187 let sigObj = $sigF();
177 sigObj.__proto__ = $f.__proto__[$_methodSig]; 188 sigObj.__proto__ = $f.__proto__[$_methodSig];
178 return sigObj; 189 return sigObj;
179 }); 190 });
180 })()'''); 191 })()''');
181 192
182 // Set up the constructor signature field on the constructor 193 // Set up the constructor signature field on the constructor
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 })()'''); 361 })()''');
351 362
352 /// Sets the element type of a list literal. 363 /// Sets the element type of a list literal.
353 list(obj, elementType) => 364 list(obj, elementType) =>
354 JS('', '$setType($obj, ${getGenericClass(JSArray)}($elementType))'); 365 JS('', '$setType($obj, ${getGenericClass(JSArray)}($elementType))');
355 366
356 setBaseClass(derived, base) => JS('', '''(() => { 367 setBaseClass(derived, base) => JS('', '''(() => {
357 // Link the extension to the type it's extending as a base class. 368 // Link the extension to the type it's extending as a base class.
358 $derived.prototype.__proto__ = $base.prototype; 369 $derived.prototype.__proto__ = $base.prototype;
359 })()'''); 370 })()''');
OLDNEW
« no previous file with comments | « test/codegen/language/generic_tearoff_test.dart ('k') | tool/input_sdk/private/ddc_runtime/operations.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698