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 package com.google.dart.compiler.backend.js; | 5 package com.google.dart.compiler.backend.js; |
6 | 6 |
7 import com.google.common.collect.Lists; | 7 import com.google.common.collect.Lists; |
8 import com.google.dart.compiler.DartCompilationError; | 8 import com.google.dart.compiler.DartCompilationError; |
9 import com.google.dart.compiler.DartCompilerContext; | 9 import com.google.dart.compiler.DartCompilerContext; |
10 import com.google.dart.compiler.InternalCompilerException; | 10 import com.google.dart.compiler.InternalCompilerException; |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 JsFunction getterFn = AstUtil.newFunction(globalScope, null, null, | 565 JsFunction getterFn = AstUtil.newFunction(globalScope, null, null, |
566 new JsReturn(fnName.makeRef())); | 566 new JsReturn(fnName.makeRef())); |
567 | 567 |
568 // Declare it. | 568 // Declare it. |
569 JsExpression declStmt = AstUtil.newAssignment( | 569 JsExpression declStmt = AstUtil.newAssignment( |
570 getIsolateFactoryGetterName(classElement), getterFn); | 570 getIsolateFactoryGetterName(classElement), getterFn); |
571 globalBlock.getStatements().add(declStmt.makeStmt()); | 571 globalBlock.getStatements().add(declStmt.makeStmt()); |
572 } | 572 } |
573 | 573 |
574 private boolean isIsolateClass(ClassElement classElement) { | 574 private boolean isIsolateClass(ClassElement classElement) { |
575 InterfaceType classType = classElement.getType(); | 575 return false; |
576 return TypeKind.of(classType) == TypeKind.INTERFACE | |
577 && typeUtils.isSubtype(classType, typeProvider.getIsolateType()); | |
578 } | 576 } |
579 | 577 |
580 /** | 578 /** |
581 * Creates a $getter for a method of a class, returning $method as a closure | 579 * Creates a $getter for a method of a class, returning $method as a closure |
582 * bound to the current instance if it is an instance method. | 580 * bound to the current instance if it is an instance method. |
583 */ | 581 */ |
584 private void generateMethodGetter(MethodElement methodElement) { | 582 private void generateMethodGetter(MethodElement methodElement) { |
585 // Generate a getter for method binding to a variable | 583 // Generate a getter for method binding to a variable |
586 boolean isTopLevel = Elements.isTopLevel(methodElement); | 584 boolean isTopLevel = Elements.isTopLevel(methodElement); |
587 if (methodElement.getModifiers().isGetter() || methodElement.getModifiers(
).isSetter()) { | 585 if (methodElement.getModifiers().isGetter() || methodElement.getModifiers(
).isSetter()) { |
(...skipping 3282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3870 JsBlock blockStatics) { | 3868 JsBlock blockStatics) { |
3871 GenerateJavascriptVisitor generator = | 3869 GenerateJavascriptVisitor generator = |
3872 new GenerateJavascriptVisitor(unit, context, translationContext, | 3870 new GenerateJavascriptVisitor(unit, context, translationContext, |
3873 typeProvider); | 3871 typeProvider); |
3874 // Generate the Javascript AST. | 3872 // Generate the Javascript AST. |
3875 node.accept(generator); | 3873 node.accept(generator); |
3876 // Set aside the static initializations | 3874 // Set aside the static initializations |
3877 generator.addStaticInitsToBlock(blockStatics); | 3875 generator.addStaticInitsToBlock(blockStatics); |
3878 } | 3876 } |
3879 } | 3877 } |
OLD | NEW |