| OLD | NEW |
| 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 '../constants/values.dart' as values; | 7 import '../constants/values.dart' as values; |
| 8 import '../dart_types.dart' as types; | 8 import '../dart_types.dart' as types; |
| 9 import '../dart2jslib.dart' as dart2js; | 9 import '../dart2jslib.dart' as dart2js; |
| 10 import '../elements/elements.dart' as elements; | 10 import '../elements/elements.dart' as elements; |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 param.type == null ? null : makeType(param.type), | 926 param.type == null ? null : makeType(param.type), |
| 927 makeEmptyModifiers(), // TODO: Parameter modifiers? | 927 makeEmptyModifiers(), // TODO: Parameter modifiers? |
| 928 singleton(definition)); | 928 singleton(definition)); |
| 929 } | 929 } |
| 930 } | 930 } |
| 931 | 931 |
| 932 tree.Modifiers makeEmptyModifiers() { | 932 tree.Modifiers makeEmptyModifiers() { |
| 933 return new tree.Modifiers(blankList()); | 933 return new tree.Modifiers(blankList()); |
| 934 } | 934 } |
| 935 | 935 |
| 936 tree.Modifiers makeModifiers({bool isStatic: false, | 936 tree.Modifiers makeModifiers({bool isExternal: false, |
| 937 bool isStatic: false, |
| 937 bool isAbstract: false, | 938 bool isAbstract: false, |
| 938 bool isFactory: false, | 939 bool isFactory: false, |
| 939 bool isConst: false, | 940 bool isConst: false, |
| 940 bool isFinal: false, | 941 bool isFinal: false, |
| 941 bool isVar: false}) { | 942 bool isVar: false}) { |
| 942 List<tree.Node> nodes = []; | 943 List<tree.Node> nodes = []; |
| 944 if (isExternal) { |
| 945 nodes.add(makeIdentifier('external')); |
| 946 } |
| 943 if (isStatic) { | 947 if (isStatic) { |
| 944 nodes.add(makeIdentifier('static')); | 948 nodes.add(makeIdentifier('static')); |
| 945 } | 949 } |
| 946 if (isAbstract) { | 950 if (isAbstract) { |
| 947 nodes.add(makeIdentifier('abstract')); | 951 nodes.add(makeIdentifier('abstract')); |
| 948 } | 952 } |
| 949 if (isFactory) { | 953 if (isFactory) { |
| 950 nodes.add(makeIdentifier('factory')); | 954 nodes.add(makeIdentifier('factory')); |
| 951 } | 955 } |
| 952 if (isConst) { | 956 if (isConst) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 964 tree.Modifiers makeVarModifiers({bool isConst: false, | 968 tree.Modifiers makeVarModifiers({bool isConst: false, |
| 965 bool isFinal: false, | 969 bool isFinal: false, |
| 966 bool useVar: false}) { | 970 bool useVar: false}) { |
| 967 return makeModifiers(isConst: isConst, | 971 return makeModifiers(isConst: isConst, |
| 968 isFinal: isFinal, | 972 isFinal: isFinal, |
| 969 isVar: useVar && !(isConst || isFinal)); | 973 isVar: useVar && !(isConst || isFinal)); |
| 970 } | 974 } |
| 971 | 975 |
| 972 tree.Modifiers makeFunctionModifiers(FunctionExpression exp) { | 976 tree.Modifiers makeFunctionModifiers(FunctionExpression exp) { |
| 973 if (exp.element == null) return makeEmptyModifiers(); | 977 if (exp.element == null) return makeEmptyModifiers(); |
| 974 return makeModifiers(isStatic: exp.element.isStatic, | 978 return makeModifiers(isExternal: exp.element.isExternal, |
| 979 isStatic: exp.element.isStatic, |
| 975 isFactory: exp.element.isFactoryConstructor); | 980 isFactory: exp.element.isFactoryConstructor); |
| 976 } | 981 } |
| 977 | 982 |
| 978 tree.Node makeNodeForClassElement(elements.ClassElement cls) { | 983 tree.Node makeNodeForClassElement(elements.ClassElement cls) { |
| 979 if (cls.isMixinApplication) { | 984 if (cls.isMixinApplication) { |
| 980 return makeNamedMixinApplication(cls); | 985 return makeNamedMixinApplication(cls); |
| 981 } else { | 986 } else { |
| 982 return makeClassNode(cls); | 987 return makeClassNode(cls); |
| 983 } | 988 } |
| 984 } | 989 } |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1208 printStringChunk(chunk.previous), | 1213 printStringChunk(chunk.previous), |
| 1209 node); | 1214 node); |
| 1210 } else { | 1215 } else { |
| 1211 return node; | 1216 return node; |
| 1212 } | 1217 } |
| 1213 } | 1218 } |
| 1214 return printStringChunk(output.chunk); | 1219 return printStringChunk(output.chunk); |
| 1215 } | 1220 } |
| 1216 | 1221 |
| 1217 } | 1222 } |
| OLD | NEW |