| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 /// Represents an entry's position in one of the global metadata arrays. | 7 /// Represents an entry's position in one of the global metadata arrays. |
| 8 /// | 8 /// |
| 9 /// [_rc] is used to count the number of references of the token in the | 9 /// [_rc] is used to count the number of references of the token in the |
| 10 /// ast for a program. | 10 /// ast for a program. |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 ? null | 215 ? null |
| 216 : _backend.constants.getConstantValue(parameter.constant); | 216 : _backend.constants.getConstantValue(parameter.constant); |
| 217 jsAst.Expression expression = (constant == null) | 217 jsAst.Expression expression = (constant == null) |
| 218 ? new jsAst.LiteralNull() | 218 ? new jsAst.LiteralNull() |
| 219 : _emitter.constantReference(constant); | 219 : _emitter.constantReference(constant); |
| 220 defaultValues.add(_addGlobalMetadata(expression)); | 220 defaultValues.add(_addGlobalMetadata(expression)); |
| 221 } | 221 } |
| 222 return defaultValues; | 222 return defaultValues; |
| 223 } | 223 } |
| 224 | 224 |
| 225 Map<ParameterElement, ParameterElement> mapRedirectingFactoryConstructorOption
alParameters( | 225 Map<ParameterElement, ParameterElement> |
| 226 FunctionSignature source, FunctionSignature target) { | 226 mapRedirectingFactoryConstructorOptionalParameters( |
| 227 FunctionSignature source, FunctionSignature target) { |
| 227 var map = <ParameterElement, ParameterElement>{}; | 228 var map = <ParameterElement, ParameterElement>{}; |
| 228 | 229 |
| 229 if (source.optionalParametersAreNamed != | 230 if (source.optionalParametersAreNamed != |
| 230 target.optionalParametersAreNamed) { | 231 target.optionalParametersAreNamed) { |
| 231 // No legal optional arguments due to mismatch between named vs positional | 232 // No legal optional arguments due to mismatch between named vs positional |
| 232 // optional arguments. | 233 // optional arguments. |
| 233 return map; | 234 return map; |
| 234 } | 235 } |
| 235 | 236 |
| 236 if (source.optionalParametersAreNamed) { | 237 if (source.optionalParametersAreNamed) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 bool checkTokensInTypes(OutputUnit outputUnit, entries) { | 355 bool checkTokensInTypes(OutputUnit outputUnit, entries) { |
| 355 UnBoundDebugger debugger = new UnBoundDebugger(outputUnit); | 356 UnBoundDebugger debugger = new UnBoundDebugger(outputUnit); |
| 356 for (_BoundMetadataEntry entry in entries) { | 357 for (_BoundMetadataEntry entry in entries) { |
| 357 if (!entry.isUsed) continue; | 358 if (!entry.isUsed) continue; |
| 358 if (debugger.findUnboundPlaceholders(entry.entry)) { | 359 if (debugger.findUnboundPlaceholders(entry.entry)) { |
| 359 return false; | 360 return false; |
| 360 } | 361 } |
| 361 } | 362 } |
| 362 return true; | 363 return true; |
| 363 } | 364 } |
| 365 |
| 364 void countTokensInTypes(Iterable<_BoundMetadataEntry> entries) { | 366 void countTokensInTypes(Iterable<_BoundMetadataEntry> entries) { |
| 365 jsAst.TokenCounter counter = new jsAst.TokenCounter(); | 367 jsAst.TokenCounter counter = new jsAst.TokenCounter(); |
| 366 entries | 368 entries |
| 367 .where((_BoundMetadataEntry e) => e._rc > 0) | 369 .where((_BoundMetadataEntry e) => e._rc > 0) |
| 368 .map((_BoundMetadataEntry e) => e.entry) | 370 .map((_BoundMetadataEntry e) => e.entry) |
| 369 .forEach(counter.countTokens); | 371 .forEach(counter.countTokens); |
| 370 } | 372 } |
| 371 | 373 |
| 372 jsAst.ArrayInitializer finalizeMap(Map<dynamic, _BoundMetadataEntry> map) { | 374 jsAst.ArrayInitializer finalizeMap(Map<dynamic, _BoundMetadataEntry> map) { |
| 373 // When in incremental mode, we allocate entries eagerly. | 375 // When in incremental mode, we allocate entries eagerly. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 if (token is _ForwardingMetadataEntry && !token.isBound) { | 420 if (token is _ForwardingMetadataEntry && !token.isBound) { |
| 419 _foundUnboundToken = true; | 421 _foundUnboundToken = true; |
| 420 } | 422 } |
| 421 } | 423 } |
| 422 | 424 |
| 423 bool findUnboundPlaceholders(jsAst.Node node) { | 425 bool findUnboundPlaceholders(jsAst.Node node) { |
| 424 node.accept(this); | 426 node.accept(this); |
| 425 return _foundUnboundToken; | 427 return _foundUnboundToken; |
| 426 } | 428 } |
| 427 } | 429 } |
| OLD | NEW |