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

Side by Side Diff: pkg/kernel/lib/transformations/closure/converter.dart

Issue 2752823003: Remove unnecessary casts. (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | no next file » | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 kernel.transformations.closure.converter; 5 library kernel.transformations.closure.converter;
6 6
7 import '../../ast.dart' 7 import '../../ast.dart'
8 show 8 show
9 Arguments, 9 Arguments,
10 Block, 10 Block,
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 Field self = new Field(new Name("self"), fileUri: currentFileUri); 669 Field self = new Field(new Name("self"), fileUri: currentFileUri);
670 self.type = substitute(procedure.enclosingClass.thisType, substitution); 670 self.type = substitute(procedure.enclosingClass.thisType, substitution);
671 fields = <Field>[self]; 671 fields = <Field>[self];
672 receiver = new PropertyGet(new ThisExpression(), self.name, self); 672 receiver = new PropertyGet(new ThisExpression(), self.name, self);
673 } 673 }
674 674
675 // Find the closure class for the function. If there isn't one, create it. 675 // Find the closure class for the function. If there isn't one, create it.
676 String closureClassName = createNameForClosureClass(procedure.function); 676 String closureClassName = createNameForClosureClass(procedure.function);
677 Class closureClass = null; 677 Class closureClass = null;
678 for (TreeNode node in newLibraryMembers) { 678 for (TreeNode node in newLibraryMembers) {
679 if (node is Class && (node as Class).name == closureClassName) { 679 if (node is Class && node.name == closureClassName) {
ahe 2017/03/16 09:37:09 Because of the test "node is Class", the compiler
Dmitry Stefantsov 2017/03/16 09:42:10 Thanks!
680 closureClass = node as Class; 680 closureClass = node;
681 } 681 }
682 } 682 }
683 if (closureClass == null) { 683 if (closureClass == null) {
684 closureClass = createClosureClass(procedure.function, 684 closureClass = createClosureClass(procedure.function,
685 fields: fields, substitution: substitution); 685 fields: fields, substitution: substitution);
686 closureClass.addMember(new Procedure( 686 closureClass.addMember(new Procedure(
687 new Name("call"), 687 new Name("call"),
688 ProcedureKind.Method, 688 ProcedureKind.Method,
689 forwardFunction(procedure, receiver, substitution), 689 forwardFunction(procedure, receiver, substitution),
690 fileUri: currentFileUri)); 690 fileUri: currentFileUri));
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 // TODO(ahe): Remove this method when we don't generate closure classes 833 // TODO(ahe): Remove this method when we don't generate closure classes
834 // anymore. 834 // anymore.
835 void addClosureClassNote(Class closureClass) { 835 void addClosureClassNote(Class closureClass) {
836 closureClass.addMember(new Field(new Name("note"), 836 closureClass.addMember(new Field(new Name("note"),
837 type: coreTypes.stringClass.rawType, 837 type: coreTypes.stringClass.rawType,
838 initializer: new StringLiteral( 838 initializer: new StringLiteral(
839 "This is temporary. The VM doesn't need closure classes."), 839 "This is temporary. The VM doesn't need closure classes."),
840 fileUri: currentFileUri)); 840 fileUri: currentFileUri));
841 } 841 }
842 } 842 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698