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

Side by Side Diff: pkg/fletchc/lib/src/fletch_constants.dart

Issue 1059573004: Compile tearoffs of static functions as constants. (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: Created 5 years, 8 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 Fletch project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Fletch 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 library fletchc.fletch_constants; 5 library fletchc.fletch_constants;
6 6
7 import 'package:compiler/src/constants/expressions.dart' show 7 import 'package:compiler/src/constants/expressions.dart' show
8 ConstantExpression; 8 ConstantExpression;
9 9
10 import 'package:compiler/src/constants/values.dart' show 10 import 'package:compiler/src/constants/values.dart' show
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 accept(visitor, arg) { 53 accept(visitor, arg) {
54 throw new UnsupportedError("FletchClassConstant.accept"); 54 throw new UnsupportedError("FletchClassConstant.accept");
55 } 55 }
56 56
57 String unparse() => toStructuredString(); 57 String unparse() => toStructuredString();
58 58
59 String toStructuredString() { 59 String toStructuredString() {
60 return 'FletchClassConstant($classId)'; 60 return 'FletchClassConstant($classId)';
61 } 61 }
62 } 62 }
63
64 class FletchClassInstanceConstant extends ConstantValue {
ahe 2015/04/07 15:00:11 Why is this needed?
Anders Johnsen 2015/04/08 06:32:14 Because we create artificial constants, not presen
65 final int classId;
66
67 FletchClassInstanceConstant(this.classId);
68
69 DartType getType(CoreTypes types) => const DynamicType();
70
71 List<ConstantValue> getDependencies() => const <ConstantValue>[];
72
73 accept(visitor, arg) {
74 throw new UnsupportedError("FletchClassInstanceConstant.accept");
75 }
76
77 String unparse() => toStructuredString();
78
79 String toStructuredString() {
80 return 'FletchClassInstanceConstant($classId)';
81 }
82 }
OLDNEW
« pkg/fletchc/lib/src/codegen_visitor.dart ('K') | « pkg/fletchc/lib/src/fletch_backend.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698