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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree_printer.dart

Issue 359413006: Fix handling of type literals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 dart_tree_printer; 5 library dart_tree_printer;
6 6
7 import 'dart_printer.dart'; 7 import 'dart_printer.dart';
8 import '../tree/tree.dart' as tree; 8 import '../tree/tree.dart' as tree;
9 import '../scanner/scannerlib.dart'; 9 import '../scanner/scannerlib.dart';
10 import '../util/util.dart'; 10 import '../util/util.dart';
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 typeArgs, 487 typeArgs,
488 braceList(',', exp.entries.map(makeLiteralMapEntry)), 488 braceList(',', exp.entries.map(makeLiteralMapEntry)),
489 exp.isConst ? constToken : null); 489 exp.isConst ? constToken : null);
490 } else if (exp is LiteralSymbol) { 490 } else if (exp is LiteralSymbol) {
491 precedence = PRIMARY; 491 precedence = PRIMARY;
492 result = new tree.LiteralSymbol( 492 result = new tree.LiteralSymbol(
493 hash, 493 hash,
494 makeList('.', exp.id.split('.').map(makeIdentifier))); 494 makeList('.', exp.id.split('.').map(makeIdentifier)));
495 } else if (exp is LiteralType) { 495 } else if (exp is LiteralType) {
496 precedence = TYPE_LITERAL; 496 precedence = TYPE_LITERAL;
497 elements.Element optionalElement = exp.type.element;
497 result = new tree.Send( 498 result = new tree.Send(
498 makeStaticReceiver(exp.element), 499 optionalElement == null ? null : makeStaticReceiver(optionalElement),
499 makeIdentifier(exp.name)); 500 makeIdentifier(exp.name));
500 setElement(result, exp.element, exp); 501 treeElements.setType(result, exp.type);
502 if (optionalElement != null) { // dynamic does not have an element
503 setElement(result, optionalElement, exp);
504 }
501 } else if (exp is ReifyTypeVar) { 505 } else if (exp is ReifyTypeVar) {
502 precedence = PRIMARY; 506 precedence = PRIMARY;
503 result = new tree.Send( 507 result = new tree.Send(
504 null, 508 null,
505 makeIdentifier(exp.name)); 509 makeIdentifier(exp.name));
506 setElement(result, exp.element, exp); 510 setElement(result, exp.element, exp);
507 } else if (exp is StringConcat) { 511 } else if (exp is StringConcat) {
508 precedence = PRIMARY; 512 precedence = PRIMARY;
509 result = unparseStringLiteral(exp); 513 result = unparseStringLiteral(exp);
510 } else if (exp is This) { 514 } else if (exp is This) {
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 printStringChunk(chunk.previous), 1008 printStringChunk(chunk.previous),
1005 node); 1009 node);
1006 } else { 1010 } else {
1007 return node; 1011 return node;
1008 } 1012 }
1009 } 1013 }
1010 return printStringChunk(output.chunk); 1014 return printStringChunk(output.chunk);
1011 } 1015 }
1012 1016
1013 } 1017 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698