dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.24k stars 1.57k forks source link

Weird error when compiling to JavaScript #4867

Closed stevemessick closed 9 years ago

stevemessick commented 12 years ago

Weird error when compiling to JavaScript:   WeatherController() {       view = new WeatherView();       view.close.on.click.add(hideError);   }

  void hideError(event) {     view.hideError();   } The hideError bit won't compile, while other similar calls do. Instead I had to use this workaround:   WeatherController() {       view = new WeatherView();       view.close.on.click.add((event) { hideError(); });  }

  void hideError() {     view.hideError();   }

//////////////////////////////////////////////////////////////////////////////////// Editor: 10597 OS: Linux - amd64 (3.0.0-12-generic) JVM: 1.6.0_26

SDK installed: true Dartium installed: true ////////////////////////////////////////////////////////////////////////////////////

!ENTRY com.google.dart.tools.ui 4 10001 2012-08-31 12:44:36.438 !MESSAGE Internal Error !STACK 1 Dart Model Exception: Core Exception [code 0] Failed to parse weather.dart.js         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:757)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:733)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:697)         at com.google.dart.tools.ui.internal.text.editor.DartEditor.getAST(DartEditor.java:2042)         at com.google.dart.tools.ui.internal.text.editor.CompilationUnitEditor.reconciled(CompilationUnitEditor.java:1277)         at com.google.dart.tools.ui.internal.text.dart.DartReconcilingStrategy.reconcile(DartReconcilingStrategy.java:199)         at com.google.dart.tools.ui.internal.text.dart.DartReconcilingStrategy.reconcile(DartReconcilingStrategy.java:103)         at com.google.dart.tools.ui.internal.text.functions.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:91)         at com.google.dart.tools.ui.internal.text.functions.DartCompositeReconcilingStrategy.reconcile(DartCompositeReconcilingStrategy.java:125)         at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:77)         at com.google.dart.tools.ui.internal.text.functions.DartReconciler.process(DartReconciler.java:385)         at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:206) Caused by: java.lang.NullPointerException         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.secureAnalyzeLibrary(DartCompilerUtilities.java:846)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$ResolverRunnable.run(DartCompilerUtilities.java:468)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$CompilerRunner.runSafe(DartCompilerUtilities.java:100)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:755)         ... 11 more Caused by: org.eclipse.core.runtime.CoreException: Failed to parse weather.dart.js         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:761)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:733)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:697)         at com.google.dart.tools.ui.internal.text.editor.DartEditor.getAST(DartEditor.java:2042)         at com.google.dart.tools.ui.internal.text.editor.CompilationUnitEditor.reconciled(CompilationUnitEditor.java:1277)         at com.google.dart.tools.ui.internal.text.dart.DartReconcilingStrategy.reconcile(DartReconcilingStrategy.java:199)         at com.google.dart.tools.ui.internal.text.dart.DartReconcilingStrategy.reconcile(DartReconcilingStrategy.java:103)         at com.google.dart.tools.ui.internal.text.functions.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:91)         at com.google.dart.tools.ui.internal.text.functions.DartCompositeReconcilingStrategy.reconcile(DartCompositeReconcilingStrategy.java:125)         at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:77)         at com.google.dart.tools.ui.internal.text.functions.DartReconciler.process(DartReconciler.java:385)         at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:206) Caused by: java.lang.NullPointerException         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.secureAnalyzeLibrary(DartCompilerUtilities.java:846)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$ResolverRunnable.run(DartCompilerUtilities.java:468)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$CompilerRunner.runSafe(DartCompilerUtilities.java:100)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:755)         ... 11 more !SUBENTRY 1 com.google.dart.tools.core 4 0 2012-08-31 12:44:36.438 !MESSAGE Failed to parse weather.dart.js !STACK 0 java.lang.NullPointerException         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.secureAnalyzeLibrary(DartCompilerUtilities.java:846)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$ResolverRunnable.run(DartCompilerUtilities.java:468)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$CompilerRunner.runSafe(DartCompilerUtilities.java:100)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:755)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:733)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:697)         at com.google.dart.tools.ui.internal.text.editor.DartEditor.getAST(DartEditor.java:2042)         at com.google.dart.tools.ui.internal.text.editor.CompilationUnitEditor.reconciled(CompilationUnitEditor.java:1277)         at com.google.dart.tools.ui.internal.text.dart.DartReconcilingStrategy.reconcile(DartReconcilingStrategy.java:199)         at com.google.dart.tools.ui.internal.text.dart.DartReconcilingStrategy.reconcile(DartReconcilingStrategy.java:103)         at com.google.dart.tools.ui.internal.text.functions.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:91)         at com.google.dart.tools.ui.internal.text.functions.DartCompositeReconcilingStrategy.reconcile(DartCompositeReconcilingStrategy.java:125)         at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:77)         at com.google.dart.tools.ui.internal.text.functions.DartReconciler.process(DartReconciler.java:385)         at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:206)

