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

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

Issue 2468493003: Type-related fixes (Closed)
Patch Set: Created 4 years, 1 month 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 runtime operations on objects used by the code 5 /// This library defines runtime operations on objects used by the code
6 /// generator. 6 /// generator.
7 part of dart._runtime; 7 part of dart._runtime;
8 8
9 class InvocationImpl extends Invocation { 9 class InvocationImpl extends Invocation {
10 final Symbol memberName; 10 final Symbol memberName;
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 constFn(x) => JS('', '() => x'); 788 constFn(x) => JS('', '() => x');
789 789
790 runtimeType(obj) { 790 runtimeType(obj) {
791 // Handle primitives where the method isn't on the object. 791 // Handle primitives where the method isn't on the object.
792 var result = _checkPrimitiveType(obj); 792 var result = _checkPrimitiveType(obj);
793 if (result != null) return wrapType(result); 793 if (result != null) return wrapType(result);
794 794
795 // Delegate to the (possibly user-defined) method on the object. 795 // Delegate to the (possibly user-defined) method on the object.
796 var extension = getExtensionType(obj); 796 var extension = getExtensionType(obj);
797 if (extension != null) { 797 if (extension != null) {
798 return JS('', '#[dartx.runtimeType]', obj); 798 result = JS('', '#[dartx.runtimeType]', obj);
799 // If extension doesn't override runtimeType, return the extension type.
800 return result ?? wrapType(extension);
799 } 801 }
800 if (JS('bool', 'typeof # == "function"', obj)) { 802 if (JS('bool', 'typeof # == "function"', obj)) {
801 return wrapType(getReifiedType(obj)); 803 return wrapType(getReifiedType(obj));
802 } 804 }
803 return JS('', '#.runtimeType', obj); 805 return JS('', '#.runtimeType', obj);
804 } 806 }
805 807
806 /// Implements Dart's interpolated strings as ES2015 tagged template literals. 808 /// Implements Dart's interpolated strings as ES2015 tagged template literals.
807 /// 809 ///
808 /// For example: dart.str`hello ${name}` 810 /// For example: dart.str`hello ${name}`
(...skipping 29 matching lines...) Expand all
838 if (obj != null && getExtensionType(obj) != null) { 840 if (obj != null && getExtensionType(obj) != null) {
839 return JS('', 'dartx.#', name); 841 return JS('', 'dartx.#', name);
840 } 842 }
841 843
842 // Check for certain names that we can't use in JS 844 // Check for certain names that we can't use in JS
843 if (name == 'constructor' || name == 'prototype') { 845 if (name == 'constructor' || name == 'prototype') {
844 name = '+' + name; 846 name = '+' + name;
845 } 847 }
846 return name; 848 return name;
847 } 849 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/test/browser/language_tests.js ('k') | pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698