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

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

Issue 1988023008: Name and hoist types (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Address comments 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 association between runtime objects and 5 /// This library defines the association between runtime objects and
6 /// runtime types. 6 /// runtime types.
7 part of dart._runtime; 7 part of dart._runtime;
8 8
9 /// Runtime type information. This module defines the mapping from 9 /// Runtime type information. This module defines the mapping from
10 /// runtime objects to their runtime type information. See the types 10 /// runtime objects to their runtime type information. See the types
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 /// 48 ///
49 /// `dart.fn(cls)` marks cls has having no optional or named 49 /// `dart.fn(cls)` marks cls has having no optional or named
50 /// parameters, with all argument and return types as dynamic. 50 /// parameters, with all argument and return types as dynamic.
51 /// 51 ///
52 /// `dart.fn(cls, rType, argsT, extras)` marks cls as having the 52 /// `dart.fn(cls, rType, argsT, extras)` marks cls as having the
53 /// runtime type dart.functionType(rType, argsT, extras). 53 /// runtime type dart.functionType(rType, argsT, extras).
54 /// 54 ///
55 /// Note that since we are producing a type for a concrete function, 55 /// Note that since we are producing a type for a concrete function,
56 /// it is sound to use the definite arrow type. 56 /// it is sound to use the definite arrow type.
57 /// 57 ///
58 fn(closure, rType, argsT, extras) { 58 fn(closure, t) {
59 var t; 59 if (t == null) {
60 if (rType == null) {
61 // No type arguments, it's all dynamic 60 // No type arguments, it's all dynamic
62 t = definiteFunctionType( 61 t = definiteFunctionType(
63 JS('', '#', dynamic), 62 JS('', '#', dynamic),
64 JS('', 'Array(#.length).fill(#)', closure, dynamic), 63 JS('', 'Array(#.length).fill(#)', closure, dynamic),
65 JS('', 'void 0')); 64 JS('', 'void 0'));
66 } else {
67 // We're passed the piecewise components of the function type,
68 // construct it.
69 t = definiteFunctionType(rType, argsT, extras);
70 } 65 }
71 tag(closure, t); 66 tag(closure, t);
72 return closure; 67 return closure;
73 } 68 }
74 69
75 lazyFn(closure, computeTypeParts) { 70 lazyFn(closure, computeType) {
76 tagLazy(closure, JS('', '''() => { 71 tagLazy(closure, computeType);
77 let parts = #();
78 return #(parts[0], parts[1], parts[2]);
79 }''', computeTypeParts, definiteFunctionType));
80 return closure; 72 return closure;
81 } 73 }
82 74
83 // TODO(vsm): How should we encode the runtime type? 75 // TODO(vsm): How should we encode the runtime type?
84 final _runtimeType = JS('', 'Symbol("_runtimeType")'); 76 final _runtimeType = JS('', 'Symbol("_runtimeType")');
85 77
86 _checkPrimitiveType(obj) { 78 _checkPrimitiveType(obj) {
87 // TODO(jmesserly): JS is used to prevent type literal wrapping. 79 // TODO(jmesserly): JS is used to prevent type literal wrapping.
88 // Is there a better way we can handle this? 80 // Is there a better way we can handle this?
89 81
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 158 }
167 159
168 void tagComputed(value, compute) { 160 void tagComputed(value, compute) {
169 JS('', '#(#, #, { get: # })', defineProperty, value, _runtimeType, compute); 161 JS('', '#(#, #, { get: # })', defineProperty, value, _runtimeType, compute);
170 } 162 }
171 163
172 void tagLazy(value, compute) { 164 void tagLazy(value, compute) {
173 JS('', '#(#, #, { get: # })', 165 JS('', '#(#, #, { get: # })',
174 defineLazyProperty, value, _runtimeType, compute); 166 defineLazyProperty, value, _runtimeType, compute);
175 } 167 }
OLDNEW
« lib/src/compiler/compiler.dart ('K') | « tool/input_sdk/private/ddc_runtime/operations.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698