| 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 bool needsNativeSupport) { |
| 23 Namer namer = backend.namer; | 23 Namer namer = backend.namer; |
| 24 Compiler compiler = backend.compiler; | 24 Compiler compiler = backend.compiler; |
| 25 CodeEmitterTask emitter = backend.emitter; | 25 CodeEmitterTask emitter = backend.emitter; |
| 26 | 26 |
| 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 = |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 #finishClassFunction; | 408 #finishClassFunction; |
| 409 | 409 |
| 410 #trivialNsmHandlers; | 410 #trivialNsmHandlers; |
| 411 | 411 |
| 412 var properties = Object.keys(processedClasses.pending); | 412 var properties = Object.keys(processedClasses.pending); |
| 413 for (var i = 0; i < properties.length; i++) finishClass(properties[i]); | 413 for (var i = 0; i < properties.length; i++) finishClass(properties[i]); |
| 414 } | 414 } |
| 415 }''', {'allClasses': allClassesAccess, | 415 }''', {'allClasses': allClassesAccess, |
| 416 'debugFastObjects': DEBUG_FAST_OBJECTS, | 416 'debugFastObjects': DEBUG_FAST_OBJECTS, |
| 417 'isTreeShakingDisabled': backend.isTreeShakingDisabled, | 417 'isTreeShakingDisabled': backend.isTreeShakingDisabled, |
| 418 'finishClassFunction': oldEmitter.buildFinishClass(hasNativeClasses), | 418 'finishClassFunction': oldEmitter.buildFinishClass(needsNativeSupport), |
| 419 'trivialNsmHandlers': oldEmitter.buildTrivialNsmHandlers(), | 419 'trivialNsmHandlers': oldEmitter.buildTrivialNsmHandlers(), |
| 420 'inCspMode': compiler.useContentSecurityPolicy, | 420 'inCspMode': compiler.useContentSecurityPolicy, |
| 421 'notInCspMode': !compiler.useContentSecurityPolicy}); | 421 'notInCspMode': !compiler.useContentSecurityPolicy}); |
| 422 | 422 |
| 423 List<jsAst.Statement> incrementalSupport = <jsAst.Statement>[]; | 423 List<jsAst.Statement> incrementalSupport = <jsAst.Statement>[]; |
| 424 if (compiler.hasIncrementalSupport) { | 424 if (compiler.hasIncrementalSupport) { |
| 425 incrementalSupport.add( | 425 incrementalSupport.add( |
| 426 js.statement( | 426 js.statement( |
| 427 '#.addStubs = addStubs;', [namer.accessIncrementalHelper])); | 427 '#.addStubs = addStubs;', [namer.accessIncrementalHelper])); |
| 428 } | 428 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 (function() { | 484 (function() { |
| 485 var result = $array[$index]; | 485 var result = $array[$index]; |
| 486 if ($check) { | 486 if ($check) { |
| 487 throw new Error( | 487 throw new Error( |
| 488 name + ": expected value of type \'$type\' at index " + ($index) + | 488 name + ": expected value of type \'$type\' at index " + ($index) + |
| 489 " but got " + (typeof result)); | 489 " but got " + (typeof result)); |
| 490 } | 490 } |
| 491 return result; | 491 return result; |
| 492 })()'''; | 492 })()'''; |
| 493 } | 493 } |
| OLD | NEW |