OLD | NEW |
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 part of js_backend; | 5 part of js_backend; |
6 | 6 |
7 typedef jsAst.Expression _ConstantReferenceGenerator(ConstantValue constant); | 7 typedef jsAst.Expression _ConstantReferenceGenerator(ConstantValue constant); |
8 | 8 |
9 typedef jsAst.Expression _ConstantListGenerator(jsAst.Expression array); | 9 typedef jsAst.Expression _ConstantListGenerator(jsAst.Expression array); |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 reporter.internalError(NO_LOCATION_SPANNABLE, | 57 reporter.internalError(NO_LOCATION_SPANNABLE, |
58 "The function constant does not need specific JS code."); | 58 "The function constant does not need specific JS code."); |
59 return null; | 59 return null; |
60 } | 60 } |
61 | 61 |
62 @override | 62 @override |
63 jsAst.Expression visitNull(NullConstantValue constant, [_]) { | 63 jsAst.Expression visitNull(NullConstantValue constant, [_]) { |
64 return new jsAst.LiteralNull(); | 64 return new jsAst.LiteralNull(); |
65 } | 65 } |
66 | 66 |
67 @override | |
68 jsAst.Expression visitNonConstant(NonConstantValue constant, [_]) { | |
69 return new jsAst.LiteralNull(); | |
70 } | |
71 | |
72 static final _exponentialRE = new RegExp('^' | 67 static final _exponentialRE = new RegExp('^' |
73 '\([-+]?\)' // 1: sign | 68 '\([-+]?\)' // 1: sign |
74 '\([0-9]+\)' // 2: leading digit(s) | 69 '\([0-9]+\)' // 2: leading digit(s) |
75 '\(\.\([0-9]*\)\)?' // 4: fraction digits | 70 '\(\.\([0-9]*\)\)?' // 4: fraction digits |
76 'e\([-+]?[0-9]+\)' // 5: exponent with sign | 71 'e\([-+]?[0-9]+\)' // 5: exponent with sign |
77 r'$'); | 72 r'$'); |
78 | 73 |
79 /// Reduces the size of exponential representations when minification is | 74 /// Reduces the size of exponential representations when minification is |
80 /// enabled. | 75 /// enabled. |
81 /// | 76 /// |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 [value, argumentList]); | 316 [value, argumentList]); |
322 } | 317 } |
323 return value; | 318 return value; |
324 } | 319 } |
325 | 320 |
326 @override | 321 @override |
327 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) { | 322 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) { |
328 return constantReferenceGenerator(constant.referenced); | 323 return constantReferenceGenerator(constant.referenced); |
329 } | 324 } |
330 } | 325 } |
OLD | NEW |