Skip to content

Commit

Permalink
Better error message for invoking nonexistent bridged default constru…
Browse files Browse the repository at this point in the history
…ctor
  • Loading branch information
ethanblake4 committed Jan 8, 2024
1 parent f690548 commit 965ebf1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 93 deletions.
92 changes: 0 additions & 92 deletions example/bridge_example.dart

This file was deleted.

8 changes: 7 additions & 1 deletion lib/src/eval/compiler/expression/method_invocation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,14 @@ Variable compileMethodInvocation(CompilerContext ctx, MethodInvocation e,

if (_dec.isBridge) {
final bridge = _dec.bridge;

/// If we're invoking a class identifier directly (like ClassName()), call
/// its default constructor
final fnDescriptor = bridge is BridgeClassDef
? bridge.constructors['']!.functionDescriptor
? (bridge.constructors['']?.functionDescriptor ??
(throw CompileError(
'Class "${e.methodName.name}" does not have a default constructor',
e)))
: (bridge as BridgeFunctionDeclaration).function;

final argsPair = compileArgumentListWithBridge(
Expand Down

0 comments on commit 965ebf1

Please sign in to comment.