!ENTRY com.google.dart.tools.ui 4 10001 2012-08-31 12:46:05.306 !MESSAGE Internal Error !STACK 1 Dart Model Exception: Core Exception [code 0] Failed to parse weather.dart.js         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:757)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:733)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:697)         at com.google.dart.tools.ui.internal.text.editor.DartEditor.getAST(DartEditor.java:2042)         at com.google.dart.tools.ui.internal.text.editor.CompilationUnitEditor.reconciled(CompilationUnitEditor.java:1277)         at com.google.dart.tools.ui.internal.text.dart.DartReconcilingStrategy.reconcile(DartReconcilingStrategy.java:199)         at com.google.dart.tools.ui.internal.text.dart.DartReconcilingStrategy.reconcile(DartReconcilingStrategy.java:103)         at com.google.dart.tools.ui.internal.text.functions.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:91)         at com.google.dart.tools.ui.internal.text.functions.DartCompositeReconcilingStrategy.reconcile(DartCompositeReconcilingStrategy.java:125)         at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:77)         at com.google.dart.tools.ui.internal.text.functions.DartReconciler.process(DartReconciler.java:385)         at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:206) Caused by: java.lang.NullPointerException         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.secureAnalyzeLibrary(DartCompilerUtilities.java:846)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$ResolverRunnable.run(DartCompilerUtilities.java:468)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$CompilerRunner.runSafe(DartCompilerUtilities.java:100)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:755)         ... 11 more Caused by: org.eclipse.core.runtime.CoreException: Failed to parse weather.dart.js         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:761)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:733)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:697)         at com.google.dart.tools.ui.internal.text.editor.DartEditor.getAST(DartEditor.java:2042)         at com.google.dart.tools.ui.internal.text.editor.CompilationUnitEditor.reconciled(CompilationUnitEditor.java:1277)         at com.google.dart.tools.ui.internal.text.dart.DartReconcilingStrategy.reconcile(DartReconcilingStrategy.java:199)         at com.google.dart.tools.ui.internal.text.dart.DartReconcilingStrategy.reconcile(DartReconcilingStrategy.java:103)         at com.google.dart.tools.ui.internal.text.functions.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:91)         at com.google.dart.tools.ui.internal.text.functions.DartCompositeReconcilingStrategy.reconcile(DartCompositeReconcilingStrategy.java:125)         at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:77)         at com.google.dart.tools.ui.internal.text.functions.DartReconciler.process(DartReconciler.java:385)         at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:206) Caused by: java.lang.NullPointerException         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.secureAnalyzeLibrary(DartCompilerUtilities.java:846)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$ResolverRunnable.run(DartCompilerUtilities.java:468)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$CompilerRunner.runSafe(DartCompilerUtilities.java:100)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:755)         ... 11 more !SUBENTRY 1 com.google.dart.tools.core 4 0 2012-08-31 12:46:05.306 !MESSAGE Failed to parse weather.dart.js !STACK 0 java.lang.NullPointerException         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.secureAnalyzeLibrary(DartCompilerUtilities.java:846)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$ResolverRunnable.run(DartCompilerUtilities.java:468)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$CompilerRunner.runSafe(DartCompilerUtilities.java:100)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:755)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:733)         at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:697)         at com.google.dart.tools.ui.internal.text.editor.DartEditor.getAST(DartEditor.java:2042)         at com.google.dart.tools.ui.internal.text.editor.CompilationUnitEditor.reconciled(CompilationUnitEditor.java:1277)         at com.google.dart.tools.ui.internal.text.dart.DartReconcilingStrategy.reconcile(DartReconcilingStrategy.java:199)         at com.google.dart.tools.ui.internal.text.dart.DartReconcilingStrategy.reconcile(DartReconcilingStrategy.java:103)         at com.google.dart.tools.ui.internal.text.functions.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:91)         at com.google.dart.tools.ui.internal.text.functions.DartCompositeReconcilingStrategy.reconcile(DartCompositeReconcilingStrategy.java:125)         at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:77)         at com.google.dart.tools.ui.internal.text.functions.DartReconciler.process(DartReconciler.java:385)         at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:206)

clayberg commented 12 years ago

Removed this from the M1 milestone. Added this to the M2 milestone.

bwilkerson commented 12 years ago

I could not reproduce the problem being reported. The code snippet will not compile as is, but I wouldn't have expected it to. I tried to add the minimal additional wrapper code to remove other errors, but couldn't reproduce the error the user was seeing. For what it's worth, here's my modified test case:

var view;

WeatherController() {   view = new WeatherView();   view.close.on.click.add(hideError); }    void hideError(event) {   view.hideError(); }

class WeatherView {}


Added NeedsInfo label.

bwilkerson commented 12 years ago

Added AssumedStale label.