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

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/js_helper.dart

Issue 1198293002: dart2js: Use an abstract Name class for names in the generated JavaScript ast. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Comments Created 5 years, 6 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library _js_helper; 5 library _js_helper;
6 6
7 import 'dart:_async_await_error_codes' as async_error_codes; 7 import 'dart:_async_await_error_codes' as async_error_codes;
8 8
9 import 'dart:_js_embedded_names' show 9 import 'dart:_js_embedded_names' show
10 DEFERRED_LIBRARY_URIS, 10 DEFERRED_LIBRARY_URIS,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 bool builtinIsSubtype(type, String other) { 140 bool builtinIsSubtype(type, String other) {
141 return JS_BUILTIN('returns:bool;effects:none;depends:none', 141 return JS_BUILTIN('returns:bool;effects:none;depends:none',
142 JsBuiltin.isSubtype, other, type); 142 JsBuiltin.isSubtype, other, type);
143 } 143 }
144 144
145 /// Returns true if the given [type] is _the_ `Function` type. 145 /// Returns true if the given [type] is _the_ `Function` type.
146 // TODO(floitsch): move this to foreign_helper.dart or similar. 146 // TODO(floitsch): move this to foreign_helper.dart or similar.
147 @ForceInline() 147 @ForceInline()
148 bool isDartFunctionTypeRti(Object type) { 148 bool isDartFunctionTypeRti(Object type) {
149 return JS_BUILTIN('returns:bool;effects:none;depends:none', 149 return JS_BUILTIN('returns:bool;effects:none;depends:none',
150 JsBuiltin.isFunctionTypeRti, type); 150 JsBuiltin.isGivenTypeRti,
floitsch 2015/06/23 14:59:33 Actually you might as well use rawRtiToJsConstruct
151 type,
152 JS_GET_NAME(JsGetName.FUNCTION_CLASS_TYPE_NAME));
151 } 153 }
152 154
153 /// Returns whether the given type is _the_ Dart Object type. 155 /// Returns whether the given type is _the_ Dart Object type.
154 // TODO(floitsch): move this to foreign_helper.dart or similar. 156 // TODO(floitsch): move this to foreign_helper.dart or similar.
155 @ForceInline() 157 @ForceInline()
156 bool isDartObjectTypeRti(type) { 158 bool isDartObjectTypeRti(type) {
157 return JS_BUILTIN('returns:bool;effects:none;depends:none', 159 return JS_BUILTIN('returns:bool;effects:none;depends:none',
158 JsBuiltin.isDartObjectTypeRti, type); 160 JsBuiltin.isGivenTypeRti,
161 type,
162 JS_GET_NAME(JsGetName.OBJECT_CLASS_TYPE_NAME));
159 } 163 }
160 164
161 /// Returns whether the given type is _the_ null type. 165 /// Returns whether the given type is _the_ null type.
162 // TODO(floitsch): move this to foreign_helper.dart or similar. 166 // TODO(floitsch): move this to foreign_helper.dart or similar.
163 @ForceInline() 167 @ForceInline()
164 bool isNullTypeRti(type) { 168 bool isNullTypeRti(type) {
165 return JS_BUILTIN('returns:bool;effects:none;depends:none', 169 return JS_BUILTIN('returns:bool;effects:none;depends:none',
166 JsBuiltin.isNullTypeRti, type); 170 JsBuiltin.isGivenTypeRti,
171 type,
172 JS_GET_NAME(JsGetName.NULL_CLASS_TYPE_NAME));
167 } 173 }
168 174
169 /// Returns the metadata of the given [index]. 175 /// Returns the metadata of the given [index].
170 // TODO(floitsch): move this to foreign_helper.dart or similar. 176 // TODO(floitsch): move this to foreign_helper.dart or similar.
171 @ForceInline() 177 @ForceInline()
172 getMetadata(int index) { 178 getMetadata(int index) {
173 return JS_BUILTIN('returns:var;effects:none;depends:none', 179 return JS_BUILTIN('returns:var;effects:none;depends:none',
174 JsBuiltin.getMetadata, index); 180 JsBuiltin.getMetadata, index);
175 } 181 }
176 182
(...skipping 3952 matching lines...) Expand 10 before | Expand all | Expand 10 after
4129 // This is a function that will return a helper function that does the 4135 // This is a function that will return a helper function that does the
4130 // iteration of the sync*. 4136 // iteration of the sync*.
4131 // 4137 //
4132 // Each invocation should give a body with fresh state. 4138 // Each invocation should give a body with fresh state.
4133 final dynamic /* js function */ _outerHelper; 4139 final dynamic /* js function */ _outerHelper;
4134 4140
4135 SyncStarIterable(this._outerHelper); 4141 SyncStarIterable(this._outerHelper);
4136 4142
4137 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper)); 4143 Iterator get iterator => new SyncStarIterator(JS('', '#()', _outerHelper));
4138 } 4144 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698