Chromium Code Reviews| 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 // TODO(ahe): Share these with js_helper.dart. | 7 // TODO(ahe): Share these with js_helper.dart. |
| 8 const FUNCTION_INDEX = 0; | 8 const FUNCTION_INDEX = 0; |
| 9 const NAME_INDEX = 1; | 9 const NAME_INDEX = 1; |
| 10 const CALL_NAME_INDEX = 2; | 10 const CALL_NAME_INDEX = 2; |
| 11 const REQUIRED_PARAMETER_INDEX = 3; | 11 const REQUIRED_PARAMETER_INDEX = 3; |
| 12 const OPTIONAL_PARAMETER_INDEX = 4; | 12 const OPTIONAL_PARAMETER_INDEX = 4; |
| 13 const DEFAULT_ARGUMENTS_INDEX = 5; | 13 const DEFAULT_ARGUMENTS_INDEX = 5; |
| 14 | 14 |
| 15 const bool VALIDATE_DATA = false; | 15 const bool VALIDATE_DATA = false; |
| 16 | 16 |
| 17 // TODO(zarah): Rename this when renaming this file. | 17 // TODO(zarah): Rename this when renaming this file. |
| 18 String get parseReflectionDataName => 'parseReflectionData'; | 18 String get parseReflectionDataName => 'parseReflectionData'; |
| 19 | 19 |
| 20 jsAst.Expression getReflectionDataParser(OldEmitter oldEmitter, | 20 jsAst.Expression getReflectionDataParser(OldEmitter oldEmitter, |
| 21 JavaScriptBackend backend) { | 21 JavaScriptBackend backend, |
| 22 bool hasNativeClasses) { | |
| 22 Namer namer = backend.namer; | 23 Namer namer = backend.namer; |
| 23 Compiler compiler = backend.compiler; | 24 Compiler compiler = backend.compiler; |
| 24 CodeEmitterTask emitter = backend.emitter; | 25 CodeEmitterTask emitter = backend.emitter; |
| 25 | 26 |
| 26 String metadataField = '"${namer.metadataField}"'; | |
|
floitsch
2015/01/26 13:34:12
was unused before.
| |
| 27 String reflectableField = namer.reflectableField; | 27 String reflectableField = namer.reflectableField; |
| 28 String reflectionInfoField = namer.reflectionInfoField; | 28 String reflectionInfoField = namer.reflectionInfoField; |
| 29 String reflectionNameField = namer.reflectionNameField; | 29 String reflectionNameField = namer.reflectionNameField; |
| 30 String metadataIndexField = namer.metadataIndexField; | 30 String metadataIndexField = namer.metadataIndexField; |
| 31 String defaultValuesField = namer.defaultValuesField; | 31 String defaultValuesField = namer.defaultValuesField; |
| 32 String methodsWithOptionalArgumentsField = | 32 String methodsWithOptionalArgumentsField = |
| 33 namer.methodsWithOptionalArgumentsField; | 33 namer.methodsWithOptionalArgumentsField; |
| 34 | 34 |
| 35 String unmangledNameIndex = backend.mustRetainMetadata | 35 String unmangledNameIndex = backend.mustRetainMetadata |
| 36 ? ' 3 * optionalParameterCount + 2 * requiredParameterCount + 3' | 36 ? ' 3 * optionalParameterCount + 2 * requiredParameterCount + 3' |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 407 | 407 |
| 408 #finishClassFunction; | 408 #finishClassFunction; |
| 409 | 409 |
| 410 #trivialNsmHandlers; | 410 #trivialNsmHandlers; |
| 411 | 411 |
| 412 for (var cls in processedClasses.pending) finishClass(cls); | 412 for (var cls in processedClasses.pending) finishClass(cls); |
| 413 } | 413 } |
| 414 }''', {'allClasses': allClassesAccess, | 414 }''', {'allClasses': allClassesAccess, |
| 415 'debugFastObjects': DEBUG_FAST_OBJECTS, | 415 'debugFastObjects': DEBUG_FAST_OBJECTS, |
| 416 'isTreeShakingDisabled': backend.isTreeShakingDisabled, | 416 'isTreeShakingDisabled': backend.isTreeShakingDisabled, |
| 417 'finishClassFunction': oldEmitter.buildFinishClass(), | 417 'finishClassFunction': oldEmitter.buildFinishClass(hasNativeClasses), |
| 418 'trivialNsmHandlers': oldEmitter.buildTrivialNsmHandlers(), | 418 'trivialNsmHandlers': oldEmitter.buildTrivialNsmHandlers(), |
| 419 'inCspMode': compiler.useContentSecurityPolicy, | 419 'inCspMode': compiler.useContentSecurityPolicy, |
| 420 'notInCspMode': !compiler.useContentSecurityPolicy}); | 420 'notInCspMode': !compiler.useContentSecurityPolicy}); |
| 421 | 421 |
| 422 List<jsAst.Statement> incrementalSupport = <jsAst.Statement>[]; | 422 List<jsAst.Statement> incrementalSupport = <jsAst.Statement>[]; |
| 423 if (compiler.hasIncrementalSupport) { | 423 if (compiler.hasIncrementalSupport) { |
| 424 incrementalSupport.add( | 424 incrementalSupport.add( |
| 425 js.statement( | 425 js.statement( |
| 426 '#.addStubs = addStubs;', [namer.accessIncrementalHelper])); | 426 '#.addStubs = addStubs;', [namer.accessIncrementalHelper])); |
| 427 } | 427 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 568 (function() { | 568 (function() { |
| 569 var result = $array[$index]; | 569 var result = $array[$index]; |
| 570 if ($check) { | 570 if ($check) { |
| 571 throw new Error( | 571 throw new Error( |
| 572 name + ": expected value of type \'$type\' at index " + ($index) + | 572 name + ": expected value of type \'$type\' at index " + ($index) + |
| 573 " but got " + (typeof result)); | 573 " but got " + (typeof result)); |
| 574 } | 574 } |
| 575 return result; | 575 return result; |
| 576 })()'''; | 576 })()'''; |
| 577 } | 577 } |
| OLD | NEW |