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

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

Issue 2983523002: Check for null when getting the extension type. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 return $name in sigObj; 384 return $name in sigObj;
385 })()'''); 385 })()''');
386 386
387 bool hasMethod(type, name) => _hasSigEntry(type, _methodSig, name); 387 bool hasMethod(type, name) => _hasSigEntry(type, _methodSig, name);
388 bool hasGetter(type, name) => _hasSigEntry(type, _getterSig, name); 388 bool hasGetter(type, name) => _hasSigEntry(type, _getterSig, name);
389 bool hasSetter(type, name) => _hasSigEntry(type, _setterSig, name); 389 bool hasSetter(type, name) => _hasSigEntry(type, _setterSig, name);
390 bool 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) =>
395 JS('', '# == null ? null : #[#]', obj, obj, _extensionType);
395 396
396 final dartx = JS('', 'dartx'); 397 final dartx = JS('', 'dartx');
397 398
398 getExtensionSymbol(name) { 399 getExtensionSymbol(name) {
399 var sym = JS('', 'dartx[#]', name); 400 var sym = JS('', 'dartx[#]', name);
400 if (sym == null) { 401 if (sym == null) {
401 sym = JS('', 'Symbol("dartx." + #.toString())', name); 402 sym = JS('', 'Symbol("dartx." + #.toString())', name);
402 JS('', 'dartx[#] = #', name, sym); 403 JS('', 'dartx[#] = #', name, sym);
403 } 404 }
404 return sym; 405 return sym;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 553
553 defineEnumValues(enumClass, names) { 554 defineEnumValues(enumClass, names) {
554 var values = []; 555 var values = [];
555 for (var i = 0; i < JS('int', '#.length', names); i++) { 556 for (var i = 0; i < JS('int', '#.length', names); i++) {
556 var value = const_(JS('', 'new #.new(#)', enumClass, i)); 557 var value = const_(JS('', 'new #.new(#)', enumClass, i));
557 JS('', '#.push(#)', values, value); 558 JS('', '#.push(#)', values, value);
558 defineValue(enumClass, JS('', '#[#]', names, i), value); 559 defineValue(enumClass, JS('', '#[#]', names, i), value);
559 } 560 }
560 JS('', '#.values = #', enumClass, constList(values, enumClass)); 561 JS('', '#.values = #', enumClass, constList(values, enumClass));
561 } 562 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698