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

Side by Side Diff: pkg/compiler/lib/src/js_backend/constant_emitter.dart

Issue 2996723002: Support typedef type literals (Closed)
Patch Set: Updated cf. comments Created 3 years, 4 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 | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/namer.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 import '../common.dart'; 5 import '../common.dart';
6 import '../common_elements.dart'; 6 import '../common_elements.dart';
7 import '../constants/values.dart'; 7 import '../constants/values.dart';
8 import '../elements/entities.dart'; 8 import '../elements/entities.dart';
9 import '../elements/resolution_types.dart' show ResolutionTypedefType;
10 import '../elements/types.dart'; 9 import '../elements/types.dart';
11 import '../io/code_output.dart'; 10 import '../io/code_output.dart';
12 import '../js/js.dart' as jsAst; 11 import '../js/js.dart' as jsAst;
13 import '../js/js.dart' show js; 12 import '../js/js.dart' show js;
14 import '../js_emitter/code_emitter_task.dart'; 13 import '../js_emitter/code_emitter_task.dart';
15 import '../options.dart'; 14 import '../options.dart';
16 import '../universe/world_builder.dart'; 15 import '../universe/world_builder.dart';
17 import 'constant_system_javascript.dart'; 16 import 'constant_system_javascript.dart';
18 import 'js_backend.dart'; 17 import 'js_backend.dart';
19 import 'namer.dart'; 18 import 'namer.dart';
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 return _emitter.staticFunctionAccess(helper); 274 return _emitter.staticFunctionAccess(helper);
276 } 275 }
277 276
278 @override 277 @override
279 jsAst.Expression visitType(TypeConstantValue constant, [_]) { 278 jsAst.Expression visitType(TypeConstantValue constant, [_]) {
280 DartType type = constant.representedType; 279 DartType type = constant.representedType;
281 jsAst.Name typeName; 280 jsAst.Name typeName;
282 Entity element; 281 Entity element;
283 if (type is InterfaceType) { 282 if (type is InterfaceType) {
284 element = type.element; 283 element = type.element;
285 } else if (type is ResolutionTypedefType) { 284 } else if (type is TypedefType) {
286 // TODO(redemption): Handle typedef type literals from .dill. 285 // TODO(redemption): Handle typedef type literals from .dill.
287 element = type.element; 286 element = type.element;
288 } else { 287 } else {
289 assert(type is DynamicType); 288 assert(type is DynamicType);
290 } 289 }
291 typeName = _namer.runtimeTypeName(element); 290 typeName = _namer.runtimeTypeName(element);
292 return new jsAst.Call(getHelperProperty(_commonElements.createRuntimeType), 291 return new jsAst.Call(getHelperProperty(_commonElements.createRuntimeType),
293 [js.quoteName(typeName)]); 292 [js.quoteName(typeName)]);
294 } 293 }
295 294
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 _rtiEncoder.getTypeRepresentation(_emitter, argument, unexpected)); 365 _rtiEncoder.getTypeRepresentation(_emitter, argument, unexpected));
367 } 366 }
368 return new jsAst.ArrayInitializer(arguments); 367 return new jsAst.ArrayInitializer(arguments);
369 } 368 }
370 369
371 @override 370 @override
372 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) { 371 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) {
373 return constantReferenceGenerator(constant.referenced); 372 return constantReferenceGenerator(constant.referenced);
374 } 373 }
375 } 374 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/namer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698