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

Side by Side Diff: lib/compiler/implementation/compile_time_constants.dart

Issue 10890007: Remove more warnings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
« no previous file with comments | « no previous file | lib/compiler/implementation/elements/elements.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 class Constant implements Hashable { 5 class Constant implements Hashable {
6 const Constant(); 6 const Constant();
7 7
8 bool isNull() => false; 8 bool isNull() => false;
9 bool isBool() => false; 9 bool isBool() => false;
10 bool isTrue() => false; 10 bool isTrue() => false;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 return other.element === element; 46 return other.element === element;
47 } 47 }
48 48
49 String toString() => element.toString(); 49 String toString() => element.toString();
50 List<Constant> getDependencies() => const <Constant>[]; 50 List<Constant> getDependencies() => const <Constant>[];
51 DartString toDartString() { 51 DartString toDartString() {
52 return new DartString.literal(element.name.slowToString()); 52 return new DartString.literal(element.name.slowToString());
53 } 53 }
54 54
55 void _writeJsCode(CodeBuffer buffer, ConstantHandler handler) { 55 void _writeJsCode(CodeBuffer buffer, ConstantHandler handler) {
56 compiler.internalError( 56 handler.compiler.internalError(
57 "A constant function does not need specific JS code"); 57 "A constant function does not need specific JS code");
58 } 58 }
59 59
60 void _writeCanonicalizedJsCode(CodeBuffer buffer, ConstantHandler handler) { 60 void _writeCanonicalizedJsCode(CodeBuffer buffer, ConstantHandler handler) {
61 buffer.add(handler.compiler.namer.isolatePropertiesAccess(element)); 61 buffer.add(handler.compiler.namer.isolatePropertiesAccess(element));
62 } 62 }
63 63
64 int hashCode() => element.hashCode(); 64 int hashCode() => element.hashCode();
65 } 65 }
66 66
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 accumulator = new DartString.concat(accumulator, partString.value); 866 accumulator = new DartString.concat(accumulator, partString.value);
867 }; 867 };
868 return new StringConstant(accumulator, node); 868 return new StringConstant(accumulator, node);
869 } 869 }
870 870
871 // TODO(floitsch): provide better error-messages. 871 // TODO(floitsch): provide better error-messages.
872 Constant visitSend(Send send) { 872 Constant visitSend(Send send) {
873 Element element = elements[send]; 873 Element element = elements[send];
874 if (Elements.isStaticOrTopLevelField(element)) { 874 if (Elements.isStaticOrTopLevelField(element)) {
875 if (element.modifiers === null || 875 if (element.modifiers === null ||
876 // TODO(johnniwinther): This should eventually be [isConst]. 876 // TODO(johnniwinther): This should eventually be [isConst].
877 !element.modifiers.isFinalOrConst()) { 877 !element.modifiers.isFinalOrConst()) {
878 error(send); 878 error(send);
879 } 879 }
880 return compiler.compileVariable(element); 880 return compiler.compileVariable(element);
881 } else if (Elements.isStaticOrTopLevelFunction(element) 881 } else if (Elements.isStaticOrTopLevelFunction(element)
882 && send.isPropertyAccess) { 882 && send.isPropertyAccess) {
883 compiler.codegenWorld.staticFunctionsNeedingGetter.add(element); 883 compiler.codegenWorld.staticFunctionsNeedingGetter.add(element);
884 Constant constant = new FunctionConstant(element); 884 Constant constant = new FunctionConstant(element);
885 compiler.constantHandler.registerCompileTimeConstant(constant); 885 compiler.constantHandler.registerCompileTimeConstant(constant);
886 return constant; 886 return constant;
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 Constant fieldValue = fieldValues[field]; 1210 Constant fieldValue = fieldValues[field];
1211 if (fieldValue === null) { 1211 if (fieldValue === null) {
1212 // Use the default value. 1212 // Use the default value.
1213 fieldValue = compiler.compileVariable(field); 1213 fieldValue = compiler.compileVariable(field);
1214 } 1214 }
1215 jsNewArguments.add(fieldValue); 1215 jsNewArguments.add(fieldValue);
1216 }); 1216 });
1217 return jsNewArguments; 1217 return jsNewArguments;
1218 } 1218 }
1219 } 1219 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698