Skip to content

Commit

Permalink
Update src/interpreter/runtimeModel.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Fernando Dodino <[email protected]>
  • Loading branch information
Juancete and fdodino authored Nov 3, 2023
1 parent a104cc7 commit 2ffdba1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/interpreter/runtimeModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,11 @@ export class Evaluation {

const target = node.instantiated.target ?? raise(new Error(`Could not resolve reference to instantiated module ${node.instantiated.name}`))

if (!target.is(Class)) raise(new Error(`${node.instantiated.name} is not a class, you cannot generate instances of a ${node.instantiated.target?.kind}`))
const name = node.instantiated.name

Check warning on line 492 in src/interpreter/runtimeModel.ts

View workflow job for this annotation

GitHub Actions / build

Trailing spaces not allowed

Check warning on line 492 in src/interpreter/runtimeModel.ts

View workflow job for this annotation

GitHub Actions / build

Trailing spaces not allowed
if (!target.is(Class)) raise(new Error(`${name} is not a class, you cannot generate instances of a ${target?.kind}`))

if (target.isAbstract) raise(new Error(`${node.instantiated.name} is an abstract class, you cannot generate instances`))
if (target.isAbstract) raise(new Error(`${name} is an abstract class, you cannot generate instances`))

return yield* this.instantiate(target, args)
}
Expand Down

0 comments on commit 2ffdba1

Please sign in to comment.