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

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

Issue 10880068: - Change "static final" to "static const" in the lib/ directory. (Closed) Base URL: http://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
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 #library('elements'); 5 #library('elements');
6 6
7 #import('dart:uri'); 7 #import('dart:uri');
8 8
9 #import('../tree/tree.dart'); 9 #import('../tree/tree.dart');
10 #import('../scanner/scannerlib.dart'); 10 #import('../scanner/scannerlib.dart');
11 #import('../leg.dart'); // TODO(karlklose): we only need type. 11 #import('../leg.dart'); // TODO(karlklose): we only need type.
12 #import('../util/util.dart'); 12 #import('../util/util.dart');
13 13
14 const int STATE_NOT_STARTED = 0; 14 const int STATE_NOT_STARTED = 0;
15 const int STATE_STARTED = 1; 15 const int STATE_STARTED = 1;
16 const int STATE_DONE = 2; 16 const int STATE_DONE = 2;
17 17
18 class ElementCategory { 18 class ElementCategory {
19 /** 19 /**
20 * Represents things that we don't expect to find when looking in a 20 * Represents things that we don't expect to find when looking in a
21 * scope. 21 * scope.
22 */ 22 */
23 static final int NONE = 0; 23 static const int NONE = 0;
24 24
25 /** Field, parameter, or variable. */ 25 /** Field, parameter, or variable. */
26 static final int VARIABLE = 1; 26 static const int VARIABLE = 1;
27 27
28 /** Function, method, or foreign function. */ 28 /** Function, method, or foreign function. */
29 static final int FUNCTION = 2; 29 static const int FUNCTION = 2;
30 30
31 static final int CLASS = 4; 31 static const int CLASS = 4;
32 32
33 static final int PREFIX = 8; 33 static const int PREFIX = 8;
34 34
35 /** Constructor or factory. */ 35 /** Constructor or factory. */
36 static final int FACTORY = 16; 36 static const int FACTORY = 16;
37 37
38 static final int ALIAS = 32; 38 static const int ALIAS = 32;
39 39
40 static final int SUPER = 64; 40 static const int SUPER = 64;
41 41
42 /** Type variable */ 42 /** Type variable */
43 static final int TYPE_VARIABLE = 128; 43 static const int TYPE_VARIABLE = 128;
44 44
45 static final int IMPLIES_TYPE = CLASS | ALIAS | TYPE_VARIABLE; 45 static const int IMPLIES_TYPE = CLASS | ALIAS | TYPE_VARIABLE;
46 46
47 static final int IS_EXTENDABLE = CLASS | ALIAS; 47 static const int IS_EXTENDABLE = CLASS | ALIAS;
48 } 48 }
49 49
50 class ElementKind { 50 class ElementKind {
51 final String id; 51 final String id;
52 final int category; 52 final int category;
53 53
54 const ElementKind(String this.id, this.category); 54 const ElementKind(String this.id, this.category);
55 55
56 static final ElementKind VARIABLE = 56 static const ElementKind VARIABLE =
57 const ElementKind('variable', ElementCategory.VARIABLE); 57 const ElementKind('variable', ElementCategory.VARIABLE);
58 static final ElementKind PARAMETER = 58 static const ElementKind PARAMETER =
59 const ElementKind('parameter', ElementCategory.VARIABLE); 59 const ElementKind('parameter', ElementCategory.VARIABLE);
60 // Parameters in constructors that directly initialize fields. For example: 60 // Parameters in constructors that directly initialize fields. For example:
61 // [:A(this.field):]. 61 // [:A(this.field):].
62 static final ElementKind FIELD_PARAMETER = 62 static const ElementKind FIELD_PARAMETER =
63 const ElementKind('field_parameter', ElementCategory.VARIABLE); 63 const ElementKind('field_parameter', ElementCategory.VARIABLE);
64 static final ElementKind FUNCTION = 64 static const ElementKind FUNCTION =
65 const ElementKind('function', ElementCategory.FUNCTION); 65 const ElementKind('function', ElementCategory.FUNCTION);
66 static final ElementKind CLASS = 66 static const ElementKind CLASS =
67 const ElementKind('class', ElementCategory.CLASS); 67 const ElementKind('class', ElementCategory.CLASS);
68 static final ElementKind FOREIGN = 68 static const ElementKind FOREIGN =
69 const ElementKind('foreign', ElementCategory.FUNCTION); 69 const ElementKind('foreign', ElementCategory.FUNCTION);
70 static final ElementKind GENERATIVE_CONSTRUCTOR = 70 static const ElementKind GENERATIVE_CONSTRUCTOR =
71 const ElementKind('generative_constructor', ElementCategory.FACTORY); 71 const ElementKind('generative_constructor', ElementCategory.FACTORY);
72 static final ElementKind FIELD = 72 static const ElementKind FIELD =
73 const ElementKind('field', ElementCategory.VARIABLE); 73 const ElementKind('field', ElementCategory.VARIABLE);
74 static final ElementKind VARIABLE_LIST = 74 static const ElementKind VARIABLE_LIST =
75 const ElementKind('variable_list', ElementCategory.NONE); 75 const ElementKind('variable_list', ElementCategory.NONE);
76 static final ElementKind FIELD_LIST = 76 static const ElementKind FIELD_LIST =
77 const ElementKind('field_list', ElementCategory.NONE); 77 const ElementKind('field_list', ElementCategory.NONE);
78 static final ElementKind GENERATIVE_CONSTRUCTOR_BODY = 78 static const ElementKind GENERATIVE_CONSTRUCTOR_BODY =
79 const ElementKind('generative_constructor_body', ElementCategory.NONE); 79 const ElementKind('generative_constructor_body', ElementCategory.NONE);
80 static final ElementKind COMPILATION_UNIT = 80 static const ElementKind COMPILATION_UNIT =
81 const ElementKind('compilation_unit', ElementCategory.NONE); 81 const ElementKind('compilation_unit', ElementCategory.NONE);
82 static final ElementKind GETTER = 82 static const ElementKind GETTER =
83 const ElementKind('getter', ElementCategory.NONE); 83 const ElementKind('getter', ElementCategory.NONE);
84 static final ElementKind SETTER = 84 static const ElementKind SETTER =
85 const ElementKind('setter', ElementCategory.NONE); 85 const ElementKind('setter', ElementCategory.NONE);
86 static final ElementKind TYPE_VARIABLE = 86 static const ElementKind TYPE_VARIABLE =
87 const ElementKind('type_variable', ElementCategory.TYPE_VARIABLE); 87 const ElementKind('type_variable', ElementCategory.TYPE_VARIABLE);
88 static final ElementKind ABSTRACT_FIELD = 88 static const ElementKind ABSTRACT_FIELD =
89 const ElementKind('abstract_field', ElementCategory.VARIABLE); 89 const ElementKind('abstract_field', ElementCategory.VARIABLE);
90 static final ElementKind LIBRARY = 90 static const ElementKind LIBRARY =
91 const ElementKind('library', ElementCategory.NONE); 91 const ElementKind('library', ElementCategory.NONE);
92 static final ElementKind COMPILATION_UNIT_OVERRIDE = 92 static const ElementKind COMPILATION_UNIT_OVERRIDE =
93 const ElementKind('compilation_unit_override', ElementCategory.NONE); 93 const ElementKind('compilation_unit_override', ElementCategory.NONE);
94 static final ElementKind PREFIX = 94 static const ElementKind PREFIX =
95 const ElementKind('prefix', ElementCategory.PREFIX); 95 const ElementKind('prefix', ElementCategory.PREFIX);
96 static final ElementKind TYPEDEF = 96 static const ElementKind TYPEDEF =
97 const ElementKind('typedef', ElementCategory.ALIAS); 97 const ElementKind('typedef', ElementCategory.ALIAS);
98 98
99 static final ElementKind STATEMENT = 99 static const ElementKind STATEMENT =
100 const ElementKind('statement', ElementCategory.NONE); 100 const ElementKind('statement', ElementCategory.NONE);
101 static final ElementKind LABEL = 101 static const ElementKind LABEL =
102 const ElementKind('label', ElementCategory.NONE); 102 const ElementKind('label', ElementCategory.NONE);
103 static final ElementKind VOID = 103 static const ElementKind VOID =
104 const ElementKind('void', ElementCategory.NONE); 104 const ElementKind('void', ElementCategory.NONE);
105 105
106 toString() => id; 106 toString() => id;
107 } 107 }
108 108
109 class Element implements Hashable { 109 class Element implements Hashable {
110 final SourceString name; 110 final SourceString name;
111 final ElementKind kind; 111 final ElementKind kind;
112 final Element enclosingElement; 112 final Element enclosingElement;
113 Link<MetadataAnnotation> metadata = const EmptyLink<MetadataAnnotation>(); 113 Link<MetadataAnnotation> metadata = const EmptyLink<MetadataAnnotation>();
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 return isLocal(element); 1453 return isLocal(element);
1454 } 1454 }
1455 1455
1456 static SourceString constructConstructorName(SourceString receiver, 1456 static SourceString constructConstructorName(SourceString receiver,
1457 SourceString selector) { 1457 SourceString selector) {
1458 String r = receiver.slowToString(); 1458 String r = receiver.slowToString();
1459 String s = selector.slowToString(); 1459 String s = selector.slowToString();
1460 return new SourceString('$r\$$s'); 1460 return new SourceString('$r\$$s');
1461 } 1461 }
1462 1462
1463 static final SourceString OPERATOR_EQUALS = 1463 static const SourceString OPERATOR_EQUALS =
1464 const SourceString(@'operator$eq'); 1464 const SourceString(@'operator$eq');
1465 1465
1466 static SourceString constructOperatorName(SourceString receiver, 1466 static SourceString constructOperatorName(SourceString receiver,
1467 SourceString selector, 1467 SourceString selector,
1468 [bool isUnary = false]) { 1468 [bool isUnary = false]) {
1469 String str = selector.stringValue; 1469 String str = selector.stringValue;
1470 if (str === '==' || str === '!=') return OPERATOR_EQUALS; 1470 if (str === '==' || str === '!=') return OPERATOR_EQUALS;
1471 1471
1472 if (str === '~') str = 'not'; 1472 if (str === '~') str = 'not';
1473 else if (str === 'negate' || (str === '-' && isUnary)) str = 'negate'; 1473 else if (str === 'negate' || (str === '-' && isUnary)) str = 'negate';
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 1629
1630 MetadataAnnotation ensureResolved(Compiler compiler) { 1630 MetadataAnnotation ensureResolved(Compiler compiler) {
1631 if (resolutionState == STATE_NOT_STARTED) { 1631 if (resolutionState == STATE_NOT_STARTED) {
1632 compiler.resolver.resolveMetadataAnnotation(this); 1632 compiler.resolver.resolveMetadataAnnotation(this);
1633 } 1633 }
1634 return this; 1634 return this;
1635 } 1635 }
1636 1636
1637 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 1637 String toString() => 'MetadataAnnotation($value, $resolutionState)';
1638 } 1638 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/dart2js.dart ('k') | lib/compiler/implementation/js/precedence.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698