Chromium Code Reviews| 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 library native; | 5 library native; |
| 6 | 6 |
| 7 import 'dart:uri'; | 7 import 'dart:uri'; |
| 8 import 'dart2jslib.dart' hide SourceString; | 8 import 'dart2jslib.dart' hide SourceString; |
| 9 import 'elements/elements.dart'; | 9 import 'elements/elements.dart'; |
| 10 import 'js_backend/js_backend.dart'; | 10 import 'js_backend/js_backend.dart'; |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 794 Compiler compiler = builder.compiler; | 794 Compiler compiler = builder.compiler; |
| 795 FunctionElement element = builder.work.element; | 795 FunctionElement element = builder.work.element; |
| 796 NativeEmitter nativeEmitter = builder.emitter.nativeEmitter; | 796 NativeEmitter nativeEmitter = builder.emitter.nativeEmitter; |
| 797 // If what we're compiling is a getter named 'typeName' and the native | 797 // If what we're compiling is a getter named 'typeName' and the native |
| 798 // class is named 'DOMType', we generate a call to the typeNameOf | 798 // class is named 'DOMType', we generate a call to the typeNameOf |
| 799 // function attached on the isolate. | 799 // function attached on the isolate. |
| 800 // The DOM classes assume that their 'typeName' property, which is | 800 // The DOM classes assume that their 'typeName' property, which is |
| 801 // not a JS property on the DOM types, returns the type name. | 801 // not a JS property on the DOM types, returns the type name. |
| 802 if (element.name == const SourceString('typeName') | 802 if (element.name == const SourceString('typeName') |
| 803 && element.isGetter() | 803 && element.isGetter() |
| 804 && nativeEmitter.toNativeName(element.getEnclosingClass()) == 'DOMType') { | 804 && nativeEmitter.toNativeTag(element.getEnclosingClass()) == 'DOMType') { |
|
karlklose
2012/12/06 11:39:23
@sra: Is this dead code? The method name was chang
sra1
2012/12/10 22:46:11
Yup, it looks dead. lgtm to remove lines 797-809
| |
| 805 Element helper = | 805 Element helper = |
| 806 compiler.findHelper(const SourceString('getTypeNameOf')); | 806 compiler.findHelper(const SourceString('getTypeNameOf')); |
| 807 builder.pushInvokeHelper1(helper, builder.localsHandler.readThis()); | 807 builder.pushInvokeHelper1(helper, builder.localsHandler.readThis()); |
| 808 builder.close(new HReturn(builder.pop())).addSuccessor(builder.graph.exit); | 808 builder.close(new HReturn(builder.pop())).addSuccessor(builder.graph.exit); |
| 809 } | 809 } |
| 810 | 810 |
| 811 HInstruction convertDartClosure(Element parameter, FunctionType type) { | 811 HInstruction convertDartClosure(Element parameter, FunctionType type) { |
| 812 HInstruction local = builder.localsHandler.readLocal(parameter); | 812 HInstruction local = builder.localsHandler.readLocal(parameter); |
| 813 Constant arityConstant = | 813 Constant arityConstant = |
| 814 builder.constantSystem.createInt(type.computeArity()); | 814 builder.constantSystem.createInt(type.computeArity()); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 901 builder.add(new HForeign( | 901 builder.add(new HForeign( |
| 902 new DartString.literal('${parameter.name.slowToString()} = #'), | 902 new DartString.literal('${parameter.name.slowToString()} = #'), |
| 903 const LiteralDartString('void'), | 903 const LiteralDartString('void'), |
| 904 <HInstruction>[jsClosure])); | 904 <HInstruction>[jsClosure])); |
| 905 } | 905 } |
| 906 }); | 906 }); |
| 907 LiteralString jsCode = nativeBody.asLiteralString(); | 907 LiteralString jsCode = nativeBody.asLiteralString(); |
| 908 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); | 908 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); |
| 909 } | 909 } |
| 910 } | 910 } |
| OLD | NEW |