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

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

Issue 2965633002: Fix handling of inline JS types in DDC. (Closed)
Patch Set: Created 3 years, 5 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 $_setFieldSignature($f, fields); 369 $_setFieldSignature($f, fields);
370 $_setGetterSignature($f, getters); 370 $_setGetterSignature($f, getters);
371 $_setSetterSignature($f, setters); 371 $_setSetterSignature($f, setters);
372 $_setStaticSignature($f, statics); 372 $_setStaticSignature($f, statics);
373 $_setStaticFieldSignature($f, staticFields); 373 $_setStaticFieldSignature($f, staticFields);
374 $_setStaticGetterSignature($f, staticGetters); 374 $_setStaticGetterSignature($f, staticGetters);
375 $_setStaticSetterSignature($f, staticSetters); 375 $_setStaticSetterSignature($f, staticSetters);
376 $_setStaticTypes($f, names); 376 $_setStaticTypes($f, names);
377 })()'''); 377 })()''');
378 378
379 _hasSigEntry(type, sigF, name) => JS( 379 bool _hasSigEntry(type, sigF, name) => JS(
380 '', 380 'bool',
381 '''(() => { 381 '''(() => {
382 let sigObj = $type[$sigF]; 382 let sigObj = $type[$sigF];
383 if (sigObj === void 0) return false; 383 if (sigObj === void 0) return false;
384 return $name in sigObj; 384 return $name in sigObj;
385 })()'''); 385 })()''');
386 386
387 hasMethod(type, name) => _hasSigEntry(type, _methodSig, name); 387 bool hasMethod(type, name) => _hasSigEntry(type, _methodSig, name);
388 hasGetter(type, name) => _hasSigEntry(type, _getterSig, name); 388 bool hasGetter(type, name) => _hasSigEntry(type, _getterSig, name);
389 hasSetter(type, name) => _hasSigEntry(type, _setterSig, name); 389 bool hasSetter(type, name) => _hasSigEntry(type, _setterSig, name);
390 hasField(type, name) => _hasSigEntry(type, _fieldSig, name); 390 bool hasField(type, name) => _hasSigEntry(type, _fieldSig, name);
391 391
392 final _extensionType = JS('', 'Symbol("extensionType")'); 392 final _extensionType = JS('', 'Symbol("extensionType")');
393 393
394 getExtensionType(obj) => JS('', '#[#]', obj, _extensionType); 394 getExtensionType(obj) => JS('', '#[#]', obj, _extensionType);
395 395
396 final dartx = JS('', 'dartx'); 396 final dartx = JS('', 'dartx');
397 397
398 getExtensionSymbol(name) { 398 getExtensionSymbol(name) {
399 var sym = JS('', 'dartx[#]', name); 399 var sym = JS('', 'dartx[#]', name);
400 if (sym == null) { 400 if (sym == null) {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 570
571 defineEnumValues(enumClass, names) { 571 defineEnumValues(enumClass, names) {
572 var values = []; 572 var values = [];
573 for (var i = 0; i < JS('int', '#.length', names); i++) { 573 for (var i = 0; i < JS('int', '#.length', names); i++) {
574 var value = const_(JS('', 'new #.new(#)', enumClass, i)); 574 var value = const_(JS('', 'new #.new(#)', enumClass, i));
575 JS('', '#.push(#)', values, value); 575 JS('', '#.push(#)', values, value);
576 defineValue(enumClass, JS('', '#[#]', names, i), value); 576 defineValue(enumClass, JS('', '#[#]', names, i), value);
577 } 577 }
578 JS('', '#.values = #', enumClass, constList(values, enumClass)); 578 JS('', '#.values = #', enumClass, constList(values, enumClass));
579 } 579 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698